Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/train.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
mode: start
github-token: ${{ secrets.GH_PAT }}
ec2-image-id: ami-06c62c213d8fdc88f
ec2-image-id: ami-078da566f22c68a26
ec2-instance-type: g4dn.xlarge
subnet-id: subnet-0ed91f5fc60959086
security-group-id: sg-05cd9ff586699e8db
Expand All @@ -52,6 +52,13 @@ jobs:
- name: Install dependencies
run: uv sync

- name: Check CUDA environment
run: |
nvidia-smi
nvcc --version || true
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
uv run python -c "import torch; print('torch:', torch.__version__); print('cuda:', torch.version.cuda); print('available:', torch.cuda.is_available()); print('device:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'none'); import torch.backends.cudnn as cudnn; print('cudnn enabled:', cudnn.enabled); print('cudnn version:', cudnn.version())"

- name: Run pipeline
run: uv run dvc repro

Expand All @@ -74,7 +81,7 @@ jobs:
- name: Download test dataset
run: |
uv run dvc get https://github.com/pyronear/pyro-dataset \
data/processed/yolo_test --rev v2.1.0 \
data/processed/yolo_test --rev v2.2.0 \
--out ./data/test/yolo_test

- name: Run evaluation
Expand All @@ -90,7 +97,7 @@ jobs:
- name: Download sequential test dataset
run: |
uv run dvc get https://github.com/pyronear/pyro-dataset \
data/processed/sequential_test --rev v2.1.0 \
data/processed/sequential_test --rev v2.2.0 \
--out ./data/test/sequential_test

- name: Run sequential predictions on test
Expand Down Expand Up @@ -238,7 +245,7 @@ jobs:
{opt_table}

{baseline_note}
**Branch:** `{os.environ.get('RESULT_BRANCH', '')}` | **Test dataset:** pyronear/pyro-dataset @ v2.1.0""")
**Branch:** `{os.environ.get('RESULT_BRANCH', '')}` | **Test dataset:** pyronear/pyro-dataset @ v2.2.0""")
PYEOF
)

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ The Data pipeline is organized with a [dvc.yaml](./dvc.yaml) file.
This section list and describes all the DVC stages that are defined in the
[dvc.yaml](./dvc.yaml) file:

- __fetch_model_input__: Download the `yolo_train_val` dataset from [pyro-dataset](https://github.com/pyronear/pyro-dataset) at `v2.1.0`.
- __fetch_model_input__: Download the `yolo_train_val` dataset from [pyro-dataset](https://github.com/pyronear/pyro-dataset) at `v2.2.0`.
- __train_yolo_best__: Train the best YOLO model on the full dataset.
- __build_manifest_yolo_best__: Build the manifest.yaml file to attach with the model.
- __fetch_sequential_val__: Download the sequential val dataset from [pyro-dataset](https://github.com/pyronear/pyro-dataset) at `v2.1.0`.
- __fetch_sequential_val__: Download the sequential val dataset from [pyro-dataset](https://github.com/pyronear/pyro-dataset) at `v2.2.0`.
- __predict_sequential_val__: Run per-frame YOLO predictions on the sequential val set and save label files.
- __optimize_sequential_val__: Grid-search engine parameters (nb_consecutive_frames × conf_thresh) on val predictions and save top-20 results.
- __export_yolo_best__: Export the best YOLO model to ONNX and NCNN formats.
Expand Down Expand Up @@ -346,7 +346,7 @@ The test set is not part of the CI pipeline, so predictions must be run locally.
```sh
SSL_CERT_FILE=$(uv run python -c "import certifi; print(certifi.where())") \
uv run dvc get https://github.com/pyronear/pyro-dataset \
data/processed/sequential_test --rev v2.1.0 \
data/processed/sequential_test --rev v2.2.0 \
--out ./data/test/sequential_test
```

Expand Down
68 changes: 34 additions & 34 deletions dvc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,26 @@ stages:
deps:
- path: ./data/01_model_input/yolo_train_val
hash: md5
md5: fcd56c8728d160e957bf0acd8049368d.dir
size: 1780235401
md5: 75db0a70ab0148ab356e958476f1a7f4.dir
size: 1780231374
nfiles: 30387
- path: ./scripts/data/model_input/build.py
hash: md5
md5: 7607af10f59267cf9859cb1d372aff26
size: 6432
- path: ./scripts/model/yolo/configs/best.yaml
hash: md5
md5: 82ab9c26b11cfc5f72e1398bfceeb838
size: 194
md5: 5c3035ec8212cd07f6f48e85439de59e
size: 225
- path: ./scripts/model/yolo/train.py
hash: md5
md5: ec596bafe76e946d0770be47b34db816
size: 3873
outs:
- path: ./data/02_models/yolo/best
hash: md5
md5: be5d61086d3a2b2e68e8a5dd61b14901.dir
size: 44003643
md5: d85134b2ce827560f903673430c49479.dir
size: 46115898
nfiles: 24
build_manifest_yolo_best:
cmd:
Expand All @@ -90,8 +90,8 @@ stages:
deps:
- path: ./data/02_models/yolo/best/
hash: md5
md5: be5d61086d3a2b2e68e8a5dd61b14901.dir
size: 44003643
md5: d85134b2ce827560f903673430c49479.dir
size: 46115898
nfiles: 24
- path: ./scripts/model/yolo/build_manifest.py
hash: md5
Expand All @@ -100,8 +100,8 @@ stages:
outs:
- path: ./data/03_reporting/yolo/best/
hash: md5
md5: d16e4d5660095fd5a38280ebea098ddc.dir
size: 13490
md5: 0d0bf2bc9e03b78803743e8f9561fba1.dir
size: 13495
nfiles: 1
export_yolo_best@onnx-cpu:
cmd:
Expand All @@ -111,8 +111,8 @@ stages:
deps:
- path: ./data/02_models/yolo/best/
hash: md5
md5: be5d61086d3a2b2e68e8a5dd61b14901.dir
size: 44003643
md5: d85134b2ce827560f903673430c49479.dir
size: 46115898
nfiles: 24
- path: ./scripts/model/yolo/export.py
hash: md5
Expand All @@ -121,8 +121,8 @@ stages:
outs:
- path: ./data/02_models/yolo-export/best/onnx/cpu
hash: md5
md5: 0b4f67d18810a40cb4d783312a4bdca8.dir
size: 38512704
md5: 0215fd7d04e4419eb4da8c1e866124e7.dir
size: 38481543
nfiles: 1
export_yolo_best@onnx-mps:
cmd:
Expand Down Expand Up @@ -153,8 +153,8 @@ stages:
deps:
- path: ./data/02_models/yolo/best/
hash: md5
md5: be5d61086d3a2b2e68e8a5dd61b14901.dir
size: 44003643
md5: d85134b2ce827560f903673430c49479.dir
size: 46115898
nfiles: 24
- path: ./scripts/model/yolo/export.py
hash: md5
Expand All @@ -163,8 +163,8 @@ stages:
outs:
- path: ./data/02_models/yolo-export/best/ncnn/cpu
hash: md5
md5: e1493ed19c061ad3ec6b00caead444bd.dir
size: 38001888
md5: 8ed7474cfda03d3b63644f0bd66863fa.dir
size: 38225354
nfiles: 5
export_yolo_best@ncnn-mps:
cmd:
Expand All @@ -190,23 +190,23 @@ stages:
fetch_model_input:
cmd:
- uv run dvc get https://github.com/pyronear/pyro-dataset
data/processed/yolo_train_val --rev v2.1.0 --out
data/processed/yolo_train_val --rev v2.2.0 --out
./data/01_model_input/yolo_train_val || uv run dvc get
git@github.com:pyronear/pyro-dataset.git data/processed/yolo_train_val
--rev v2.1.0 --out ./data/01_model_input/yolo_train_val
--rev v2.2.0 --out ./data/01_model_input/yolo_train_val
outs:
- path: ./data/01_model_input/yolo_train_val
hash: md5
md5: fcd56c8728d160e957bf0acd8049368d.dir
size: 1780235401
md5: 75db0a70ab0148ab356e958476f1a7f4.dir
size: 1780231374
nfiles: 30387
fetch_sequential_val:
cmd:
- uv run dvc get https://github.com/pyronear/pyro-dataset
data/processed/sequential_train_val/val --rev v2.1.0 --out
data/processed/sequential_train_val/val --rev v2.2.0 --out
./data/01_model_input/sequential_train_val/val || uv run dvc get
git@github.com:pyronear/pyro-dataset.git
data/processed/sequential_train_val/val --rev v2.1.0 --out
data/processed/sequential_train_val/val --rev v2.2.0 --out
./data/01_model_input/sequential_train_val/val
outs:
- path: ./data/01_model_input/sequential_train_val/val
Expand Down Expand Up @@ -256,17 +256,17 @@ stages:
nfiles: 12448
- path: ./data/02_models/yolo/best/weights/best.pt
hash: md5
md5: fea4ddc8d904fcc5ff11ad900e040837
size: 19225626
md5: fe8ad238cf7d5461534ff15b195e6781
size: 20357893
- path: predict_sequential.py
hash: md5
md5: 01105704d08d0fa6a9286d0dc6d167f2
size: 4500
outs:
- path: ./data/03_reporting/sequential/predictions_labels_val
hash: md5
md5: cbe0e8e4d58627ca6856371246d400c2.dir
size: 104904
md5: 8cda081bff183d80b99042e4157b77c1.dir
size: 169106
nfiles: 3438
optimize_sequential_val:
cmd:
Expand All @@ -277,8 +277,8 @@ stages:
deps:
- path: ./data/03_reporting/sequential/predictions_labels_val
hash: md5
md5: cbe0e8e4d58627ca6856371246d400c2.dir
size: 104904
md5: 8cda081bff183d80b99042e4157b77c1.dir
size: 169106
nfiles: 3438
- path: optimize_sequential.py
hash: md5
Expand All @@ -287,9 +287,9 @@ stages:
outs:
- path: ./data/03_reporting/sequential/grid_search_val.tsv
hash: md5
md5: 8bae210202dc4210162712779346d572
size: 1896
md5: 4abba0f304dcd7b49aad890f62b43a12
size: 1918
- path: ./data/03_reporting/sequential/grid_search_val_top20.tsv
hash: md5
md5: 42f461234b5a48ca27bb28a46afb2cd0
size: 975
md5: 3ec64a40f914e21882ab2ac38f7c6a0f
size: 996
8 changes: 4 additions & 4 deletions dvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ stages:
cmd:
- >-
uv run dvc get https://github.com/pyronear/pyro-dataset
data/processed/yolo_train_val --rev v2.1.0
data/processed/yolo_train_val --rev v2.2.0
--out ./data/01_model_input/yolo_train_val
||
uv run dvc get git@github.com:pyronear/pyro-dataset.git
data/processed/yolo_train_val --rev v2.1.0
data/processed/yolo_train_val --rev v2.2.0
--out ./data/01_model_input/yolo_train_val
outs:
- ./data/01_model_input/yolo_train_val
Expand Down Expand Up @@ -53,11 +53,11 @@ stages:
cmd:
- >-
uv run dvc get https://github.com/pyronear/pyro-dataset
data/processed/sequential_train_val/val --rev v2.1.0
data/processed/sequential_train_val/val --rev v2.2.0
--out ./data/01_model_input/sequential_train_val/val
||
uv run dvc get git@github.com:pyronear/pyro-dataset.git
data/processed/sequential_train_val/val --rev v2.1.0
data/processed/sequential_train_val/val --rev v2.2.0
--out ./data/01_model_input/sequential_train_val/val
outs:
- ./data/01_model_input/sequential_train_val/val
Expand Down
8 changes: 4 additions & 4 deletions fetch_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
SSL_CERT_FILE=/Users/mateo/pyronear/vision/train/pyro-train/.venv/lib/python3.12/site-packages/certifi/cacert.pem \
uv run dvc get https://github.com/pyronear/pyro-dataset \
data/processed/sequential_train_val/train \
--rev v2.1.0 \
--rev v2.2.0 \
--out ./data/01_model_input/sequential_train_val/train \

SSL_CERT_FILE=/Users/mateo/pyronear/vision/train/pyro-train/.venv/lib/python3.12/site-packages/certifi/cacert.pem \
uv run dvc get https://github.com/pyronear/pyro-dataset \
data/processed/sequential_train_val/val \
--rev v2.1.0 \
--rev v2.2.0 \
--out ./data/01_model_input/sequential_train_val/val \


SSL_CERT_FILE=/Users/mateo/pyronear/vision/train/pyro-train/.venv/lib/python3.12/site-packages/certifi/cacert.pem \
uv run dvc get https://github.com/pyronear/pyro-dataset \
data/processed/sequential_test \
--rev v2.1.0 \
--rev v2.2.0 \
--out ./data/test/sequential_test \


SSL_CERT_FILE=/Users/mateo/pyronear/vision/train/pyro-train/.venv/lib/python3.12/site-packages/certifi/cacert.pem \
uv run dvc get https://github.com/pyronear/pyro-dataset \
data/processed/yolo_train_val \
--rev v2.1.0 \
--rev v2.2.0 \
--out ./data/01_model_input/yolo_train_val \

8 changes: 4 additions & 4 deletions results/eval_results.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"precision": 0.788629074749298,
"recall": 0.7360742705570292,
"map50": 0.7555552278085748,
"map50_95": 0.4801768125555643,
"precision": 0.7463671524656689,
"recall": 0.6850291639662994,
"map50": 0.749573511396377,
"map50_95": 0.44217001534622236,
"model_dir": "data/02_models/yolo/best",
"data": "data/test/yolo_test/data.yaml",
"split": "test"
Expand Down
20 changes: 10 additions & 10 deletions results/eval_sequential_results.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"nb_consecutive_frames": 4,
"conf_thresh": 0.2,
"tp": 143,
"fn": 6,
"fp": 21,
"tn": 128,
"recall": 0.9597,
"fpr": 0.1409,
"precision": 0.872,
"f1": 0.9137
"nb_consecutive_frames": 8,
"conf_thresh": 0.15,
"tp": 114,
"fn": 3,
"fp": 9,
"tn": 114,
"recall": 0.9744,
"fpr": 0.0732,
"precision": 0.9268,
"f1": 0.95
}
23 changes: 13 additions & 10 deletions scripts/model/yolo/configs/best.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
---
model_type: yolo11s.pt
warmup_epochs: 6
epochs: 50
patience: 20
model_type: yolo26s.pt
warmup_epochs: 3
epochs: 40
patience: 5
batch: 16
imgsz: 1024
lr0: 0.0001
lrf: 0.1
lr0: 0.0005
lrf: 0.0015
optimizer: AdamW
mixup: 0.2
close_mosaic: 10
mixup: 0.1
close_mosaic: 17
degrees: 5.0
translate: 0.15
iou: 0.2
translate: 0.2
iou: 0.6
box: 4.19
cls: 5.28
dfl: 6.64
1 change: 1 addition & 0 deletions src/pyro_train/model/yolo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class YOLOModelVersion(Enum):
version_10 = 10
version_11 = 11
version_12 = 12
version_26 = 26


class YOLOModelSize(Enum):
Expand Down