Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package rasing a Type error #12

Open
dauntless23 opened this issue Sep 27, 2023 · 2 comments · May be fixed by #21
Open

Package rasing a Type error #12

dauntless23 opened this issue Sep 27, 2023 · 2 comments · May be fixed by #21

Comments

@dauntless23
Copy link

Converting 0006.json for train ...
Traceback (most recent call last):
File "C:\Users\Administrator\Downloads\Compressed\Labelme2YOLO-main\Labelme2YOLO-main\labelme2yolo.py", line 228, in
convertor.convert(val_size=args.val_size)
File "C:\Users\Administrator\Downloads\Compressed\Labelme2YOLO-main\Labelme2YOLO-main\labelme2yolo.py", line 97, in convert
img_path = self._save_yolo_image(json_data,
File "C:\Users\Administrator\Downloads\Compressed\Labelme2YOLO-main\Labelme2YOLO-main\labelme2yolo.py", line 194, in _save_yolo_image
img = utils.img_b64_to_arr(json_data['imageData'])
File "C:\ProgramData\anaconda3\lib\site-packages\labelme\utils\image.py", line 24, in img_b64_to_arr
img_data = base64.b64decode(img_b64)
File "C:\ProgramData\anaconda3\lib\base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "C:\ProgramData\anaconda3\lib\base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'

@rooneysh
Copy link
Owner

rooneysh commented Oct 7, 2023

That's because your Labelme json format is not bytes, check if your Labelme version is match the requirements. Since this 'utils.img_b64_to_arr' code is provided by Labelme.

wzm2256 added a commit to wzm2256/Labelme2YOLO that referenced this issue Feb 5, 2024
Simply copy and paste 3 related function in labelme into this file. Now support all labelme versions, thus it closes rooneysh#12
@wzm2256 wzm2256 linked a pull request Feb 5, 2024 that will close this issue
@wzm2256
Copy link

wzm2256 commented Feb 5, 2024

Hi, if you are still working on this. A solution is here https://github.com/wzm2256/Labelme2YOLO/tree/wzm2256-patch-1
I removed the labelme dependency, and now it should work with all labelme versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants