PaddleSeg
PaddleSeg copied to clipboard
use tools/labelme2seg get error: tuple index out of range
Use labelme make the json annotation and save the json file in the same directory with the JPEG file, then use the run labelme2seg.py file, want to get the png for training, but got a error: tuple index out of range! detail info see below:
Saved class_names: Test/test_json/class_names.txt
Generating dataset from: Test/test_json/AEYTp.json
Traceback (most recent call last):
File "tools/labelme2seg.py", line 125, in
main(args)
File "tools/labelme2seg.py", line 86, in main
class_name_mapping=class_name_to_id,
File "tools/labelme2seg.py", line 118, in shape2label
label_mask = shape2mask(img_size[:2], points)
File "tools/labelme2seg.py", line 103, in shape2mask
label_mask = PIL.Image.fromarray(np.zeros(img_size[:2], dtype=np.uint8))
File "/home/adc/anaconda3/envs/paddle2/lib/python3.7/site-packages/PIL/Image.py", line 2842, in fromarray
size = 1 if ndim == 1 else shape[1], shape[0]
IndexError: tuple index out of range
Please check!
您好,您的图片要使用三通道的图片,请您在这个地方的前一行打印下img_size,看看是不是个三维的list
您好,在函数的80行和81行可以看到,图片的读取使用的是标注json中的目录,如果你移动了json的位置,可能会导致读取不到图片,导致你出现的img size为空的现象, 这是我的修改 img_file = osp.join(args.input_dir, base + '.bmp') img = np.asarray(PIL.Image.open(img_file)) 我是用的bmp 图片 希望你的问题可以解决
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.