Skip to content

使用export.py导出的mindir无法在mslite_predict.py上运行 #451

@MyronXie

Description

@MyronXie

使用香橙派AIpro20T,mindyolo==0.5.0,mindspore==2.4.10,mindspore-lite==2.4.10

使用export.py导出的mindir无法在mslite_predict.py上运行

(base) HwHiAiUser@orangepiaipro-20t:~/mindyolo$ python deploy/export.py --config ./configs/yolov7/yolov7.yaml --weight ./yolov7_300e_mAP508-734ac919.ckpt --file_format MINDIR --device_target Ascend
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:549: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:549: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
2025-08-21 16:29:45,072 [WARNING] Parse Model, args: nearest, keep str type
2025-08-21 16:29:45,318 [WARNING] Parse Model, args: nearest, keep str type
2025-08-21 16:29:46,960 [INFO] number of network params, total: 37.672465M, trainable: 37.622682M
[WARNING] ME(31617:255085889290272,MainProcess):2025-08-21-16:30:02.337.260 [mindspore/train/serialization.py:1809] For 'load_param_into_net', remove parameter prefix name: ema., continue to load.
2025-08-21 16:30:02,369 [INFO] Load checkpoint from [./yolov7_300e_mAP508-734ac919.ckpt] success.
2025-08-21 16:30:27,050 [INFO] Export completed.

(base) HwHiAiUser@orangepiaipro-20t:~/mindyolo$ python deploy/mslite_predict.py --mindir_path yolov7.mindir --config ./configs/yolov7/yolov7.yaml --image_path ./88qNBT3ZPX.jpg               /home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:549: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:549: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
2025-08-21 16:30:52,739 [INFO] mslite model init...
[WARNING] GE_ADPT(32627,e7ffc3192020,python):2025-08-21-16:30:55.224.453 [mindspore/ccsrc/transform/graph_ir/transform_util.cc:185] GetGeTensorDesc] undefined data type :14
[WARNING] GE_ADPT(32627,e7ffc3192020,python):2025-08-21-16:30:55.224.506 [mindspore/ccsrc/transform/graph_ir/op_adapter.cc:646] UpdateMultiOutputDesc] Create op: Default/Return-op0 output descriptor failed!
.[ERROR] ME(32627,e7ffc3192020,python):2025-08-21-16:32:39.961.289 [mindspore/lite/src/extendrt/kernel/ascend/model/model_process.cc:819] Resize] Not support dynamic input
[ERROR] ME(32627,e7ffc3192020,python):2025-08-21-16:32:39.961.351 [mindspore/lite/src/extendrt/kernel/ascend/src/custom_ascend_kernel.cc:254] OnNewInputShapes] Failed to Resize
[ERROR] ME(32627,e7ffc3192020,python):2025-08-21-16:32:39.961.369 [mindspore/lite/src/extendrt/kernel/ascend/src/custom_ascend_kernel.cc:200] Resize] Failed to resize inputs
[ERROR] ME(32627,e7ffc3192020,python):2025-08-21-16:32:39.961.385 [mindspore/lite/src/extendrt/session/single_op_session.cc:571] OnNewInputShapes] Failed to resize custom ascend kernel
Traceback (most recent call last):
  File "/home/HwHiAiUser/mindyolo/deploy/mslite_predict.py", line 190, in <module>
    infer(args)
  File "/home/HwHiAiUser/mindyolo/deploy/mslite_predict.py", line 170, in infer
    result_dict = detect(
  File "/home/HwHiAiUser/mindyolo/deploy/mslite_predict.py", line 101, in detect
    model.resize(inputs,[list(img.shape)])
  File "/home/HwHiAiUser/.local/lib/python3.9/site-packages/mindspore_lite/model.py", line 493, in resize
    super(Model, self).resize(inputs, dims)
  File "/home/HwHiAiUser/.local/lib/python3.9/site-packages/mindspore_lite/base_model.py", line 153, in resize
    raise RuntimeError(f"resize failed! Error is {ret.ToString()}")
RuntimeError: resize failed! Error is Common error code.

但是官方提供的mindir可以正常运行

(base) HwHiAiUser@orangepiaipro-20t:~/mindyolo$ python deploy/mslite_predict.py --mindir_path yolov7_300e_mAP508-734ac919-6d65d27c.mindir --config ./configs/yolov7/yolov7.yaml --image_path ./88qNBT3ZPX.jpg
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:549: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:549: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/HwHiAiUser/.local/lib/python3.9/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
2025-08-21 16:23:09,135 [INFO] mslite model init...
[WARNING] GE_ADPT(28828,e7ffe5e1d020,python):2025-08-21-16:23:11.548.220 [mindspore/ccsrc/transform/graph_ir/transform_util.cc:185] GetGeTensorDesc] undefined data type :14
[WARNING] GE_ADPT(28828,e7ffe5e1d020,python):2025-08-21-16:23:11.548.275 [mindspore/ccsrc/transform/graph_ir/op_adapter.cc:646] UpdateMultiOutputDesc] Create op: Default/Return-op0 output descriptor failed!
.2025-08-21 16:24:18,871 [INFO] perform nms...
2025-08-21 16:24:18,873 [INFO] Predict result is: {'category_id': [17, 18], 'bbox': [[0.781, 228.844, 346.25, 452.812], [309.688, 49.469, 490.312, 627.812]], 'score': [0.94829, 0.82553]}
2025-08-21 16:24:18,874 [INFO] Speed: 69736.3/1.4/69737.7 ms inference/NMS/total per 640x640 image at batch-size 1;
2025-08-21 16:24:18,874 [INFO] Detect a image success.
2025-08-21 16:24:18,939 [INFO] predict completed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions