pylabel-project / pylabel

Python library for computer vision labeling tasks. The core functionality is to translate bounding box annotations between different formats-for example, from coco to yolo.
MIT License
317 stars 57 forks source link

"No objects to concatenate" conversion yolo to coco #57

Closed 88ili88 closed 2 years ago

88ili88 commented 2 years ago

I'm doing a yolo 2 coco conversion with yaml, everything works just fine until I do dataset.export.ExportToCoco(cat_id_index=0) i tried with cat_id_index=1 as well. The full error is as it follows: Traceback (most recent call last): File "/home/usuaris/imatge/ilias.khayat/TFG/yolo22coco.py", line 45, in <module> dataset.export.ExportToCoco(cat_id_index=1) File "/home/usuaris/imatge/ilias.khayat/TFG/pylabel/pylabel/exporter.py", line 744, in ExportToCoco mergedI = pd.concat(df_outputI, ignore_index=True) File "/home/usuaris/imatge/ilias.khayat/venv/detectron2-/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper return func(*args, **kwargs) File "/home/usuaris/imatge/ilias.khayat/venv/detectron2-/lib/python3.9/site-packages/pandas/core/reshape/concat.py", line 347, in concat op = _Concatenator( File "/home/usuaris/imatge/ilias.khayat/venv/detectron2-/lib/python3.9/site-packages/pandas/core/reshape/concat.py", line 404, in __init__ raise ValueError("No objects to concatenate") ValueError: No objects to concatenate srun: error: gpic10: task 0: Exited with exit code 1 I'd appreciate any suggestions. `

alexheat commented 2 years ago

Hi thanks for reporting this @88ili88 . Can you share your dataset so I can try and repro this?

88ili88 commented 2 years ago

Sure thing, thanks for the fast response, I shared the dataset with drive, you should receive a mail.

alexheat commented 2 years ago

Thank you. I got the files and I will take a look.

alexheat commented 2 years ago

Hi @88ili88 can you also provide the code that you used to import the yolo files?

I think there is a bug in the package so you are not doing anything wrong. I just want to repo your dataset.

88ili88 commented 2 years ago

just sent it to your mail

88ili88 commented 2 years ago

tempsnip this is the tree

alexheat commented 2 years ago

Thank you. I think I found how to fix the issue. I will post an un update soon. Probably this weekend

alexheat commented 2 years ago

@88ili88 I release v0.1.40 of the package that should resolve your issue, can you give it a try?

Note that it will put both your train and val datasets into the same coco output file--as one big, merged dataset.

88ili88 commented 2 years ago

Hey sorry for the delay, I updated pylabel and compiled yolo22coco.py and now I get this error, I'm not sure where is coming from. image

alexheat commented 2 years ago

@88ili88 , if you remove the "path_to_annotations" value it should work. This worked for me:

dataset = importer.ImportYoloV5WithYaml(yaml_file="database/roadsigns/roadsigns.yaml",
        image_ext='png,jpg,bmp',
        name_of_annotations_folder="labels")

I think I should remove that path_to_annotations param, I can't think of how it should be used because the path is specified in the YAML file.

88ili88 commented 2 years ago

I just fixed it.

88ili88 commented 2 years ago

Thanks!