在运行“PaddleX快速上手-MobileNetV2图像分类 - 基于PaddleX的10分钟快速上手,对蔬菜数据集进行MobileNetV2分类。”时的出错信息。用AI studio在线运行时成功了。后来在本地设置了GPU环境并安装paddleX后再次尝试就会失败。已经把蔬菜图片数据集和MobileNetV2-pretrain从AI studio下载到本地。
D:\Robin\Anaconda3\envs\paddle_env\lib\site-packages\paddle\fluid\layers\utils.py:26: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
def convert_to_list(value, n, name, dtype=np.int):
[WARNING] pycocotools is not installed, detection model is not available now.
[WARNING] pycocotools install: https://paddlex.readthedocs.io/zh_CN/develop/install.html#pycocotools
D:\Robin\Anaconda3\envs\paddle_env\lib\site-packages\paddle2onnx\onnx_helper\mapping.py:42: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
int(TensorProto.STRING): np.dtype(np.object)
D:\Robin\Anaconda3\envs\paddle_env\lib\site-packages\paddle2onnx\constant\dtypes.py:43: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
np.bool: core.VarDesc.VarType.BOOL,
D:\Robin\Anaconda3\envs\paddle_env\lib\site-packages\paddle2onnx\constant\dtypes.py:44: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
core.VarDesc.VarType.FP32: np.float,
D:\Robin\Anaconda3\envs\paddle_env\lib\site-packages\paddle2onnx\constant\dtypes.py:49: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
core.VarDesc.VarType.BOOL: np.bool
2021-05-03 17:43:45 [INFO] Starting to read file list from dataset...
2021-05-03 17:43:45 [INFO] 840 samples in file D:\Education\Projects\vegetable_cls\vegetables_cls.tar\vegetables_cls\train_list.txt
2021-05-03 17:43:45 [INFO] Starting to read file list from dataset...
2021-05-03 17:43:46 [INFO] 240 samples in file D:\Education\Projects\vegetable_cls\vegetables_cls.tar\vegetables_cls/val_list.txt
D:\Robin\Anaconda3\envs\paddle_env\lib\site-packages\paddle\fluid\framework.py:687: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
elif dtype == np.bool:
2021-05-03 17:43:51 [INFO] Connecting PaddleHub server to get pretrain weights...
W0503 17:43:51.461038 9652 device_context.cc:362] Please NOTE: device: 0, GPU Compute Capability: 5.0, Driver API Version: 10.2, Runtime API Version: 10.2
W0503 17:43:51.481093 9652 device_context.cc:372] device: 0, cuDNN Version: 7.6.
2021-05-03 17:43:54 [INFO] Load pretrain weights from output/mobilenetv2\pretrain\MobileNetV2_x1.0.
Traceback (most recent call last):
File "main.py", line 32, in <module>
model.train(num_epochs=10,
File "D:\Robin\Anaconda3\envs\paddle_env\lib\site-packages\paddlex\cv\models\classifier.py", line 197, in train
self.net_initialize(
File "D:\Robin\Anaconda3\envs\paddle_env\lib\site-packages\paddlex\cv\models\base.py", line 253, in net_initialize
paddlex.utils.utils.load_pretrain_weights(
File "D:\Robin\Anaconda3\envs\paddle_env\lib\site-packages\paddlex\utils\utils.py", line 258, in load_pretrain_weights
raise Exception("File {} is not a paddle parameter file".format(
Exception: File output/mobilenetv2\pretrain\MobileNetV2_x1.0 is not a paddle parameter file
你翻译一下 output/mobilenetv2\pretrain\MobileNetV2_x1.0 is not a paddle parameter file这个异常就知道了
又跑了一次AI studio上的例程。注意到这一段:开始训练时把Output/mobilenetv2/pretrain/下面的tar格式的模型文件解压了一遍。看来应该把下载下来的mobilenetv2_pretrained.tar直接放到项目文件的指定目录里面,而不是自己解压后copy目录。晚上再试试。
再看了文档,没有设置pretrain weight的时候,会自己下载pretrain model来。所以看起来是下载下来的model weight没有被认出是有效参数
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632
非常感谢您使用有问必答服务,为了后续更快速的帮您解决问题,现诚邀您参与有问必答体验反馈。您的建议将会运用到我们的产品优化中,希望能得到您的支持与协助!
速戳参与调研>>>https://t.csdnimg.cn/Kf0y