diff --git a/scripts/train.sh b/scripts/train.sh index d20b929..cf0b068 100644 --- a/scripts/train.sh +++ b/scripts/train.sh @@ -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 ..