caffe installation
cd 01.caffe1.0
change Makefile.config (the uploaded Makefile.config file is well configured.)
make all -j 8
make py
yolov5 model training(Anaconda in recommended)
cd 02.yolov5
modify model.yaml
change nn.Upsample to nn.ConvTranspose2d
modify data.yaml
training using script bellow
python train.py --weights path/to/pretrained/yolov5s.pt
--cfg path/to/model.yaml
--data path/to/data.yaml
--imgsz 416
--noautoanchor
detect images using script bellow
python detect.py --weights path/to/model.pt
--source path/to/images
--imgsz 416
convert to onnx model
python export.py --weights path/to/trained/model.pt
--train
--simplify
--opset 10
check the uniformity of pytorch output and onnx output
python onnx_forward.py path/to/onnx/model.onnx path/to/images
caffe model export & detect
cd 03.onnx2caffe
change path settings in convertCaffe.py
python convertCaffe.py path/to/onnx/model.onnx path/to/caffe/model.prototxt path/to/caffe/model.caffemodel
cd 01.caffe1.0
change CAFFE_ROOT/tools/caffe_yolov5s.cpp model settings
make
CAFFE_ROOT/build/tools/caffe_yolov5s path/to/caffe/model.prototxt path/to/caffe/model.caffemodel path/to/images
hisi3559 on board code modification
first change yolov3 postprocess code to yolov5 postprocess code:
then change yolov3 model parameters settings to yolov5 model parameters settings:
change code in func SAMPLE_SVP_NNIE_Yolov3_SoftwareInit