DataXujing / YOLO-V3-Tensorflow

:construction_worker: :construction_worker::construction_worker: YOLO V3(Tensorflow 1.x) 安全帽 识别 | 提供数据集下载和与预训练模型
222 stars 79 forks source link

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

Open 1995gatch opened 4 years ago

1995gatch commented 4 years ago

您好,我是一名研究生,最近在复现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_Datasetmap_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 commented 4 years ago

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

zhoudelong commented 3 years ago

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