chore: sync annotation UI, shortcuts, and misc updates

This commit is contained in:
Andrew-AAAA committed 2026-09-10 09:14:28 +07:00
1 parent cf4c3370e1
commit 51e74a253e
11 files changed
+102 -36

No files matched your search

+41 -13
View File
@@ -5,8 +5,6 @@ guidelines](https://github.com/multica-ai/andrej-karpathy-skills) and the
[Chain of Truth](https://faridsurya-dev.github.io/Vibe-Coding-Research/en/welcome)
method: **validated artifacts are the source of truth, AI is a generator and accelerator.**
Please Response in extremely concise and precise.
## 1. Think Before Coding
**Don't assume. Don't hide confusion. Surface tradeoffs.**
@@ -56,14 +54,12 @@ endpoint, run the job, look at the files it produced.
`docs/` is the source of truth, not the chat prompt.
| Document | Contents |
| ---------------------- | ----------------------------------------------------------------------------------- |
| `docs/requirements.md` | Numbered `REQ-xxx` requirements. Changes only with the user's approval. |
| `docs/design.md` | Data schema, API contract, disk layout. Each section names the `REQ-xxx` it serves. |
| `docs/tasks.md` | Implementation steps + verification criteria, status `[TODO]`/`[DONE]`. |
The rules:
- Before writing feature code, make sure a `REQ-xxx` covers it. If none does, propose
@@ -82,14 +78,45 @@ scripts with `uv run`. The Docker image installs the same file, so the two envir
cannot drift.
- **File size limit: 400 lines.** Any new or refactored file that exceeds it must be split
into smaller, logical modules.
- `**sam3/` is a vendor copy** of Meta's library. It's a dependency, not app code — don't
add scripts there or edit anything inside it.
- **`sam3/` is a vendored git submodule** (Meta's `facebookresearch/sam3`). It's a
dependency, not app code — don't add scripts there or edit anything inside it. It's
installed with `uv pip install -e ./sam3`.
- **Never write into the user's video archive.** All output goes under `data/`.
- Secrets (`HF_TOKEN`) come from `.env` only; they never belong in code or docs.
## 7. UI/UX
## 7. Architecture
Frontend work follows [ui-ux-pro-max](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill):
**Two backends can coexist** — bare-metal (port 8000) and Docker (port 9010). The
`start.sh` script auto-detects GPU, generates `docker-compose.override.yml` for CDI
GPU passthrough, and falls back to bare-metal if Docker is unavailable.
```
backend/ FastAPI app (main.py), API routes in backend/api/
frontend/ React 19 + Vite 7 SPA; dev on 5173, Docker on 9000
algoritma-batch/ Counting engine (tracker, line counter). In Docker image it
is copied to /app/src/ and /app/cfg/ — imports resolve as
`src.*`, not `algoritma-batch.*`.
data/ SQLite DB, projects, extracted frames, datasets, model weights
docs/ Chain of Truth: requirements, design, tasks, UI spec
```
**Port mapping:**
| Service | Bare-metal | Docker |
|-----------------|:----------:|:------:|
| Backend API | 8000 | 9010 |
| Frontend Web UI | 5173 | 9000 |
**Key entrypoints:**
- `backend/main.py` — FastAPI app, lifespan, health endpoint, router wiring
- `backend/jobs.py` — single-threaded GPU-locked job worker (extract, autolabel, merge, train, count, clock-scan, truck-scan)
- `backend/sam3_engine.py` — SAM3 vision backbone, loaded once per process
- `backend/hardware.py` — GPU VRAM detection and training batch-size defaults
## 8. UI/UX
Frontend work follows [ui-ux-pro-max](https://github.com/nextlevelbuilder/ui--pro-max-skill):
generate the design system first (style, palette, typography), then build against it, then
validate before delivering. Consistency across pages beats per-page cleverness.
@@ -109,18 +136,19 @@ Pre-delivery checklist — a UI task is not `[DONE]` until all of it passes:
The review editor also has to survive keyboard-only use — see `docs/design.md`, "Frontend".
## 8. Domain invariants
## 9. Domain invariants
Two things are easy to break without noticing, and breaking either makes the whole system
lie:
1. **Stable val split.** Once a frame lands in `val`, it stays in `val` forever. Otherwise
he base-vs-new mAP comparison is meaningless.
the base-vs-new mAP comparison is meaningless.
2. **One `set_image` per image.** `Sam3Processor.set_image()` runs the vision backbone;
set_text_prompt()`only re-runs the grounding head against the cached`backbone_out`. n N-prompt job calls` set_image` **once per image** and loops prompts over that same
tate. Don't restructure this into set_image-per-prompt.
`set_text_prompt()` only re-runs the grounding head against the cached `backbone_out`. An
N-prompt job calls `set_image` **once per image** and loops prompts over that same state.
Don't restructure this into set_image-per-prompt.
## 9. Scalability & Portability
## 10. Scalability & Portability
**Never hardcode something that will change across environments.**