TL;DR
-Original data learning procedure using Keras version implementation of YOLO v3 (as of June 24, 2020) HDF5 format (* .h5) created How to convert to ONNX format
axinc-ai/yolov3-face onnx/keras-onnx
Sometimes the converted onnx file could not be inferred. It can be inferred from the onnx file that was originally prepared.
The detailed conditions have not yet been identified.
Clone with git from axinc-ai / yolov3-face
git clone https://github.com/axinc-ai/yolov3-face.git
Next, clone keras-yolo3 linked in yolov3-face.
cd .\yolov3-face
git clone https://github.com/qqwweee/keras-yolo3.git
Create a virtual environment "yolov3-face" with conda
conda create -n yolov3-face python=3.6 -y
Install the required modules. Since the detailed version is specified in axinc-ai / yolov3-face and it is not prepared in the conda repository, install it with pip.
conda activate yolov3-face
pip install tensorflow==1.13.2
pip install keras==2.2.4
pip install keras2onnx==1.5.1
pip install opencv-python
pip install pillow
pip install matplotlib
Create virtual environment "yolov 3-face-inference" with conda
conda create -n yolov3-face-inference python=3.6 -y
Install the required modules. Since the detailed version is specified in axinc-ai / yolov3-face and it is not prepared in the conda repository, install it with pip.
conda activate yolov3-face-inference
pip install tensorflow==1.13.2
pip install onnxruntime
pip install keras==2.2.4
pip install pillow
First, verify with the prepared sample
** Format **
python keras-yolo3-to-onnx.py <h5-model-filepath> <classes-filepath> <anchors-filepath> <onnx-filepath>
Parameters | Contents to be specified |
---|---|
h5-model-filepath | Model file created with keras |
classes-filepath | A file that describes the class name used when creating the model |
anchors-filepath | Anchor file used when creating the model |
onnx-filepath | Converted ONNX file |
** Run **
cd .\keras-onnx
conda activate yolov3-face
python keras-yolo3-to-onnx.py ../model_data/logs/trained_weights_final.h5 ../model_data/face_classes.txt ../model_data/tiny_yolo_anchors.txt ../model_data/ax_face.onnx
** Format **
python inference.py <onnx-filepath> <classes-filepath> <targetimage-filepath> <outputimage-filepath>
Parameters | Contents to be specified |
---|---|
onnx-filepath | Converted ONNX file |
classes-filepath | A file that describes the class name used when creating the model |
inputimage-filepath | Image file to infer |
outputimage-filepath | File drawing the inference result |
** Run **
cd .\keras-onnx
conda activate yolov3-face-inference
python inference.py ../model_data/ax_face.onnx ../model_data/face_classes.txt ../images/couple.jpg output.jpg
File | value |
---|---|
Model file created with keras | ../model_data/yolo_logs/models/Step2_yolo_weight_mAP_best.h5 |
Class file | ../model_data/voc_classes.txt |
Anchor file | ../model_data/yolo_anchors.txt |
Converted ONNX file | ../model_data/ax_yolov3.onnx |
cd .\keras-onnx
conda activate yolov3-face
python keras-yolo3-to-onnx.py ../model_data/yolo_logs/models/Step2_yolo_weight_mAP_best.h5 ../model_data/voc_classes.txt ../model_data/yolo_anchors.txt ../model_data/ax_yolov3.onnx
python inference.py ../model_data/ax_yolov3.onnx ../model_data/voc_classes.txt ../images/couple.jpg output.jpg
keras-yolo3 + JetsonNano
https://qiita.com/rhene/items/b2a8ebe1f003e1107f63 http://mirai-tec.hatenablog.com/entry/2019/08/24/102129 http://mirai-tec.hatenablog.com/entry/2019/09/03/235156
YOLOv3(Darknet) + JetsonNano
https://soralab.space-ichikawa.com/2019/06/jetson-tx2-tensorrt-yolov3/ https://www.nakasha.co.jp/future/ai/vol2_yolov3nvidia_jetson_nano.html
TensorRT + Jetson Nano https://qiita.com/tsutof/items/f81d3900fa77d954ef39
https://medium.com/axinc/yolov3-66c9b998c096
https://qiita.com/agumon/items/114da6921c5dc4f7d7f9 https://github.com/zzh8829/yolov3-tf2 https://qiita.com/plseal/items/f493c67b2e810f2f876e http://mirai-tec.hatenablog.com/entry/2020/01/12/115546 https://rightcode.co.jp/blog/information-technology/tensorflow2-yolov3-run
Recommended Posts