ayoolaolafenwa / PixelLib

Visit PixelLib's official documentation https://pixellib.readthedocs.io/en/latest/
MIT License
1.04k stars 267 forks source link

Error in coco dataset conversion: labelme2coco updated #121

Open ZL92 opened 2 years ago

ZL92 commented 2 years ago

Hello,

The labelme2coco just got updated to v0.2.0. Consequently, the load_dataset() in custom training has an error.

Thanks for your effort in solving it in advance!

vmshirey commented 2 years ago

Hi, just coming here to bump this issue as well. Many thanks for your attention to this problem!

Sandell0 commented 2 years ago

I've looked into it and there are at least two things that changed.

First, labelme2coco.convert now creates "dataset.json" file as output so code in "custom_train/init.py" would have to be changed from: save_json_path1 = os.path.abspath(os.path.join(dataset, "train.json")) self.dataset_train.load_data(save_json_path1, labelme_folder1)

to: save_json_path1 = os.path.abspath(os.path.join(dataset, "coco/train")) self.dataset_train.load_data(os.path.join(save_json_path1, "dataset.json"), labelme_folder1)

Second, labelme2coco now uses zero indexing for coco categories whereas here it is not allowed: print('Error: Class id for "{}" cannot be less than one. (0 is reserved for the background)'.format(class_name))

Most likely there is more, this is just what I've found during a quick search. I don't think that it can be resolved without attention from @ayoolaolafenwa.

ZL92 commented 2 years ago

Hi all,

A solution that works for me: install the previous version of labelme2coco.

!pip3 install pixellib --upgrade
!pip3 install labelme2coco==v0.1.2

Hope this would help!

Kampmarsvin commented 2 years ago

Hi all,

A solution that works for me: install the previous version of labelme2coco.

!pip3 install pixellib --upgrade
!pip3 install labelme2coco==v0.1.2

Hope this would help!

I tried the solution. But unfortunately no luck.

greg007-web commented 2 years ago

The new version didn't work. I had the same problem. Try this setting:

!pip3 install tensorflow==2.4.1
!pip3 install tensorflow--gpu
!pip3 install imgaug
!pip install pixellib --upgrade
!pip install labelme2coco==0.1.2

I used an old version and now is working.

darlannakamura commented 2 years ago

Worked for me.