The error occurs when I tried to open previous dataset with labelme:
Error opening file,
a bytes-like object is required,not 'NoneType'
I notice that the following code of labelme links the parent directory path of the json file and the imagePath in the json file to get the relative path from the json file to the image, and load the image:
if data["imageData"] is not None:
imageData = base64.b64decode(data["imageData"])
if PY2 and QT4:
imageData = utils.img_data_to_png_data(imageData)
else:
# relative path from label file to relative path from cwd
imagePath = osp.join(osp.dirname(filename), data["imagePath"])
imageData = self.load_image_file(imagePath)
Because datasets are actually often moved in many scenarios, imagePath in json files is out of date most of the time. I think this is the cause of the above error. Under the current image loading strategy, if you split the dataset, you will no longer be able to open it normally with labelme.
In another data annotation tool, labelImg, you can open a dataset whose directory structure has changed, as long as you open the image directory and label directory in ui, can this be achieved in labelme?
Expected Behavior
By specifying the path to the image and the path to the json label file in the ui interface or on the command line, open a dataset whose directory structure is already different from that of the annotation to view the annotation.
To Reproduce
This error occurs when you try to use labelme to open any dataset whose directory structure has changed.
Provide environment information
/home/tty0016/software/miniconda3/bin/python Python 3.10.12 labelme 5.2.1
What OS are you using?
Ubuntu 20.04.4
Describe the Bug
The error occurs when I tried to open previous dataset with labelme:
I notice that the following code of labelme links the parent directory path of the json file and the imagePath in the json file to get the relative path from the json file to the image, and load the image:
Because datasets are actually often moved in many scenarios, imagePath in json files is out of date most of the time. I think this is the cause of the above error. Under the current image loading strategy, if you split the dataset, you will no longer be able to open it normally with labelme.
In another data annotation tool, labelImg, you can open a dataset whose directory structure has changed, as long as you open the image directory and label directory in ui, can this be achieved in labelme?
Expected Behavior
By specifying the path to the image and the path to the json label file in the ui interface or on the command line, open a dataset whose directory structure is already different from that of the annotation to view the annotation.
To Reproduce
This error occurs when you try to use labelme to open any dataset whose directory structure has changed.