labelme
labelme copied to clipboard
[BUG] Error opening file : a bytes-like obeject is required, not 'NoneType'
Describe the bug I got this bug when I want to reload the images and labels in my PC. I labeled all the data yesterday, and splite the images files into 3 directories. And after I want to reopen the images and labels dir, I got this error.
Expected behavior After lading the images dir, load the label file automatically, to see the results.
Screenshots See Below.
Desktop (please complete the following information):
- OS: Windows 10 pro
- Labelme Version [e.g. 4.5.6]
images fold divided like this:
erro image:
I got the same error for the image files I annotated a while ago.I was going to fix something on annotations but I can't open them. I generated new annotations to check the output json file content but the contents of the old and new json files are almost exactly the same except the version number in the beginning of the json file, which I believe it should not affect anything. The rest is the same.
Hi there, I am facing the same issue.
Directories are:
- dataset/imgs/*.png
- dataset/labels/*.json
I open the image folder and tell labelme to use the labels folder as output folder. I seems that labelme list images and match associated annotation files properly (boxes are checked in the File List pannel). Maybee the problem is in the "open/read files" part.
I get the same error, when I want to see the previously labelled image. Any known fixes ?
I can see a '\' character in the filepath. That isn't an allowed character in Windows as far as I understand
is this still not fixed? I got same error.
The imageData is null
cause the error, which should not have happened in the first place and easy to fix considering the "File List" panel use shows the image not the json
Along with the actual image isn't the same as imagePath
. Which again shouldn't be any problem since the image is there in the "File List".
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)
if imageData is null, imagePath must be a path relative to json file..... this is not a good design I think....
if ImagePath begins with a / (it's an absolute path) then os.path.join will return the original imagePath Fixed with https://github.com/wkentaro/labelme/pull/1035
Note this only solves the problem where:
- annotations and images are in the same directory and the path to the image is an absolute path.
I dont think the imagePath in json file is very much important, because the dataset may move around....
Hi, I have the same error after changing path and name of the images and labels, how can I figure it out please ?
Maybe "imagePath" is wrong. I convert bmp image to jpg, and forgot to modify imagePath. Everthing is ok when the "imagePath" is modified to ".jpg".