PaddlePaddle / PaddleClas

A treasure chest for visual classification and recognition powered by PaddlePaddle
Apache License 2.0
5.42k stars 1.17k forks source link

训练报错:ValueError: (InvalidArgument) The 'shape' attribute in ReshapeOp is invalid. #1622

Closed Enn29 closed 2 years ago

Enn29 commented 2 years ago

欢迎您使用PaddleClas并反馈相关问题,非常感谢您对PaddleClas的贡献! 提出issue时,辛苦您提供以下信息,方便我们快速定位问题并及时有效地解决您的问题:

  1. PaddleClas版本以及PaddlePaddle版本:请您提供您使用的版本号或分支信息,如PaddleClas release/2.2和PaddlePaddle 2.1.0 paddleClas: 2.3 paddle:2.2.0
  2. 涉及的其他产品使用的版本号:如您在使用PaddleClas的同时还在使用其他产品,如PaddleServing、PaddleInference等,请您提供其版本号
  3. 训练环境信息: a. 具体操作系统,如Linux/Windows/MacOS b. Python版本号,如Python3.6/7/8 c. CUDA/cuDNN版本, 如CUDA10.2/cuDNN 7.6.5等 win10, python3.7
  4. 完整的代码(相比于repo中代码,有改动的地方)、详细的错误信息及相关log

报错内容: image 配置文件设置: image

根据报错内容猜测是 tripletlossV2 设置的问题

Enn29 commented 2 years ago

调整使用tripletloss后,报另一个错误: image

Intsigstephon commented 2 years ago

可以提供下是改动了哪一部分代码吗?

Enn29 commented 2 years ago

@Intsigstephon 就改了配置文件,用的自己的数据集 ResNet50_vd.zip 用这个配置文件做识别训练

Enn29 commented 2 years ago

这个会不会和类别的数目有关?类别少就不能加tripletloss

Intsigstephon commented 2 years ago

我看你这个配置文件里面并没有用到tripletloss;从实际使用效果看,triplet收敛比较耗时;如果是针对自己的任务做算法选型的话,推荐使用arcmargin

Enn29 commented 2 years ago

配置文件中没有tripletloss是我删除了,不删的话训练会报上面的错误。 image

image

我想要适配度量学习,所以在原先基础上添加调整了配置文件

Intsigstephon commented 2 years ago

好的,arcmargin就是度量学习的一种,加tripletloss的话是一种组合loss的形式;我们后续先复现下问题,感谢反馈~

paddle-bot-old[bot] commented 2 years ago

Since this issue has not been updated for more than three months, it will be closed, if it is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. It is recommended to pull and try the latest code first. 由于该问题超过三个月未更新,将会被关闭,若问题未解决或有后续问题,请随时重新打开(建议先拉取最新代码进行尝试),我们会继续跟进。

JYC2001 commented 1 year ago

训练waveflow时出现ValueError: (InvalidArgument) The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity of 'shape'. But received X's shape = [6, 16640], X's size = 99840, 'shape' is [6, 0, 16], the capacity of 'shape' is 1597440. [Hint: Expected capacity == in_size, but received capacity:1597440 != in_size:99840.] (at ..\paddle\phi\infermeta\unary.cc:1435)

Yanic0420 commented 1 year ago

训练waveflow时出现ValueError: (InvalidArgument) The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity of 'shape'. But received X's shape = [6, 16640], X's size = 99840, 'shape' is [6, 0, 16], the capacity of 'shape' is 1597440. [Hint: Expected capacity == in_size, but received capacity:1597440 != in_size:99840.] (at ..\paddle\phi\infermeta\unary.cc:1435)

请问解决了吗,如果解决了怎么解决的,我也出现了同样的问题

pcycccccc commented 11 months ago

训练waveflow时出现ValueError: (InvalidArgument) The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity of 'shape'. But received X's shape = [6, 16640], X's size = 99840, 'shape' is [6, 0, 16], the capacity of 'shape' is 1597440. [Hint: Expected capacity == in_size, but received capacity:1597440 != in_size:99840.] (at ..\paddle\phi\infermeta\unary.cc:1435)

请问解决了吗,如果解决了怎么解决的,我也出现了同样的问题

你可以看一下上面报错的信息是什么,可能是在提示你哪里有问题(大概率是配置的时候有问题),我是在模型量化时候遇到这个问题,报错信息是: image 然后突然意识到我之前模型训练的尺寸是416416,但是量化设置的是640640,因为我平时设置尺寸都有设置过这两种,一时之间搞混了,将量化的配置文件里的输入尺寸改成416*416就OK了,没有报错提示了,希望能帮到你!