Skip to content

Commit

Permalink
Disable fix_segments_intersections for now (#751)
Browse files Browse the repository at this point in the history
* Disable fix_segments_intersections for now

When the bounding boxes had intersections and were exported with the COCO JSON format they were often cut off. I commented out the line with the function fix_segments_intersections and replaced it with lines of that function. This helped with the bounding boxes and keeps the masks as they are created with CVAT. It is probably inconvenient for the user to get something fixed in the export without an active agreement of the user. Secondly letting a function automatically fix segments could result in a bad fix.

* Use fix_segments_intersections only with z-order

The fix_segments_intersections will only be used when the z-order flag is set. This is useful for bounding boxes or masks which don't need to be fixed. This fix was created according to Andrey Zhavoronkov's (@azhavoro) advice.
  • Loading branch information
johalaoui authored and nmanovic committed Oct 11, 2019
1 parent f5c5624 commit 197a366
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cvat/apps/annotation/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,11 @@ def insert_annotation_data(image, category_map, segm_id, obj, result_annotation)

# Create new image
insert_image_data(img, result_annotation)
polygons = fix_segments_intersections(polygons, img.height, img.width, img.name)
if annotations.meta['task']['z_order'] == 'True':
polygons = fix_segments_intersections(polygons, img.height, img.width, img.name)
else:
for polygon in polygons:
polygon['points'] = [polygon['points']]

# combine grouped polygons with the same label
grouped_poligons = OrderedDict()
Expand Down

0 comments on commit 197a366

Please sign in to comment.