I have a modified yolov7 model with additional output layer (a classification output). when translating onnx, i have added 4 conv layers as output nodes (3 for yolo detection, 1 for classification). I wanted to add nms for the 3 layers in optimization step, and leave the other layer as is. was able to add nms_postprocess in the script. But during the optimize process, it stops with error
[warning] output_layers_order in net_params don't match actual output layers in HN. InvalidHNError: There are multiple outputs found in the HN, but only one layer in output_layers_order.
here is the parsing part:
start_node =[âimagesâ]
end_nodes = [â/model.77/detect_head/m.0/Convâ,â/model.77/detect_head/m.1/Convâ,â/model.77/detect_head/m.2/Convâ,â550â]
runner = ClientRunner(hw_arch=âhailo8â)
hn, npz = runner.translate_onnx_model(model=yolo_onnx_model_path,
net_name=yolo_model_name,
start_node_names=start_node,
end_node_names=end_nodes,
net_input_shapes={âimagesâ:[4, 3, 512,512]})
this is the model script and optimization:
alls_lines_yolo= [
'normalization1 = normalization([0.0, 0.0, 0.0], [255.0, 255.0, 255.0])\n',
'nms_postprocess("nms_config_yolov7.json",meta_arch=yolov5)\n',
'model_optimization_config(calibration, batch_size=4, calibset_size=30)\n',
]
open('yolo_script.alls','w').writelines(alls_lines_yolo)
runner.load_model_script('yolo_script.alls')
runner.optimize_full_precision(calib_set)