File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
clarifai_datautils/image/annotation_conversion Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -71,11 +71,10 @@ def create_item(self, image_path: str) -> DatasetItem:
71
71
return DatasetItem (id = image_path .split ('.png' )[0 ], media = image_data , annotations = annotations )
72
72
73
73
def clarifai_bbox_to_datumaro_bbox (self , clarifai_bbox , width , height ) -> Tuple [int ]:
74
- left_col = clarifai_bbox ['leftCol' ] * width
75
- top_row = clarifai_bbox ['topRow' ] * height
76
- right_col = clarifai_bbox ['rightCol' ] * width
77
- bottom_row = clarifai_bbox ['bottomRow' ] * height
78
-
74
+ left_col = clarifai_bbox ['leftCol' ] * width if 'leftCol' in clarifai_bbox .keys () else 0
75
+ top_row = clarifai_bbox ['topRow' ] * height if 'topRow' in clarifai_bbox .keys () else 0
76
+ right_col = clarifai_bbox ['rightCol' ] * width if 'rightCol' in clarifai_bbox .keys () else 0
77
+ bottom_row = clarifai_bbox ['bottomRow' ] * height if 'bottomRow' in clarifai_bbox .keys () else 0
79
78
obj_box = (left_col , top_row , right_col - left_col , bottom_row - top_row )
80
79
return obj_box
81
80
You can’t perform that action at this time.
0 commit comments