.PHONY: setup detect export finetune clean app help PYTHON := python UV := uv DATA_RAW := data/raw DATA_DET := data/detections DATA_LAB := data/labeled help: @echo "autolabel — OWLv2 labeling pipeline" @echo "" @echo "Targets:" @echo " setup Install dependencies" @echo " app Launch the Gradio UI (primary workflow)" @echo " detect Run OWLv2 batch detection via CLI → data/detections/" @echo " export Build COCO JSON from data/labeled/ via CLI" @echo " finetune Fine-tune OWLv2 via CLI (future use)" @echo " clean Remove generated JSON files (raw images untouched)" setup: $(UV) sync @cp -n .env.example .env 2>/dev/null || true @echo "Done. Run: make app" app: PYTORCH_ENABLE_MPS_FALLBACK=1 $(UV) run python app.py detect: $(UV) run python scripts/run_detection.py \ --image-dir $(DATA_RAW) \ --output-dir $(DATA_DET) export: $(UV) run python scripts/export_coco.py \ --labeled-dir $(DATA_LAB) \ --output $(DATA_LAB)/coco_export.json finetune: PYTORCH_ENABLE_MPS_FALLBACK=1 $(UV) run python scripts/finetune_owlv2.py \ --coco-json $(DATA_LAB)/coco_export.json \ --image-dir $(DATA_RAW) clean: @echo "Removing generated files..." find $(DATA_DET) -name "*.json" -delete 2>/dev/null || true find $(DATA_LAB) -name "*.json" -delete 2>/dev/null || true @echo "Done. Raw images in $(DATA_RAW) are untouched."