环境:
python3.7
PaddlePaddle 1.8.4
用paddlex训练的maskrcnn模型,预测时候报错:
---------------------------------------------------------------------------AttributeError Traceback (most recent call last) in
2 model = pdx.load_model('output/mask_rcnn_r50_fpn/best_model')
3 image_name = 'xiaoduxiong_ins_det/JPEGImages/WechatIMG114.jpeg'
----> 4 result = model.predict(image_name)
5 pdx.det.visualize(image_name, result, threshold=0.5, save_dir='./output/mask_rcnn_r50_fpn')
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/mask_rcnn.py in predict(self, img_file, transforms)
482 self.model_type,
483 self.__class__.__name__,
--> 484 input_channel=input_channel)
485
486 with fluid.scope_guard(self.scope):
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/faster_rcnn.py in _preprocess(images, transforms, model_type, class_name, thread_pool, input_channel)
501 batch_data = list()
502 for image in images:
--> 503 batch_data.append(transforms(image))
504 padding_batch = generate_minibatch(batch_data)
505 im = np.array([data[0] for data in padding_batch])
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/transforms/det_transforms.py in __call__(self, im, im_info, label_info)
147
148 input_channel = getattr(self, 'input_channel', 3)
--> 149 outputs = decode_image(im, im_info, label_info, input_channel)
150 im = outputs[0]
151 im_info = outputs[1]
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/transforms/det_transforms.py in decode_image(im_file, im_info, label_info, input_channel)
122 raise TypeError('Can\'t read The image file {}!'.format(
123 im_file))
--> 124 self.data_type = im.dtype
125 im = im.astype('float32')
126 if input_channel == 3 and self.to_rgb:
AttributeError: 'NoneType' object has no attribute 'dtype'
请问是什么问题,怎么解决?
传入的数据是空的
检查下数据集路径格式先