Hi all,
I am trying to use bounding boxes for a custom application.
I have a CSV with 5 columns:
- Image name
- Top left x
- Top left y
- Bottom right x
- Bottom right y
Here is my dataframe with 5 sample rows:
I tried to customise the label_cls by using a custom class, since ObjectItem is needed for bounding box predictions.
class ObjectList(ObjectCategoryList):
"`ItemList` for labelled bounding boxes."
_processor = ObjectCategoryProcessor
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.items = [[[int(i) for i in item], [5]] for item in self.items] #using [5] to simplify
print(self.items)
def get(self, i):
print('Element: ', i)
print(self.items[i])
return MyBox.create(*_get_size(self.x,i), *self.items[i], classes=self.classes, pad_idx=self.pad_idx)
First print in init, prints self.items as following:
[[[218, 190, 233, 236], [5]], [[275, 225, 293, 272], [5]], [[254, 242, 280, 315], [5]], [[297, 170, 317, 222], [5]], [[317, 212, 339, 258], [5]]]
While second print in get(self, i) prints self.items for all elements like this:
Element: 0
[list([218, 190, 233, 236]) list([1])]
I am unable to understand why self.items changes data from [[[ ]]] to [list() list()]. It’s causing me problem downstream as data expected by create API is not as expected.
Also, I am not sure why list([1]) comes in second print while I passed [5], which is correctly reflected in self.items first print. Seems I am missing some manipulation somewhere…
Any pointers will be appreciated.
Regards,
Dev.