-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
75 lines (61 loc) · 1.71 KB
/
Copy pathrun.sh
File metadata and controls
75 lines (61 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
# PyroWatch - Pipeline runner
#
# Usage:
# bash run.sh demo full pipeline (generate -> train -> detect -> evaluate)
# bash run.sh train train only
# bash run.sh eval evaluate with trained RF model
# bash run.sh image PATH
# bash run.sh webcam
# bash run.sh test run unit tests
set -e
MODE="${1:-demo}"
echo ""
echo "========================================"
echo " PyroWatch -- Wildfire Smoke Detector "
echo "========================================"
echo ""
case "$MODE" in
demo)
echo "[1/4] Generating 60 sample images..."
python generate_samples.py
echo ""
echo "[2/4] Training RandomForest classifier..."
python train.py
echo ""
echo "[3/4] Running detector on all samples..."
python detector.py \
--source data/sample_images/ \
--model models/rf_classifier.pkl \
--save --json
echo ""
echo "[4/4] Evaluation metrics + confusion matrix..."
python evaluate.py \
--model models/rf_classifier.pkl \
--out-dir outputs/
echo ""
echo "Done. Check outputs/ for annotated images, confusion_matrix.png,"
echo "feature_distributions.png, and eval_report.json"
;;
train)
python train.py "${@:2}"
;;
eval)
python evaluate.py --model models/rf_classifier.pkl "${@:2}"
;;
image)
[ -z "$2" ] && { echo "Usage: bash run.sh image <path>"; exit 1; }
python detector.py --source "$2" --model models/rf_classifier.pkl --save
;;
webcam)
python detector.py --source 0 --show
;;
test)
python -m pytest tests/ -v
;;
*)
echo "Unknown mode: $MODE"
echo "Usage: bash run.sh [demo|train|eval|image <path>|webcam|test]"
exit 1
;;
esac