diff --git a/recognization/README.md b/recognization/README.md index b64e7d7..bcff2d4 100644 --- a/recognization/README.md +++ b/recognization/README.md @@ -25,6 +25,7 @@ Cần có đầy đủ: - `code/` - mã nguồn server, client web, client mẫu. - `runs/` - trọng số YOLO đã train (`runs/detect/train/weights/best.pt`). +- `weights/dinov2_vits14_lvd142m.safetensors` - DINOv2 backbone for the identity gallery. Not in Git. See "DINOv2 weights" below. - `stock/` - catalog `stock.csv` và ảnh mẫu sản phẩm `sku_001` -> `sku_022`. - `add/` và `image.jpg` - ảnh kệ mẫu để test/demo. - `requirements.txt`, `requirements-dev.txt`. @@ -49,6 +50,20 @@ source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements-dev.txt ``` +### DINOv2 weights + +The identity gallery embeds crops with DINOv2 ViT-S/14 (LVD-142M), Apache-2.0. It loads only a local file and does not contact Hugging Face, including when `YOLO_OFFLINE` is unset. Without the file, gallery identity fails and the server log says the weights are missing. + +The pinned file is `model.safetensors` from `timm/vit_small_patch14_dinov2.lvd142m`, sha256 `04d27f3400d059fc0cfd7d17dd1909a75bf3ea8fb3eeb48b97cb99e57ee20081` (~84 MB). Copy a cache you already have; do not fetch one from an unknown URL: + +```bash +mkdir -p weights +cp "$HOME/.cache/huggingface/hub/models--timm--vit_small_patch14_dinov2.lvd142m/snapshots/"*/model.safetensors \ + weights/dinov2_vits14_lvd142m.safetensors +``` + +`DORAYAKI_DINOV2_WEIGHTS` overrides that path. A file with any other sha256 is refused. + (`requirements-dev.txt` = `requirements.txt` + `httpx` cho test.) ### Bước 4: Khởi chạy recognition server