Open nirandiw opened 5 years ago
If you're looking to convert xml annotation files to a coco json, I think that my annotation_utils might be a good reference for you. In this repo, there are tools for converting labelImg xml annotations to labelme json annotations, and labelme json annotations to a coco json. It looks like the fields in your xml file are slightly different, so would have to modify field names slightly when parsing xml data. Refer to ElementTree for a guide on how to parse data from xml files.
I have txt files with polygon coordinates of objects in each frame, how can I convert them into the COCO format?
Suppose I have an image which I have annotated using an external tool. I was able to download it as a xml file with the annotation information.
As can be seen, the polygon is represented with a list of [x_i, y_i] coordinates. I want to convert this annotation to the coco annotations. I understand the x,y coordinates representing the polygon (i.e.,
<point><value>741</value><value>87</value></point>
) has to be mapped to a list to put under "segmentations". How can I generate that segmentation?Is what's stored in "segmentations" the binary mask of the polygon? If so can I use the output of this Matlab function for the above purpose? https://de.mathworks.com/help/images/ref/poly2mask.html
If not what should I do to get the coco segmentation values from a polygon given as a set of x,y coordinates.
@dexter1608