BoundingBoxes2D¶
- class aloscene.bounding_boxes_2d.BoundingBoxes2D(x, boxes_format: str, absolute: bool, labels: Optional[Union[dict, aloscene.labels.Labels]] = None, frame_size=None, names=('N', None), *args, **kwargs)¶
Bases:
aloscene.tensors.augmented_tensor.AugmentedTensor
Boxes2D Tensor.
- FORMATS = ['xcyc', 'xyxy', 'yxyx']¶
- GLOBAL_COLOR_SET = array([[2.99706296e-01, 1.12921613e-01, 4.46599072e-01], [2.90879256e-01, 3.65610983e-01, 3.44392263e-01], [1.20625557e-01, 3.50751731e-01, 8.67877079e-01], [7.73737889e-01, 8.95049659e-02, 1.19576752e-01], [9.79603274e-01, 9.57962473e-01, 5.83995094e-01], [4.43676481e-01, 4.65893743e-01, 6.89661277e-01], [5.94687653e-01, 2.32861016e-01, 4.17367997e-01], [1.24405108e-01, 8.40582895e-01, 9.40752254e-01], [4.25288036e-01, 3.80122702e-01, 2.28407752e-01], [3.94055706e-01, 8.76141550e-01, 7.17604837e-01], [6.67294100e-01, 8.23199876e-01, 4.36241428e-01], [1.42685751e-01, 1.39508256e-01, 5.06792355e-01], [9.20267645e-01, 8.37664382e-01, 4.47944036e-01], [6.49710231e-01, 1.00572965e-01, 1.28260103e-01], [1.28007186e-01, 4.38949338e-01, 8.89301891e-01], [4.99460100e-01, 5.62477445e-01, 2.79474811e-01], [2.17100105e-01, 6.89174282e-01, 1.05019362e-01], [3.95088060e-01, 8.37934865e-01, 3.18907316e-01], [7.59247284e-01, 1.54207130e-01, 5.88837141e-01], [4.84251230e-01, 5.41883656e-01, 5.78460247e-01], [1.74220980e-01, 2.17454702e-01, 5.24286011e-01], [8.48744851e-01, 8.64756788e-01, 8.61676887e-01], [9.17315123e-01, 6.65907715e-01, 3.48028846e-01], [3.43878267e-02, 7.94429515e-01, 7.52465819e-01], [6.97917295e-01, 6.09025812e-01, 5.95874170e-01], [5.20360519e-01, 2.81685497e-01, 7.71780270e-01], [4.60189655e-01, 1.32434518e-01, 5.26601184e-01], [7.71332358e-01, 2.83647122e-02, 8.46388149e-01], [5.69470848e-02, 7.51955534e-01, 6.19797095e-01], [9.40113234e-01, 1.59565306e-01, 1.90748601e-01], [4.16517083e-02, 5.99813722e-01, 9.81045856e-01], [2.07776551e-01, 6.96446913e-01, 3.17957460e-01], [9.50510245e-01, 9.82511740e-01, 7.96451715e-01], [3.99328799e-01, 1.66822109e-01, 4.90948464e-01], [2.77616067e-01, 6.12865234e-01, 6.21373030e-01], [9.65652017e-01, 4.16562790e-01, 1.94374577e-01], [7.64750741e-01, 1.89312950e-01, 6.37535755e-01], [9.85940756e-01, 2.16348874e-01, 7.38481435e-01], [4.67713608e-01, 6.92566638e-01, 3.37711062e-01], [6.62599278e-01, 1.29149030e-01, 3.68618004e-01], [4.50537991e-02, 6.43905462e-02, 9.77931165e-01], [3.06576427e-01, 7.00119355e-01, 7.97637064e-01], [4.19146957e-01, 7.03243918e-01, 9.69853080e-01], [2.85238648e-02, 7.73635007e-01, 5.98486173e-02], [8.38015272e-01, 5.96506289e-01, 2.36002306e-02], [4.74268780e-01, 4.69743604e-01, 2.44673896e-01], [5.38944719e-01, 2.51493693e-01, 3.27529135e-01], [5.07534600e-01, 9.36244965e-02, 6.61688289e-01], [1.44172397e-01, 7.65284284e-01, 5.73111726e-01], [1.07725342e-01, 5.22074427e-01, 8.41729016e-01], [7.65752488e-01, 9.93365737e-01, 5.93574127e-01], [4.24386672e-01, 3.38234810e-01, 8.24510975e-02], [5.87755884e-01, 5.97618669e-01, 9.59073593e-01], [2.55609667e-01, 7.69166225e-01, 6.97422870e-01], [3.03028475e-01, 7.67672440e-01, 9.09653721e-01], [1.38938577e-01, 5.01414503e-01, 2.97532977e-01], [4.83763381e-01, 7.33595493e-01, 1.18177504e-01], [9.78535344e-01, 7.53975753e-01, 2.54995590e-01], [5.79110819e-01, 4.32959088e-01, 6.57449467e-01], [3.04761188e-02, 1.78197124e-01, 1.82679031e-01], [5.39254133e-01, 6.87812190e-01, 9.32133632e-01], [3.76451505e-01, 9.62596573e-01, 4.43423731e-01], [2.93714209e-01, 7.97272138e-01, 2.09790113e-01], [1.76368554e-01, 9.51513787e-01, 2.42606505e-01], [1.61420213e-01, 6.28205277e-01, 2.75021987e-01], [9.09964232e-02, 5.09888444e-01, 8.62688509e-01], [2.08778544e-01, 5.12891664e-01, 8.73510326e-01], [1.20071020e-02, 8.30704639e-01, 2.27690540e-01], [2.22604942e-01, 9.44385708e-01, 3.71521833e-01], [7.99835651e-01, 9.47289682e-01, 4.77308245e-02], [9.06148329e-01, 9.24270324e-01, 2.10034638e-01], [2.03128608e-01, 2.66010074e-01, 3.35853428e-01], [5.53471212e-01, 1.00133255e-01, 7.85021536e-02], [8.65400850e-02, 9.70685630e-02, 9.54525691e-02], [3.86730818e-01, 6.94669003e-01, 8.47538196e-01], [2.91404197e-02, 2.12556038e-01, 9.45848217e-01], [1.01573518e-02, 3.65303336e-01, 1.52142056e-01], [1.19328787e-02, 9.28085192e-01, 6.49803308e-01], [2.45066351e-01, 4.30150565e-01, 6.77698357e-01], [7.62404387e-01, 8.67693356e-01, 8.98118201e-01], [1.09415695e-01, 8.11913570e-01, 4.69482472e-01], [9.91191438e-01, 8.21776547e-01, 7.74143943e-01], [7.77856308e-01, 4.08175227e-01, 7.89754352e-01], [2.64021870e-01, 3.08542211e-01, 6.14662452e-01], [1.08703782e-01, 7.58318236e-01, 8.16624872e-01], [2.30397866e-01, 1.57439643e-01, 9.64243515e-01], [5.61021307e-01, 3.50996342e-01, 9.95590970e-01], [7.75654494e-01, 7.54268708e-01, 4.96767380e-01], [6.14391735e-01, 6.04795949e-01, 4.41002649e-01], [7.44398756e-01, 2.45093133e-03, 1.55063802e-01], [5.14935338e-01, 2.68220504e-01, 2.93189364e-01], [5.51005229e-01, 3.91559028e-01, 8.90291605e-01], [5.59333520e-01, 2.47393835e-02, 4.38854459e-01], [1.77646448e-02, 2.09710224e-01, 6.79384543e-01], [9.99201204e-01, 6.63396338e-01, 2.54779696e-01], [2.99921852e-01, 5.70954888e-01, 5.50165707e-01], [4.58569475e-01, 5.87899595e-01, 6.87435697e-01], [4.41071030e-01, 3.99223449e-01, 3.13072216e-01], [1.39977294e-01, 7.81157385e-01, 1.65109356e-01], [1.66917625e-01, 1.93610902e-01, 7.56560266e-01], [8.83478347e-01, 9.83961364e-01, 5.96587537e-01], [1.73455073e-01, 3.13520974e-01, 9.36422203e-01], [8.13084059e-01, 5.23599575e-01, 5.99009071e-01], [6.88586194e-02, 4.17600741e-01, 5.41957316e-01], [7.42904727e-01, 4.29201944e-01, 7.06797182e-01], [8.05169697e-01, 4.28142564e-01, 7.91825279e-01], [3.52891400e-01, 5.41830554e-01, 1.47103447e-01], [2.77946945e-01, 7.66452541e-01, 3.49983560e-01], [4.00819157e-01, 4.83780808e-01, 3.99507426e-01], [1.15210213e-01, 5.61368908e-02, 1.46406351e-01], [9.86166188e-01, 3.45398947e-02, 5.66857574e-01], [3.44399895e-01, 1.78777501e-01, 6.61600747e-01], [2.51097186e-01, 1.27099208e-01, 2.41894734e-01], [1.97701028e-01, 5.64344971e-01, 9.04437640e-01], [9.90063780e-01, 6.60953736e-01, 9.80387101e-01], [3.49703236e-01, 7.15088625e-02, 2.77438827e-01], [3.68192688e-01, 2.28545721e-01, 6.19242426e-01], [7.32341182e-01, 5.11691907e-01, 4.69946622e-01], [4.76275759e-02, 7.97487153e-01, 2.06148241e-01], [6.71522226e-02, 7.62113942e-01, 4.84101993e-01], [6.58137991e-01, 8.24572259e-01, 4.82773104e-01], [3.24609747e-01, 4.40729489e-01, 9.61018186e-01], [6.37844146e-01, 1.73997584e-01, 6.09494858e-02], [1.50138889e-01, 7.37693244e-02, 4.02968636e-01], [4.66148970e-02, 6.48104179e-01, 7.22136800e-01], [8.40649491e-01, 4.59768601e-01, 9.31176982e-01], [1.54569385e-02, 2.96653278e-01, 6.61103382e-01], [1.04119481e-01, 6.08817792e-01, 2.57713193e-01], [1.84279112e-01, 9.39344775e-01, 3.77598847e-01], [3.14128824e-01, 9.48938736e-01, 3.04874016e-01], [3.48598628e-01, 9.27989183e-01, 7.07870363e-01], [6.28852497e-01, 2.90206548e-01, 2.99829637e-02], [6.67331559e-01, 9.75735485e-01, 3.00159851e-01], [9.66917036e-01, 5.45310316e-02, 6.23266388e-01], [1.64933322e-01, 2.96191997e-01, 7.82937714e-01], [3.14539692e-01, 9.84164432e-01, 2.94497217e-01], [4.36431987e-01, 6.65067771e-01, 5.89964217e-01], [1.67831527e-01, 9.14363851e-01, 6.51613569e-01], [9.18762606e-01, 3.33270789e-03, 8.51539646e-01], [5.55835216e-01, 9.14247333e-01, 4.84301525e-01], [5.83030218e-01, 1.59210991e-01, 6.30702881e-01], [2.82588178e-01, 1.65421511e-01, 8.68583363e-01], [9.34103563e-01, 9.50835760e-01, 2.82708323e-01], [6.90345274e-01, 5.94087964e-01, 8.82227314e-01], [7.50207678e-01, 9.10899068e-01, 8.97093255e-01], [9.08526510e-01, 6.24834611e-01, 5.61718622e-01], [6.56725107e-01, 4.76360560e-01, 2.98195025e-01], [9.10305588e-01, 8.85091537e-01, 7.82422198e-01], [6.69435785e-01, 4.74112186e-01, 2.22128649e-01], [4.36317878e-01, 9.84339841e-01, 9.83051399e-01], [6.92396779e-01, 6.70792886e-01, 7.83324946e-01], [2.89339351e-01, 1.15653182e-01, 9.37088945e-02], [6.11886488e-01, 2.72366775e-01, 3.70343670e-01], [4.79491331e-01, 8.08027281e-01, 4.46321268e-02], [2.48033253e-01, 9.83557829e-01, 5.24873060e-03], [2.95460682e-01, 2.24568951e-01, 6.52506672e-02], [2.35784922e-01, 1.63574387e-01, 5.79207557e-01], [3.58270290e-01, 5.18926775e-01, 6.16088879e-01], [8.92035442e-01, 7.85944980e-02, 2.40114690e-01], [1.03335943e-01, 6.93357992e-01, 7.56194948e-01], [8.91605333e-01, 8.92275251e-01, 2.04587221e-01], [6.86003087e-01, 3.93101057e-01, 2.49885566e-01], [5.42938804e-01, 6.70613403e-01, 4.59967107e-01], [1.49588511e-01, 5.31799552e-01, 3.55989290e-01], [6.93591252e-02, 1.96620758e-01, 6.71602391e-01], [4.05994362e-02, 5.15524881e-01, 3.62263973e-01], [8.29713198e-01, 8.55583297e-01, 9.61654997e-02], [9.53878839e-01, 2.36521038e-01, 2.58519625e-01], [5.15205015e-01, 7.96482586e-01, 9.01489084e-01], [9.45234899e-01, 1.95329289e-01, 5.18838328e-01], [2.66494927e-01, 1.58148635e-01, 3.05972891e-01], [8.23885994e-01, 1.34748716e-01, 4.96198589e-01], [6.69859848e-03, 4.77529370e-01, 5.46417379e-01], [1.95322363e-01, 1.20483222e-01, 4.01412360e-01], [9.81779440e-03, 7.97093540e-01, 5.51926796e-01], [9.69146903e-01, 7.24135251e-01, 2.91948573e-01], [5.00204472e-02, 8.58551430e-01, 3.61022231e-01], [7.72103431e-01, 8.13454091e-01, 8.51259558e-01], [2.06325925e-02, 9.25918035e-01, 6.04822710e-01], [3.09094712e-01, 7.88891904e-01, 4.14032232e-01], [8.71190578e-01, 8.70594696e-01, 1.02730001e-01], [8.25403250e-01, 4.28413887e-01, 7.22904466e-01], [1.78438102e-01, 1.52829437e-01, 8.76964335e-01], [2.49573932e-01, 8.91447936e-01, 1.23325032e-01], [2.20466817e-01, 6.51137867e-01, 4.37782600e-01], [1.73823287e-01, 2.84465717e-01, 8.59469003e-01], [3.60048677e-01, 2.42204493e-01, 5.08482371e-01], [3.23247777e-01, 2.20788081e-01, 3.01284568e-01], [9.33177747e-01, 4.34829280e-01, 2.07424044e-01], [4.82201724e-01, 2.51441696e-01, 2.28508218e-02], [3.98811528e-01, 9.91866292e-01, 9.16902778e-01], [2.28767839e-01, 2.71857940e-01, 4.38963467e-01], [7.94003097e-01, 1.15059445e-01, 3.23059211e-01], [9.59134616e-01, 7.04772201e-01, 7.53923576e-01], [4.68705006e-01, 4.46924197e-01, 4.80421045e-03], [5.90100879e-01, 5.84158592e-01, 8.51268173e-01], [6.70712863e-01, 9.22355425e-01, 5.16826625e-01], [5.31666474e-01, 2.70804075e-01, 4.25454067e-01], [9.53758957e-01, 2.27377255e-01, 2.82536143e-01], [8.14901921e-01, 5.03872254e-01, 8.75963803e-01], [9.74845295e-01, 7.22862365e-01, 1.90760191e-01], [2.52851087e-01, 5.26920870e-01, 3.37793197e-03], [2.82050048e-01, 1.96544465e-02, 2.09463034e-01], [9.35577368e-01, 9.10047256e-02, 6.00630891e-01], [8.59315360e-01, 9.70072899e-01, 6.07021418e-02], [3.24603436e-01, 9.88660435e-01, 1.03760871e-02], [8.27636232e-01, 7.48255898e-01, 8.66434807e-01], [1.51228718e-01, 5.95017101e-01, 6.32439932e-01], [2.88764308e-01, 7.39864336e-01, 5.14213758e-01], [6.63545749e-01, 2.23190917e-01, 9.90076284e-02], [5.31696089e-01, 4.06783829e-01, 4.68399237e-01], [1.71664230e-01, 5.05625390e-01, 1.33735841e-01], [3.07556239e-01, 8.71011013e-01, 5.67807741e-01], [4.42163535e-01, 9.44063067e-01, 7.47495599e-01], [1.48818781e-02, 5.80481041e-01, 2.53285631e-01], [5.36335809e-01, 3.68693320e-01, 2.56224417e-01], [8.58273479e-01, 6.51024932e-01, 1.86661993e-01], [3.06819102e-01, 7.60185582e-01, 3.42956539e-01], [2.22653131e-01, 2.77243902e-01, 7.46084398e-01], [8.57587518e-01, 7.42853762e-01, 1.31807037e-01], [8.15638290e-01, 8.61952807e-01, 1.42925604e-01], [2.05640656e-01, 6.33810312e-01, 9.97664087e-02], [7.35414255e-01, 3.18733375e-01, 6.10343312e-01], [4.20390712e-02, 9.21535104e-01, 1.63981616e-01], [1.91303686e-01, 1.75259072e-01, 9.94712473e-01], [1.59610660e-01, 1.35567359e-01, 6.04388196e-01], [7.06002222e-01, 3.79185960e-01, 7.22738850e-01], [2.55986460e-01, 7.77310918e-01, 1.81514809e-01], [7.14361201e-01, 7.18587281e-01, 2.38051907e-01], [3.68983008e-01, 1.79509705e-02, 5.39606577e-01], [5.06577017e-01, 5.02712669e-01, 7.22795155e-01], [6.45611063e-01, 4.00215137e-01, 3.03880605e-01], [9.02637461e-01, 6.40639729e-01, 8.57817782e-01], [3.76334942e-01, 2.09974838e-01, 9.36290787e-01], [4.92906166e-02, 4.77297886e-01, 7.77797875e-02], [3.60495137e-01, 9.98695788e-01, 4.37664331e-01], [1.03478593e-01, 8.88564202e-01, 5.40667169e-01], [3.27503982e-01, 1.26910887e-02, 6.38740534e-01], [3.86123463e-01, 7.45599786e-02, 8.27608733e-01], [7.45454722e-01, 1.08153991e-01, 7.35063551e-01], [2.60173608e-02, 7.98457887e-01, 7.92363776e-01], [2.93715457e-01, 7.16201906e-01, 6.12659113e-01], [7.28731766e-01, 1.51499297e-02, 2.79890251e-01], [5.88466606e-01, 5.28238067e-01, 3.23802378e-01], [9.91583537e-01, 8.94398543e-01, 7.08348359e-02], [5.15016455e-01, 8.38944222e-01, 2.97154195e-01], [7.88766773e-01, 9.71508068e-01, 4.90754411e-01], [9.14424412e-01, 2.16665622e-01, 9.98648200e-01], [2.68751827e-01, 6.49435524e-01, 8.28285096e-01], [7.48585800e-01, 3.48600382e-01, 4.11365090e-01], [8.32206036e-01, 5.70339913e-01, 2.23125445e-01], [4.01693818e-01, 4.61637559e-02, 1.08897503e-01], [7.17066111e-01, 7.92086297e-01, 7.44726311e-01], [7.29333737e-01, 9.72150734e-01, 6.42281033e-01], [8.81706826e-01, 9.84768479e-01, 2.45726122e-01], [9.93132891e-01, 2.42385955e-01, 4.15011014e-01], [6.95960441e-01, 2.06413557e-01, 9.58687131e-01], [4.28751525e-01, 3.42819821e-01, 9.83936217e-01], [9.59044999e-01, 3.26250020e-01, 2.59475331e-01], [7.93008534e-01, 8.52037835e-01, 3.56809213e-01], [3.92420729e-01, 5.55989053e-01, 4.63399427e-01], [4.51887899e-01, 8.40482958e-01, 2.85685524e-01], [8.18648595e-01, 6.65119162e-01, 9.09388471e-01], [5.91752845e-01, 9.36606170e-04, 5.00508215e-01], [3.51688990e-01, 9.60780852e-01, 7.08938472e-01], [8.93024218e-01, 6.36981317e-01, 7.29011612e-01], [7.33229234e-01, 2.55228428e-01, 1.28164126e-01], [9.34837902e-01, 8.47478223e-01, 6.19779656e-01], [4.32853739e-01, 4.17928680e-01, 2.37532005e-02], [1.43042841e-01, 5.56877725e-02, 9.47156683e-01], [3.69041584e-01, 2.45859593e-01, 9.05919485e-01], [3.41645203e-01, 8.05144850e-01, 1.49046972e-02], [3.99682481e-01, 1.02340613e-01, 7.43952490e-01], [8.33000444e-01, 9.83890262e-01, 1.04081079e-01], [5.79725511e-01, 2.71176431e-01, 3.21105030e-01], [8.72665983e-01, 4.15011558e-01, 9.64432783e-01], [2.02201126e-01, 3.87564552e-01, 3.15864931e-01], [8.20113772e-01, 9.39815691e-01, 1.77756810e-01], [8.74578149e-01, 7.33667201e-01, 8.55396186e-01], [9.35023717e-01, 8.52754593e-01, 3.53438169e-01], [2.10088848e-02, 6.37745020e-02, 3.39320385e-01], [6.18981384e-01, 4.89543529e-01, 3.50186277e-02], [1.67384841e-02, 5.17828159e-01, 4.40357930e-01], [9.47200802e-01, 9.26812553e-01, 1.13817184e-01], [5.93250958e-01, 7.37402211e-01, 6.07753378e-01], [3.24927253e-01, 3.14128119e-02, 4.65204624e-01], [6.29976252e-01, 5.63336631e-01, 9.61428914e-01], [5.26835802e-01, 3.89778210e-01, 4.84331772e-01], [9.56720742e-01, 6.31001691e-01, 4.18892872e-01], [8.69998771e-01, 5.47708146e-01, 9.37588967e-01], [5.14312282e-01, 4.18010833e-01, 6.95208665e-01], [4.44286947e-01, 8.78722001e-01, 3.84996651e-01], [3.36962272e-01, 2.40735860e-01, 6.26152547e-01], [7.79319073e-01, 1.93299667e-02, 8.00252999e-01], [1.66092573e-01, 9.34305328e-01, 9.61717298e-01], [8.37310897e-01, 9.80758245e-01, 6.78176969e-01], [2.43130401e-02, 5.94617276e-01, 6.56350143e-01], [2.52001675e-01, 3.43445851e-01, 5.69303778e-01], [4.02008869e-02, 5.87901050e-01, 4.19592251e-01], [1.07183093e-01, 2.18551544e-01, 4.03145841e-01]])¶
- abs_area(size)¶
Get the absolute area
- abs_pos(frame_size)¶
Get a new BoundingBoxes2D Tensor with absolute position relative to the given frame_size.
- Return type
- append_labels(labels, name=None)¶
Attach a set of labels to the boxes.
- Parameters
- labels: aloscene.Labels
Set of labels to attached to the frame
- name: str
If none, the label will be attached without name (if possible). Otherwise if no other unnamed labels are attached to the frame, the labels will be added to the set of labels.
- area()¶
Get the current boxes area. The area will be relative to the frame size if the boxes are in a relative state. Otherwise, the area will be absolute.
- as_boxes(boxes)¶
- static boxes2abspos(tensor, frame_size)¶
Get a new BoundingBoxes2D Tensor with absolute position relative to the given frame_size.
- static boxes2relpos(tensor)¶
Get a new BoundingBoxes2D Tensor with relative position (between 0 and 1)
- static boxes2xcyc(tensor)¶
Get a new BoundingBoxes2D Tensor with boxes following this format: [x_center, y_center, width, height]. Could be relative value (betwen 0 and 1) or absolute value based on the current Tensor representation.
- static boxes2xyxy(tensor)¶
- static boxes2yxyx(tensor)¶
- static boxes_hflip(boxes)¶
Flip frame horizontally
- fit_to_padded_size()¶
If the set of Boxes did not get padded by the pad operation, this method wil padd the boxes to the real padded size.
- Returns
- padded_boxes2d sa_tensor: aloscene.BoundingBoxes2D
padded_boxes2d BoundingBoxes2D
- get_view(frame=None, size=None, labels_set=None, **kwargs)¶
Create a view of the boxes a frame
- Parameters
- frame: aloscene.Frame
Tensor of type Frame to display the boxes on. If the frameis None, a frame will be create on the fly.
- size: (tuple)
(height, width) Desired size of the view. None by default
- labels_set: str
If provided, the boxes will rely on this label set to display the boxes color. If labels_set is not provie while the boxes have multiple labels set, the boxes will be display with the same colors.
- get_with_format(boxes_format)¶
Set boxes into the desired format (Inplace operation)
- static giou(boxes1, boxes2)¶
Generalized IoU from https://giou.stanford.edu/ The boxes should be in [x0, y0, x1, y1] format Returns a [N, M] pairwise matrix, where N = len(boxes1) and M = len(boxes2)
- Parameters
- boxes1: aloscene.BoundingBoxes2D
- boxes2: aloscene.BoundingBoxes2D
- Returns
- giou_tensor: torch.Tensor
Giou between each boxes
- giou_with(boxes2)¶
Generalized IoU from https://giou.stanford.edu/ The boxes should be in [x0, y0, x1, y1] format Returns a [N, M] pairwise matrix, where N = len(boxes1) and M = len(boxes2)
- Parameters
- boxes2: aloscene.BoundingBoxes2D
- Returns
- giou_tensor: torch.Tensor
Giou between each boxes
- static iou(boxes1, boxes2, ret_union=False)¶
Compute the IOU between the two set of boxes
- Parameters
- boxes1: aloscene.BoundingBoxes2D
- boxes2: aloscene.BoundingBoxes2D
- Returns
- iou_tensor: torch.Tensor
IOU between each boxes
- iou_with(boxes2, ret_union=False)¶
Compute the IOU between the two set of boxes
- Parameters
- boxes2: aloscene.BoundingBoxes2D
- Returns
- iou_tensor: torch.Tensor
IOU between each boxes
- nms(scores, iou_threshold=0.5)¶
Perform NMS on the set of boxes. To be performed, the boxes one must passed a scores tensor.
- Parameters
- scores: torch.Tensor
Scores of each boxes to perform the NMS computation.
- iou_threshold: float
NMS iou threshold
- Returns
- int64 tensor
The indices of the elements that have been kept by NMS, sorted in decreasing order of scores
- rel_area()¶
Get the absolute area
- rel_pos()¶
Get a new BoundingBoxes2D Tensor with absolute position relative to the given frame_size.
- remove_padding()¶
- xcyc()¶
Get a new BoundingBoxes2D Tensor with boxes following this format: [x_center, y_center, width, height]. Could be relative value (betwen 0 and 1) or absolute value based on the current Tensor representation.
- xyxy()¶
Get a new BoundingBoxes2D Tensor with boxes following this format: [x1, y1, x2, y2]. Could be relative value (betwen 0 and 1) or absolute value based on the current Tensor representation.
- yxyx()¶
Get a new BoundingBoxes2D Tensor with boxes following this format: [y1, x1, y1, x1]. Could be relative value (betwen 0 and 1) or absolute value based on the current Tensor representation.