From 559e0777cf66ec45b84cd13c1b249804e8f21f92 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Thu, 29 Jun 2023 00:17:03 -0400 Subject: [PATCH] Add yolov5 as submodule and place to put trained files --- .gitmodules | 3 +++ models/.gitignore | 3 +++ scripts/install_yolov5.sh | 6 ++++++ scripts/train.sh | 16 +++++++++++++++- yolov5 | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 100644 models/.gitignore create mode 100644 scripts/install_yolov5.sh create mode 160000 yolov5 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..128240e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "yolov5"] + path = yolov5 + url = https://github.com/ultralytics/yolov5.git diff --git a/models/.gitignore b/models/.gitignore new file mode 100644 index 0000000..cec9082 --- /dev/null +++ b/models/.gitignore @@ -0,0 +1,3 @@ +* + +!.gitignore diff --git a/scripts/install_yolov5.sh b/scripts/install_yolov5.sh new file mode 100644 index 0000000..009e0c8 --- /dev/null +++ b/scripts/install_yolov5.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cd yolov5 +python -m venv env +source env/bin/activate +python -m pip install -r requirements.txt diff --git a/scripts/train.sh b/scripts/train.sh index 891473c..d53b119 100644 --- a/scripts/train.sh +++ b/scripts/train.sh @@ -46,5 +46,19 @@ if [ ! -f "${UNZIPPED}/data.yaml" ]; then exit 1 fi -FULLDEST=$(realpath "${DEST}") +FULLDEST=$(realpath "${UNZIPPED}") python scripts/data.py "${FULLDEST}/data.yaml" + +cd yolov5 +source env/bin/activate + +WEIGHTS="yolov5s.pt" + +if [[ "${MODEL}" == "yolov5m_onnx" ]]; then + WEIGHTS="yolov5m.pt" +else if [[ "${MODEL}" == "yolov5l_onnx" ]]; then + WEIGHTS="yolov5l.pt" +fi + +python train.py --img 640 --batch 16 --epochs 300 --data "${FULLDEST}/data.yaml" --weights "${WEIGHTS}" --cache --project ../models/ --name "${ID}" + diff --git a/yolov5 b/yolov5 new file mode 160000 index 0000000..0004c74 --- /dev/null +++ b/yolov5 @@ -0,0 +1 @@ +Subproject commit 0004c745daeebb0eb6455b90c3e8abb308e61320