Open6
DRP-AI 試行
Kakip の 80 TOPS を体感したいので、あえて YOLOv9 の DRP-AI 適合変換にチャレンジするものである。
論文実装の最後の Concat
が DRP-AI に対応していないので、Concat
の手前まででモデルをカットする改造を施す。DRP-AI はチャンネルの軸以外での Concat
に対応していない。ハードウェアアクセラレータアルアル。
sne4onnx \
--input_onnx_file_path yolov9_t_wholebody17_0100_1x3x480x640.onnx \
--input_op_names images \
--output_op_names /model.22/Reshape_output_0 /model.22/Reshape_1_output_0 /model.22/Reshape_2_output_0 \
--output_onnx_file_path yolov9_t_wholebody17_0100_1x3x480x640_cut.onnx
sor4onnx \
--input_onnx_file_path yolov9_t_wholebody17_0100_1x3x480x640_cut.onnx \
--old_new "/model.22/Reshape_output_0" "output_1" \
--mode outputs \
--search_mode prefix_match \
--output_onnx_file_path yolov9_t_wholebody17_0100_1x3x480x640_cut.onnx
sor4onnx \
--input_onnx_file_path yolov9_t_wholebody17_0100_1x3x480x640_cut.onnx \
--old_new "/model.22/Reshape_1_output_0" "output_2" \
--mode outputs \
--search_mode prefix_match \
--output_onnx_file_path yolov9_t_wholebody17_0100_1x3x480x640_cut.onnx
sor4onnx \
--input_onnx_file_path yolov9_t_wholebody17_0100_1x3x480x640_cut.onnx \
--old_new "/model.22/Reshape_2_output_0" "output_3" \
--mode outputs \
--search_mode prefix_match \
--output_onnx_file_path yolov9_t_wholebody17_0100_1x3x480x640_cut.onnx
GroupConvolution
を無効化した tflite を生成
onnx2tf \
-i yolov9_t_wholebody17_0100_1x3x480x640_cut.onnx \
-dgc \
-cotof \
-coion
GroupConvolution
を無効化した tflite から opset=11
の ONNX を逆生成
python -m tf2onnx.convert \
--tflite saved_model/yolov9_t_wholebody17_0100_1x3x480x640_cut_float32.tflite \
--output yolov9_t_wholebody17_0100_1x3x480x640_dgc.onnx \
--opset 11 \
--inputs-as-nchw images
onnxsim yolov9_t_wholebody17_0100_1x3x480x640_dgc.onnx yolov9_t_wholebody17_0100_1x3x480x640_dgc.onnx
はい。ツムツム。
Gather
64個、Unsqueeze
64個、Concat
5個 に展開すれば突破可能なはず。