coco-annotator icon indicating copy to clipboard operation
coco-annotator copied to clipboard

Import Dataset and Import Coco Don't Work

Open sbillin opened this issue 4 years ago • 5 comments

Is there a way to import a dataset that was previously annotated and exported using coco-annotator?

It appears that coco-annotator's functionality for this is broken. I noticed there is an "Import" button on the dataset tab, but when I click this button nothing happens.

I've also tried creating a new dataset and then copying the files from my prior dataset folder to get the images, then open the dataset and click "Import COCO" to import the annotations file that I previously exported from coco-annotator. This appears to work at first (an output on the terminal says that import succeeded and going back to the dataset tab shows annotations listed for the dataset below the thumbnail view). However, when clicking on one of the images to inspect / edit the annotation, no annotation is shown for the image. Also, opening an image causes the annotation to reset in the dataset tab as well (i.e., the dataset tab no longer shows the image as annotated below the thumbnail view).

This is a nice tool, but not having the ability to import prior annotations really limits the functionality by making it impossible to copy and edit annotation data between different machines.

sbillin avatar Dec 03 '21 17:12 sbillin

Could you paste any error logs (using portainer or docker logs) when importing?

I have using coco-annotator for 2 years, "Import COCO" works normally, maybe have some problem (num_annotations have wrong quantity), I haven't encountered your situation.

geminixiang avatar Dec 07 '21 07:12 geminixiang

@f416720001 I have the same problem, I have a pre-annotated dataset, and I want to import it to coco-annotator, I wrote it in coco format and:

  • added the dataset id correctly (the id of the newly created dataset)
  • added the annotations id (I went to the database, found the last annotation id, then started from the next number).
  • I also incremented the image id (according to the last image id in the database).

But the import stops at 52%, it gives this in the console

Vue-Socket.io: Broadcasting: #taskProgress, Data: {id: 74, progress: 4.761904761904762, errors: 0, warnings: 0} Vue-Socket.io: Broadcasting: #taskProgress, Data: {id: 74, progress: 14.285714285714285, errors: 0, warnings: 0} Vue-Socket.io: Broadcasting: #taskProgress, Data: {id: 74, progress: 23.809523809523807, errors: 0, warnings: 0} Vue-Socket.io: Broadcasting: #taskProgress, Data: {id: 74, progress: 33.33333333333333, errors: 0, warnings: 0} Vue-Socket.io: Broadcasting: #taskProgress, Data: {id: 74, progress: 42.857142857142854, errors: 0, warnings: 0} Vue-Socket.io: Broadcasting: #taskProgress, Data: {id: 74, progress: 52.38095238095239, errors: 0, warnings: 0}

and then stops image

mo-alaa avatar Jan 09 '22 09:01 mo-alaa

@sbillin I have the same problem, have you found any solution yet ?

mo-alaa avatar Jan 10 '22 07:01 mo-alaa

@mo-alaa All id will mapping in COCO Annotator, so you don't have to handle it yourself

and workflow of import is Category -> Image -> Annotation your progress at 52.3%, I guessed that it stuck at "import Annotation".

Annotation data must have "image_id" and "category_id", and has the corresponding id

COCO.json sample~

{
  "categories":[{
    "id": 1, 
    "name": "\u4eba", 
    "supercategory": "", 
    "color": "#ee0ae0", 
  }],
  "images":[{
    "id": 1, 
    "dataset_id": 1, 
    "category_ids": [], 
    "path": "/datasets/path/to/image377.jpg", 
    "width": 1750, 
    "height": 1492, 
    "file_name": "image377.jpg", 
    "metadata": {}, 
  }],
  "annotations":[{
    "id": 12345, 
    "image_id": 1, 
    "category_id": 1, 
    "segmentation": [[762.0, 1057.0, ...]], 
    "area": 100575, 
    "bbox": [8.0, 464.0, 321.0, 691.0],
   }]
}

geminixiang avatar Jan 11 '22 17:01 geminixiang

Thanks @f416720001 for the tips, it works like a charm. I think this issue should be closed because it's not a bug.

mo-alaa avatar Jan 13 '22 11:01 mo-alaa