Using vibe coding to develop head counting software
In chat:
follow this instructions in
.codex/rules/setup.mdto setup the development tools for this project
from this link: https://huggingface.co/datasets/GlobalWheat/GWFSS_v1.0/tree/main
Download and unzip GWFSS_v1.0_labelled into data/GWFSS_v1.0_labelled.
Keep the downloaded dataset outside git; data/ is ignored by this repo.
Expected folder structure:
data/
`-- GWFSS_v1.0_labelled/
|-- images/
| |-- Arvalis/
| |-- CIMMYT/
| |-- ...
| |-- USASK/
| `-- UTokyo/
`-- masks/
|-- Arvalis/
|-- CIMMYT/
|-- ...
|-- USASK/
`-- UTokyo/
Images and masks are paired by source folder and file stem where the dataset
provides annotations. The generated app should check this data path on startup
and build an image/result index for fast browsing. Cache that index under a
local cache path such as data/.cache/gwfss_index.json or
data/.cache/gwfss_index.npy; do not commit cache files.
When the user selects Global Wheat data in the UI, the app should list indexed samples from the backend. The frontend should show source-folder tags for filtering, preview images from backend-provided URLs, 50 grid items per page, and pagination for additional samples. The selected sample should resolve the paired mask and metadata through the startup index.
The generated demo frontend should use Svelte 5 with Vite and Tailwind CSS.
Use TypeScript where practical. Do not use SvelteKit for this small local demo
unless a later prompt explicitly changes the scope. Svelte components should use
Svelte 5 runes such as $state, $derived, $effect, and $props, plus the
current event syntax such as onclick.
Keep frontend package and build configuration at the project root, reusing
package.json, pnpm-lock.yaml, and Vite/Tailwind/TypeScript config files
there. Use app/frontend as the Vite source root rather than creating a nested
frontend package under app/frontend.
The generated app must run local inference only. Backend scripts assume required
model files have already been downloaded into a weights/ directory in the
target app workspace. The scripts should validate these paths and skip model
inference cleanly when files are missing; they should not download weights at
runtime.
Do not commit weights/ to git.
Expected layout:
weights/
`-- sam3.1_multiplex.pt
SAM 3 is available through ultralytics>=8.3.237. Install or upgrade it in the
generated app environment:
uv add ultralyticsSAM 3 weights are gated and are not automatically downloaded by Ultralytics.
Request access on the SAM 3 Hugging Face model page linked from the
Ultralytics SAM 3 installation docs.
After approval (facebook/sam3.1 · Hugging Face), download sam3.1_multiplex.pt manually and place it at:
weights/sam3.1_multiplex.pt
For text or concept prompts, use Ultralytics SAM3SemanticPredictor, not the
plain SAM("sam3.pt") visual-prompt wrapper. The plain wrapper is for points,
boxes, or masks and segments a specific prompted object rather than all
instances matching a concept.
If prediction raises TypeError: 'SimpleTokenizer' object is not callable, the
Ultralytics docs recommend replacing the unrelated clip package with the
Ultralytics CLIP package:
uv pip uninstall clip
uv pip install git+https://github.com/ultralytics/CLIP.git