CVHub520 / X-AnyLabeling

Effortless data labeling with AI support from Segment Anything and other awesome models.
GNU General Public License v3.0
3.02k stars 342 forks source link

failure to export json data to coco dataset #448

Closed tigerdhl closed 2 weeks ago

tigerdhl commented 3 weeks ago

my json data is: { "version": "2.3.5", "flags": {}, "shapes": [ { "mask": null, "label": "cover", "points": [ [ 0.8136645962732914, 0.41176470588234626 ], [ 226.58823529411762, 0.41176470588234626 ], [ 226.58823529411762, 391.0 ], [ 0.8136645962732914, 391.0 ] ], "group_id": null, "description": "", "difficult": false, "shape_type": "rectangle", "flags": {}, "attributes": {} }, { "mask": null, "label": "1", "points": [ [ 147.08695652173913, 7.9565217391304355 ] ], "group_id": null, "description": "", "difficult": false, "shape_type": "point", "flags": {}, "attributes": {} }, { "mask": null, "label": "2", "points": [ [ 209.5093167701863, 387.7701863354037 ] ], "group_id": null, "description": "", "difficult": false, "shape_type": "point", "flags": {}, "attributes": {} } ], "imagePath": "20240507_v11.jpg", "imageData": null, "imageHeight": 392, "imageWidth": 392, "text": "" }

and export to coco dataset seen lake of points info { "info": { "year": 2023, "version": "2.3.5", "description": "COCO Label Conversion", "contributor": "CVHub", "url": "https://github.com/CVHub520/X-AnyLabeling", "date_created": "2024-06-05" }, "licenses": [ { "id": 1, "url": "https://www.gnu.org/licenses/gpl-3.0.html", "name": "GNU GENERAL PUBLIC LICENSE Version 3" } ], "categories": [ { "id": 1, "name": "cover", "supercategory": "" }, { "id": 2, "name": "1", "supercategory": "" }, { "id": 3, "name": "2", "supercategory": "" } ], "images": [ { "id": 1, "file_name": "20240507_v11.jpg", "width": 392, "height": 392, "license": 0, "flickr_url": "", "coco_url": "", "date_captured": "" } ], "annotations": [ { "id": 1, "image_id": 1, "category_id": 1, "bbox": [ 0.8136645962732914, 0.41176470588234626, 225.77457069784433, 390.5882352941177 ], "area": 88184.89114315802, "iscrowd": 0, "ignore": 0, "segmentation": [] }, { "id": 2, "image_id": 1, "category_id": 2, "bbox": [], "area": 0, "iscrowd": 0, "ignore": 0, "segmentation": [] }, { "id": 3, "image_id": 1, "category_id": 3, "bbox": [], "area": 0, "iscrowd": 0, "ignore": 0, "segmentation": [] } ] }

CVHub520 commented 3 weeks ago

@tigerdhl, Hi there!

Thank you for reaching out and providing the JSON data details. Upon reviewing the data, it appears that there are annotations with only a single point. These instances seem to be incomplete annotations, possibly resulting from canceling the drawing process after starting it. 🤔

// valid points info
"points": [
[
0.8136645962732914,
0.41176470588234626
],
[
226.58823529411762,
0.41176470588234626
],
[
226.58823529411762,
391.0
],
[
0.8136645962732914,
391.0
]
]

// Invalid points info
"points": [
[
209.5093167701863,
387.7701863354037
]
]

In the COCO dataset format, annotations with a single point are not valid, as they do not form a meaningful shape for object detection or segmentation. Therefore, when exporting to COCO or other formats, X-AnyLabeling automatically filters out these incomplete annotations. This behavior is by design and is considered normal. 😊

If you have any further questions or need assistance with your annotations, please let us know. We're here to help!

Best regards, CVHub

tigerdhl commented 3 weeks ago

Thank u for respond. "In the COCO dataset format, annotations with a single point are not valid,as they do not form a meaningful shape for object detection or segmentation." but my task is keypoint detect, so it is normal label a single point in the image

CVHub520 commented 3 weeks ago

Thank you for your response.

I apologize for the inconvenience. Currently, X-AnyLabeling does not support the export of keypoint annotations as they are a specialized format. For your task of keypoint detection, it is indeed valid to label single points in the image.

To address this, you would need to modify the source code to add support for exporting keypoint annotations in the desired format. If you're comfortable with coding, you can take a look at the relevant parts of the code where the export functionality is handled and make the necessary adjustments.

If you need any guidance or have further questions about how to proceed with these modifications, please let us know. We're here to assist you! 😊

Good lucks!