首页 Paddle框架 帖子详情
模型预测时报错
收藏
快速回复
Paddle框架 问答模型训练 511 2
模型预测时报错
收藏
快速回复
Paddle框架 问答模型训练 511 2

环境:

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'

 

请问是什么问题,怎么解决?

0
收藏
回复
全部评论(2)
时间顺序
AIStudio810260
#2 回复于2021-05

传入的数据是空的

0
回复
AIStudio810258
#3 回复于2021-05

检查下数据集路径格式先

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户