image-segmentation-keras icon indicating copy to clipboard operation
image-segmentation-keras copied to clipboard

annotating data set

Open temi92 opened this issue 4 years ago • 4 comments

Hi, Is there support for VOC data set or COCO dataset when annotating images using tools like labelme Kind Regards.

temi92 avatar Jun 22 '20 12:06 temi92

Hello @temi92

I was having the same question a while ago, I was not able to find a solution for it but ended up hacking my way into it ...

labelme_json_to_dataset {name_of_my_dataset_annotations}.json 

this script ... source code here https://github.com/wkentaro/labelme/blob/master/labelme/cli/json_to_dataset.py

which generates 4 files

  1. img.png
  2. label.png
  3. label_viz.png
  4. label_names.png

Then, i read the label.png, I realized the masks were encoded in the red channel (which is not recognized by this package) so I had to convert them to grayscale, normalize the value (so the class has a value of 1 and saved the grayscale image as rgb again.

This process gave me images usable for the command line version of this (amazing) package.

Nonetheless, in retrospect ... I feel like the best way to do this would have been to write my own function and use the internal functions that carry out the mask generation.

This function is likely what you want to use after parsing the json: https://github.com/wkentaro/labelme/blob/5b9be06ee1ad75165a4584a9609600e570bcdf5f/labelme/utils/shape.py#L19

I guess the question would be if it would be in the interest of the maintainer @divamgupta to have such function implemented and added to this package ... something that takes as an imput either a coco/labelme json and outputs the masks in a keras-retinanet compatible/expected format.

Kindest wishes, Sebastian

jspaezp avatar Jul 01 '20 00:07 jspaezp

An additional workaround is show here: https://github.com/divamgupta/image-segmentation-keras/issues/117

jspaezp avatar Jul 01 '20 00:07 jspaezp

hi @jspaezp thanks for the response!!. after doing some more research, i came across this https://github.com/wkentaro/labelme/tree/master/examples/semantic_segmentation it seems it supports input as labelme json (gotten after image annotation) and outputs .png masks which am hoping can then be used with your package perhaps. I am happy to create a PR that perhaps potentially supports mask generation.

temi92 avatar Jul 02 '20 12:07 temi92

@temi92 did that work after all?

MikeMpapa avatar Mar 11 '21 16:03 MikeMpapa