rockchip-linux / rknn-toolkit

BSD 3-Clause "New" or "Revised" License
813 stars 174 forks source link

1.7.1版本 yolov5 onnx转rknn模型出错AttributeError: 'NoneType' object has no attribute 'get_input_layers' #287

Open colinChing opened 2 years ago

colinChing commented 2 years ago

========== parser_config ========== NPU_VERSION:1 RK_device_platform:RK1808 input_example:['/workspace/data/BackgroundIdentification/data_0331_1000/images/train/20210706141643_1_19.jpg'] pre_compile:off config:{'target_platform': 'RK1808', 'quantized_dtype': 'asymmetric_affine-u8', 'quantized_algorithm': 'normal', 'optimization_level': 3, 'mean_values': [[0, 0, 0]], 'std_values': [[255, 255, 255]], 'mmse_epoch': 3, 'do_sparse_network': False, 'output_optimize': 1, 'batch_size': 100, 'quantize_input_node': False, 'inputs_scale_range': None, 'merge_dequant_layer_and_output_node': False, 'force_builtin_perm': False, 'reorder_channel': '0 1 2'} export_rknn:{'export_path': 'model.rknn'} verbose:False verbose_file:None dataset:/workspace/yolov5_test/yolov5/convert/rknn_LHJZ.txt quantize:True build:{'do_quantization': True, 'dataset': '/workspace/yolov5_test/yolov5/convert/rknn_LHJZ.txt'} model_framework:onnx load:{'model': '/workspace/yolov5_test/yolov5/exp_save/bs96_stem_C3SF_ASPP_SE_data0331_hyp0406_loss7/best_cp.onnx'} inputs:{'in_0': {'shape': [3, 640, 640], 'mean_values': [0, 0, 0], 'std_values': [255, 255, 255], 'img_type': 'RGB', 'img_size': [640, 640], 'input_example': '/workspace/data/BackgroundIdentification/data_0331_1000/images/train/20210706141643_1_19.jpg'}} outputs:OrderedDict() RK_device_id:None export_pre_compile_path:model_precompile.rknn

model.rknn is already exists! Do you want to overwrite it? [Y/N] Y or N: Y or N:Y ---> Create RKNN object ---> Seting RKNN config ---> Loading onnx model W Call onnx.optimizer.optimize fail, skip optimize E Calc node Slice : Slice_24 output shape fail E Catch exception when loading onnx model: /workspace/yolov5_test/yolov5/exp_save/bs96_stem_C3SF_ASPP_SE_data0331_hyp0406_loss7/best_cp.onnx! E Traceback (most recent call last): E File "rknn/base/RKNNlib/onnx_ir/onnx_numpy_backend/shape_inference.py", line 65, in rknn.base.RKNNlib.onnx_ir.onnx_numpy_backend.shape_inference.infer_shape E File "rknn/base/RKNNlib/onnx_ir/onnx_numpy_backend/ops/slice.py", line 41, in rknn.base.RKNNlib.onnx_ir.onnx_numpy_backend.ops.slice.Slice E File "", line 1, in E TypeError: slice indices must be integers or None or have an index method E During handling of the above exception, another exception occurred: E Traceback (most recent call last): E File "rknn/base/RKNNlib/app/importer/import_onnx.py", line 118, in rknn.base.RKNNlib.app.importer.import_onnx.Importonnx.run E File "rknn/base/RKNNlib/converter/convert_onnx.py", line 112, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx.init E File "rknn/base/RKNNlib/converter/convert_onnx.py", line 1062, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx._shape_inference E File "rknn/base/RKNNlib/onnx_ir/onnx_numpy_backend/shape_inference.py", line 70, in rknn.base.RKNNlib.onnx_ir.onnx_numpy_backend.shape_inference.infer_shape E File "rknn/api/rknn_log.py", line 323, in rknn.api.rknn_log.RKNNLog.e E ValueError: Calc node Slice : Slice_24 output shape fail E Please feedback the detailed log file to the RKNN Toolkit development team. E You can also check github issues: https://github.com/rockchip-linux/rknn-toolkit/issues ---> Building Traceback (most recent call last): File "../../../../../common/rknn_converter/rknn_convert.py", line 177, in convert(config_dict, args) File "../../../../../common/rknn_converter/rknn_convert.py", line 85, in convert rknn.build(**model_config_dict['build']) File "/root/miniconda3/envs/convert_rknn/lib/python3.6/site-packages/rknn/api/rknn.py", line 262, in build inputs = self.rknn_base.net.get_input_layers() AttributeError: 'NoneType' object has no attribute 'get_input_layers'

zen-xingle commented 2 years ago

For yolo model, please refer here. https://github.com/airockchip/rknn_model_zoo/tree/main/models/vision/object_detection/

duyanfang123 commented 1 year ago

请问你的问题解决了吗

thangphung215 commented 1 year ago

For yolo model, please refer here. https://github.com/airockchip/rknn_model_zoo/tree/main/models/vision/object_detection/

watching that tutorial and get the same error, just a loop

jhsno1 commented 10 months ago

压根就是个半成品,什么问题都不解决