Skip to content

Commit

Permalink
Merge pull request #444 from PINTO0309/YOLOv9-shoulder-elbow-knee
Browse files Browse the repository at this point in the history
YOLOv9 shoulder elbow knee
  • Loading branch information
PINTO0309 authored Jan 18, 2025
2 parents 5f8f4d5 + 51cf5e7 commit 30ad1a9
Show file tree
Hide file tree
Showing 29 changed files with 5,650 additions and 0 deletions.
674 changes: 674 additions & 0 deletions 463_YOLOv9-Shoulder-Elbow-Knee/LICENSE

Large diffs are not rendered by default.

320 changes: 320 additions & 0 deletions 463_YOLOv9-Shoulder-Elbow-Knee/README.md

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions 463_YOLOv9-Shoulder-Elbow-Knee/download_c.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

curl "https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/463_YOLOv9-Shoulder-Elbow-Knee/resources_c.tar.gz" -o resources.tar.gz
tar -zxvf resources.tar.gz
rm resources.tar.gz

echo Download finished.
7 changes: 7 additions & 0 deletions 463_YOLOv9-Shoulder-Elbow-Knee/download_e_nopost.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

curl "https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/463_YOLOv9-Shoulder-Elbow-Knee/resources_e_nopost.tar.gz" -o resources.tar.gz
tar -zxvf resources.tar.gz
rm resources.tar.gz

echo Download finished.
7 changes: 7 additions & 0 deletions 463_YOLOv9-Shoulder-Elbow-Knee/download_e_withpost.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

curl "https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/463_YOLOv9-Shoulder-Elbow-Knee/resources_e_withpost.tar.gz" -o resources.tar.gz
tar -zxvf resources.tar.gz
rm resources.tar.gz

echo Download finished.
7 changes: 7 additions & 0 deletions 463_YOLOv9-Shoulder-Elbow-Knee/download_s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

curl "https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/463_YOLOv9-Shoulder-Elbow-Knee/resources_s.tar.gz" -o resources.tar.gz
tar -zxvf resources.tar.gz
rm resources.tar.gz

echo Download finished.
7 changes: 7 additions & 0 deletions 463_YOLOv9-Shoulder-Elbow-Knee/download_t.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

curl "https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/463_YOLOv9-Shoulder-Elbow-Knee/resources_t.tar.gz" -o resources.tar.gz
tar -zxvf resources.tar.gz
rm resources.tar.gz

echo Download finished.
6 changes: 6 additions & 0 deletions 463_YOLOv9-Shoulder-Elbow-Knee/url.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
https://github.com/WongKinYiu/yolov9

https://github.com/PINTO0309/onnx2tf
https://github.com/PINTO0309/simple-onnx-processing-tools
https://github.com/PINTO0309/tflite-input-output-rewriter

94 changes: 94 additions & 0 deletions 463_YOLOv9-Shoulder-Elbow-Knee/yolov9/export_onnx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
TYPE=e
# RELU= or RELU=-relu
RELU=
RELUS=$(echo ${RELU} | sed 's/-/_/g')
MODEL_NAME=yolov9_${TYPE}_sek
SUFFIX="0100_1x3x"
# best-t.pt
# best-t-relu.pt
# best-e.pt
# best-e-relu.pt
MODEL_PATH=best-${TYPE}-sek.pt #best-${TYPE}${RELU}.pt

RESOLUTIONS=(
"128 160"
"128 256"
"192 320"
"192 416"
"192 640"
"192 800"
"256 320"
"256 416"
"256 448"
"256 640"
"256 800"
"256 960"
"288 1280"
"288 480"
"288 640"
"288 800"
"288 960"
"320 320"
"384 1280"
"384 480"
"384 640"
"384 800"
"384 960"
"416 416"
"480 1280"
"480 640"
"480 800"
"480 960"
"512 512"
"512 640"
"512 896"
"544 1280"
"544 800"
"544 960"
"640 640"
"736 1280"
"576 1024"
"384 672"
)

python reparameterization${RELUS}.py \
--type ${TYPE} \
--cfg ./models/detect/gelan-${TYPE}${RELU}.yaml \
--weights ${MODEL_PATH} \
--save ${MODEL_NAME}${RELUS}.pt

for((i=0; i<${#RESOLUTIONS[@]}; i++))
do
RESOLUTION=(`echo ${RESOLUTIONS[i]}`)
H=${RESOLUTION[0]}
W=${RESOLUTION[1]}

python export.py \
--data data/original.yaml \
--weights ${MODEL_NAME}${RELUS}.pt \
--imgsz ${H} ${W} \
--batch-size 1 \
--device cpu \
--opset 13 \
--include onnx

mv ${MODEL_NAME}${RELUS}.onnx ${MODEL_NAME}${RELUS}_${SUFFIX}${H}x${W}.onnx

sng4onnx \
--input_onnx_file_path ${MODEL_NAME}${RELUS}_${SUFFIX}${H}x${W}.onnx \
--output_onnx_file_path ${MODEL_NAME}${RELUS}_${SUFFIX}${H}x${W}.onnx

onnxsim ${MODEL_NAME}${RELUS}_${SUFFIX}${H}x${W}.onnx ${MODEL_NAME}${RELUS}_${SUFFIX}${H}x${W}.onnx
onnxsim ${MODEL_NAME}${RELUS}_${SUFFIX}${H}x${W}.onnx ${MODEL_NAME}${RELUS}_${SUFFIX}${H}x${W}.onnx
onnxsim ${MODEL_NAME}${RELUS}_${SUFFIX}${H}x${W}.onnx ${MODEL_NAME}${RELUS}_${SUFFIX}${H}x${W}.onnx
done

python export.py \
--data data/original.yaml \
--weights ${MODEL_NAME}${RELUS}.pt \
--device cpu \
--opset 13 \
--include onnx \
--dynamic
mv ${MODEL_NAME}${RELUS}.onnx ${MODEL_NAME}${RELUS}_Nx3HxW.onnx
onnxsim ${MODEL_NAME}${RELUS}_Nx3HxW.onnx ${MODEL_NAME}${RELUS}_Nx3HxW.onnx
Loading

0 comments on commit 30ad1a9

Please sign in to comment.