samples icon indicating copy to clipboard operation
samples copied to clipboard

KeyError: 'images' when executing coco2yolov5

Open TortoiseFather opened this issue 1 year ago • 0 comments

Following the instructions on the collab notebook on a simplified version of the following dataset https://www.wilddash.cc/railsem19 containing a single image and cocojson file I get the error 'KeyError: 'images''

My files are structured as follows: PyProject > Babyrs19 > rs00001.json / rs00001.jpg

My code is as follows:

rom pylabel import importer
path_to_annotations = 'Babyrs19/rs00001.json'
path_to_images = ''
dataset = importer.ImportCoco(path_to_annotations, path_to_images=path_to_images, name="BCCD_coco")
dataset.df.head(5)

My full error is as follows

Traceback (most recent call last):
  File "D:\Work\PyProject\main.py", line 9, in <module>
    dataset = importer.ImportCoco(path_to_annotations, path_to_images=path_to_images, name="BCCD_coco")
  File "D:\Work\PyProject\venv\lib\site-packages\pylabel\importer.py", line 61, in ImportCoco
    images = pd.json_normalize(annotations_json["images"])
KeyError: 'images'

I have tried referencing the whole folder within path_to_annotations, I have tried referencing the image within path_to_images, I have tried with multiple images, I cannot get anything to work. Please help.

TortoiseFather avatar Oct 02 '23 15:10 TortoiseFather