jsbroks / coco-annotator

:pencil2: Web-based image segmentation tool for object detection, localization, and keypoints
MIT License
2.11k stars 460 forks source link

Image ID does not match the image filename in JSON export #212

Open dallas94 opened 5 years ago

dallas94 commented 5 years ago

I have an image with the filename 00000000012.jpg. After annotation and exporting the tool is not assigning the image ID as 12. How can I get he image ID in the dataset to match the filename? @jsbroks

As far as I am aware this is a structure of the COCO dataset where they have to match.

jsbroks commented 5 years ago

Currently there is no way to set the Image Id. Could you please provide a reference to the documentation where this is the structure?

AFAIK the file_name does not matter. It has worked fine for me when training many different models that use the COCO format.

dallas94 commented 5 years ago

If you download the official train/Val COCO 2017 annotations the image filename matches the id. The snippet below is straight from the coco file. You can see where the jpg filename matches the "id" image parameter. Also, when I was training my small COCO dataset using your program it did not read the file path correctly until the filename and id matched in the JSON file. @jsbroks

"images": [ { "license": 4, "file_name": "000000397133.jpg", "coco_url": "http://images.cocodataset.org/val2017/000000397133.jpg", "height": 427, "width": 640, "date_captured": "2013-11-14 17:02:52", "flickr_url": "http://farm7.staticflickr.com/6116/6255196340_da26cf2c9e_z.jpg", "id": 397133 }, { "license": 1, "file_name": "000000037777.jpg", "coco_url": "http://images.cocodataset.org/val2017/000000037777.jpg", "height": 230, "width": 352, "date_captured": "2013-11-14 20:55:31", "flickr_url": "http://farm9.staticflickr.com/8429/7839199426_f6d48aa585_z.jpg", "id": 37777 },

jsbroks commented 5 years ago

Note that image ids need to be unique (among other images), but they do not necessarily need to match the file name (unless the deep learning code you are using makes an assumption that they’ll be the same… developers are lazy, it wouldn’t surprise me).

What model are you using?

Since this is not mandatory by the COCO format, this issue will be placed on the backlogs. Please consider creating PR. I am more than happy to guide you for where to look, etc.

dallas94 commented 5 years ago

https://github.com/leoxiaobin/deep-high-resolution-net.pytorch

I think you are right. The deep learning model link I provided requires it to be the same. If there was a way to reset the image id in coco annotator to 1 then I assume I could annotate images starting from "000000000001.jpg"? @jsbroks

jsbroks commented 5 years ago

You'd have to rest the database (delete the volume) since it keeps track of the counts

TaiseiYamana commented 4 years ago

I face the same problem. I want to reset the image ID and annotation ID. Container volume deletion method does not adapt well. Is this code correct?

スクリーンショット 2019-11-14 20 04 53

Please tell me when to use.

jsbroks commented 4 years ago

Thats is the command to delete the database