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

在自己制作的数据集上训练时,出现AttributeError: 'NoneType' object has no attribute 'shape' #18

Open
1995gatch opened this issue Aug 3, 2020 · 2 comments

Comments

@1995gatch
Copy link

您好,我是一名研究生,最近在复现yolo模型,在使用您的代码仓运行时,之前都很顺利,但是在train时却遇到了:Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call
return fn(*args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn
target_list, run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
(0) Unknown: {{function_node _inference_Dataset_map_136}} AttributeError: 'NoneType' object has no attribute 'shape'
Traceback (most recent call last):

File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/script_ops.py", line 235, in call
ret = func(*args)

File "/home/mist/8_3_YOLOv3_tensorflow/utils/data_utils.py", line 215, in get_batch_data
img_idx, img, y_true_13, y_true_26, y_true_52 = parse_data(line, class_num, img_size, anchors, mode, letterbox_resize)

File "/home/mist/8_3_YOLOv3_tensorflow/utils/data_utils.py", line 168, in parse_data
img, boxes = resize_with_bbox(img, boxes, img_size[0], img_size[1], interp=1, letterbox=letterbox_resize)

File "/home/mist/8_3_YOLOv3_tensorflow/utils/data_aug.py", line 302, in resize_with_bbox
image_padded, resize_ratio, dw, dh = letterbox_resize(img, new_width, new_height, interp)

File "/home/mist/8_3_YOLOv3_tensorflow/utils/data_aug.py", line 278, in letterbox_resize
ori_height, ori_width = img.shape[:2]

AttributeError: 'NoneType' object has no attribute 'shape'

我的trian.txt; test.txt; val.txt均保存在./data/my_data_label中,其中一行的路径为:
image
这个问题困扰了我两天了还有解决,谢谢您宝贵的时间,希望您能帮助我解决这个问题,谢谢~

@fuqiangleon
Copy link

@1995gatch hi ,请问您的demo 能运行起来吗?

@zhoudelong
Copy link

出这个错很有可能是你的训练图片路径带有中文名, CV2读取的时候回报这个错

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

No branches or pull requests

3 participants