首页 Paddle框架 帖子详情
Paddle运行错误
收藏
快速回复
Paddle框架 问答模型训练 830 3
Paddle运行错误
收藏
快速回复
Paddle框架 问答模型训练 830 3

File "D:\Program Files\Python37\lib\site-packages\paddlex\cv\models\classifier.py", line 309, in _preprocess
batch_data.append(transforms(image))
File "D:\Program Files\Python37\lib\site-packages\paddlex\cv\transforms\cls_transforms.py", line 89, in __call__
self.data_type = im.dtype
UnboundLocalError: local variable 'im' referenced before assignment

 

以上是错误,麻烦帮忙解决一下

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

cls_transforms.py的__call函数__少了一行代码,当输入是numpy数据时,没有进行局部变量im赋值

 
0
回复
c
chcorophyll
#3 回复于2021-05
        if isinstance(im_file, np.ndarray):
            if len(im_file.shape) != 3:
                raise Exception(
                    "im should be 3-dimension, but now is {}-dimensions".
                    format(len(im_file.shape)))
            im = im_file
0
回复
wanghrobin
#4 回复于2021-05

太好了,终于有人答上这个问题了。已经困扰了好几天,查了好几个通宵就看不懂为啥出错

 

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