refactor: update Makefile

This commit is contained in:
Fam Zheng 2025-12-27 10:33:50 +00:00
parent c14deba2ca
commit 8fb224651a

View File

@ -94,7 +94,11 @@ fetch-quick: FORCE
cd emblem5 && uv run --with-requirements ../requirements.txt ./ai/fetch-scans.py --data-dir $(DATA_DIR) --sample-rate 0.01
sbs: FORCE
cd emblem5 && uv run --with-requirements ../requirements.txt ./ai/make-sbs.py --data-dir $(DATA_DIR)
@if [ -n "$(SCAN_IDS)" ]; then \
cd emblem5 && uv run --with-requirements ../requirements.txt ./ai/make-sbs.py --data-dir $(DATA_DIR) --scan-id-range "$(SCAN_IDS)"; \
else \
cd emblem5 && uv run --with-requirements ../requirements.txt ./ai/make-sbs.py --data-dir $(DATA_DIR); \
fi
train: FORCE
cd emblem5 && uv run --with-requirements ../requirements.txt ./ai/train2.py --data-dir $(DATA_DIR) --epochs 30
@ -102,6 +106,25 @@ train: FORCE
train-quick: FORCE
cd emblem5 && uv run --with-requirements ../requirements.txt ./ai/train2.py --data-dir $(DATA_DIR) --quick --epochs 2
finetune: FORCE
@if [ -z "$(SCAN_IDS)" ]; then \
echo "Error: SCAN_IDS is required. Usage: make finetune SCAN_IDS=357193-358808 MODEL=/path/to/model.pt"; \
exit 1; \
fi
@if [ -z "$(MODEL)" ]; then \
echo "Error: MODEL is required. Usage: make finetune SCAN_IDS=357193-358808 MODEL=/path/to/model.pt"; \
exit 1; \
fi
@MODEL_PATH="$(MODEL)"; \
if [ "$${MODEL_PATH#/}" = "$$MODEL_PATH" ] && [ "$${MODEL_PATH#~}" = "$$MODEL_PATH" ]; then \
MODEL_PATH="$(shell pwd)/$$MODEL_PATH"; \
fi; \
if [ ! -f "$$MODEL_PATH" ]; then \
echo "Error: Model file not found: $$MODEL_PATH"; \
exit 1; \
fi; \
cd emblem5 && uv run --with-requirements ../requirements.txt ./ai/train2.py --data-dir $(DATA_DIR) --scan-ids "$(SCAN_IDS)" --model "$$MODEL_PATH" --epochs 30
browser: FORCE
cd emblem5 && uv run --with-requirements ../requirements.txt streamlit run ./ai/browser.py -- --data-dir $(DATA_DIR)
@ -126,7 +149,7 @@ verify: FORCE
check-accuracy: FORCE
@if [ -z "$(MODEL)" ]; then \
echo "Error: MODEL is required. Usage: make check-accuracy MODEL=/path/to/model.pt [DATA_DIR=/path/to/data]"; \
echo "Error: MODEL is required. Usage: make check-accuracy MODEL=/path/to/model.pt [DATA_DIR=/path/to/data] [SCAN_IDS=xxx]"; \
exit 1; \
fi
@MODEL_PATH="$(MODEL)"; \
@ -141,7 +164,11 @@ check-accuracy: FORCE
if [ -z "$$DATA_DIR" ]; then \
DATA_DIR="$(HOME)/emblem"; \
fi; \
cd emblem5 && uv run --with-requirements ../requirements.txt python3 ./ai/check_accuracy.py "$$MODEL_PATH" "$$DATA_DIR"
if [ -n "$(SCAN_IDS)" ]; then \
cd emblem5 && uv run --with-requirements ../requirements.txt python3 ./ai/check_accuracy.py "$$MODEL_PATH" "$$DATA_DIR" --scan-ids "$(SCAN_IDS)"; \
else \
cd emblem5 && uv run --with-requirements ../requirements.txt python3 ./ai/check_accuracy.py "$$MODEL_PATH" "$$DATA_DIR"; \
fi
OPENCV_TAG := 4.9.0
opencv/src/LICENSE: