Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- fashion
|
| 5 |
+
- image-retrieval
|
| 6 |
+
- resnet50
|
| 7 |
+
- triplet-loss
|
| 8 |
+
- deepfashion
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# DeepFashion Retrieval — Fine-tuned ResNet50 Embedder
|
| 12 |
+
|
| 13 |
+
Fine-tuned ResNet50 image embedder for fashion item retrieval, trained with
|
| 14 |
+
batch-hard triplet loss and a category-aware PK sampler on the DeepFashion
|
| 15 |
+
In-shop Clothes Retrieval dataset.
|
| 16 |
+
|
| 17 |
+
## Contents
|
| 18 |
+
|
| 19 |
+
| File | Description |
|
| 20 |
+
|---|---|
|
| 21 |
+
| `embedder_full_train_epoch_6.pt` | Fine-tuned ResNet50 weights (epoch 6) |
|
| 22 |
+
| `faiss_index.bin` | FAISS index built over embedded gallery images *(if included)* |
|
| 23 |
+
| `metadata.json` / `config.json` | Embedding dim, class list, preprocessing params *(if included)* |
|
| 24 |
+
|
| 25 |
+
## Setup
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
pip install -r requirements.txt
|
| 29 |
+
python download_weights.py
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
This downloads the files above into `./weights` in your project root.
|
| 33 |
+
|
| 34 |
+
## Generating metadata locally
|
| 35 |
+
|
| 36 |
+
The metadata CSVs are **not included** in this repo since they're derived
|
| 37 |
+
from the raw DeepFashion images, which you need to download separately.
|
| 38 |
+
|
| 39 |
+
1. Download the DeepFashion (In-shop Clothes Retrieval) high-res images.
|
| 40 |
+
2. Update `DATASET_PATH` in `prepare_metadata.py` to point to your local copy,
|
| 41 |
+
preserving the original folder structure:
|
| 42 |
+
```
|
| 43 |
+
<DATASET_PATH>/<gender>/<clothing_category>/<item_id>/<image>.jpg
|
| 44 |
+
```
|
| 45 |
+
3. Run:
|
| 46 |
+
```bash
|
| 47 |
+
python prepare_metadata.py
|
| 48 |
+
```
|
| 49 |
+
This produces `original_metadata.csv`, `full_metadata.csv`, and
|
| 50 |
+
`original_metadata_filtered.csv` in your working directory.
|
| 51 |
+
|
| 52 |
+
## Model details
|
| 53 |
+
|
| 54 |
+
- **Backbone:** ResNet50, fine-tuned with batch-hard triplet loss
|
| 55 |
+
- **Sampler:** CategoryAwarePKSampler
|
| 56 |
+
- **Retrieval baseline (CLIP zero-shot):** Hit Rate@5 = 0.546
|
| 57 |
+
- **Fine-tuned ResNet50:** Hit Rate@5 = 0.819 on controlled test set
|
| 58 |
+
|
| 59 |
+
## Usage
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
from huggingface_hub import snapshot_download
|
| 63 |
+
|
| 64 |
+
snapshot_download(
|
| 65 |
+
repo_id="ShushanSS/DeepFashionRetrieval",
|
| 66 |
+
local_dir="./weights",
|
| 67 |
+
local_dir_use_symlinks=False,
|
| 68 |
+
)
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## License
|
| 72 |
+
|
| 73 |
+
MIT (update if different)
|