This document describes the procedure for translating YOLOX with DRP-AI Translator v1.80 or later.
Please note the following:
Please run the following command to download the ONNX in Megvii-BaseDetection
$ wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.onnx
...
Please edit the following in an editor such as vim, and save it as yolox_s_cut.py.
$ vim yolox_s_cut.py
# yolox_s_cut.py
import onnx
input_path = 'yolox_s.onnx'
output_path = 'yolox_s_wo_post.onnx'
input_names = ['images']
output_names = ['798', '824', '850']
onnx.utils.extract_model(input_path, output_path, input_names, output_names)
As shown in the figure below, please find and specify the output name of Concat before Reshape
Image AddedPlease run yolox_s_cut.py with the following command. If executed successfully, yolox_s_wo_post.onnx will be generated.
$ python3 yolox_s_cut.py
The above output names, 798, 824, and 850, are for YOLOX-s. Please note that different names must be specified for other
YOLOX (e.g. YOLOX-m). As shown in the figure below, please find and specify the output name of Concat before Reshape
of the three outputs of YOLOX.
Please run DRP-AI Translator using the generated yolox_s_wo_post.onnx. DRP-AI Translator must be v1.80 or later. For
information on how to run DRP-AI Translator, please refer to the User's Manual.
The post-processing (Reshape > Concat > Transpose) that is cut this time is the processing that concatinates the data of
three CHW shapes and converts them to HWC shapes.
DRP-AI outputs data in HWC shape by default, so if the three output data are stored in consecutive memory areas, the
same sequence of data as after post-processing is obtained in terms of memory layout.
...
Image Added
Table of Contents |
---|