Use ONNX opset 12 (defaulted to 17) and simplify the model

This commit is contained in:
mmcwilliams 2023-11-29 12:43:54 -05:00
parent 9ee45587e0
commit 226c972020
1 changed files with 14 additions and 2 deletions

View File

@ -71,7 +71,7 @@ if [ ! -f "../models/${ID}/weights/best.pt" ]; then
exit 3
fi
python export.py --weights "../models/${ID}/weights/best.pt" --include onnx
python export.py --weights "../models/${ID}/weights/best.pt" --opset 12 --simplify --include onnx
if [ ! -f "../models/${ID}/weights/best.onnx" ]; then
fail "${ID}" "Error exporting model"
@ -81,11 +81,23 @@ if [ ! -f "../models/${ID}/weights/best.onnx" ]; then
fi
MODELPATH=$(realpath "../models/${ID}/weights/best.onnx")
PTPATH=$(realpath "../models/${ID}/weights/best.pt")
ZIPPATH="${ID}.zip"
mkdir zip
cp "${MODELPATH}" "zip/${NAME}.onnx"
cp "${PTPATH}" "zip/${NAME}.pt"
cd zip
zip "../${ZIPPATH}" *
cd ..
rm -r zip/
curl -s -X POST \
-F "model=@${MODELPATH}" \
-F "model=@${ZIPPATH}" \
"${YOLO_WEB_URL}/job/${ID}"
rm "${ZIPPATH}"
deactivate
cd ..