| --- |
| license: mit |
| tags: |
| - fashion |
| - image-retrieval |
| - resnet50 |
| - triplet-loss |
| - deepfashion |
| --- |
| # Full Project with frontend backend |
| https://github.com/ShushanSS/TopK_Similar_Images_Retrieval |
| |
| # DeepFashion Retrieval — Fine-tuned ResNet50 Embedder |
| |
| Fine-tuned ResNet50 image embedder for fashion item retrieval, trained with |
| batch-hard triplet loss and a category-aware PK sampler on the DeepFashion |
| In-shop Clothes Retrieval dataset. |
| |
| ## Contents |
| |
| | File | Description | |
| |---|---| |
| | `embedder_full_train_epoch_6.pt` | Fine-tuned ResNet50 weights (epoch 6) | |
| | `faiss_index.bin` | FAISS index built over embedded gallery images *(if included)* | |
| | `metadata.json` / `config.json` | Embedding dim, class list, preprocessing params *(if included)* | |
|
|
| ## Setup |
|
|
| ```bash |
| pip install -r requirements.txt |
| python download_weights.py |
| ``` |
|
|
| This downloads the files above into `./weights` in your project root. |
|
|
| ## Generating metadata locally |
|
|
| The metadata CSVs are **not included** in this repo since they're derived |
| from the raw DeepFashion images, which you need to download separately. |
|
|
| 1. Download the DeepFashion (In-shop Clothes Retrieval) high-res images. |
| 2. Update `DATASET_PATH` in `prepare_metadata.py` to point to your local copy, |
| preserving the original folder structure: |
| ``` |
| <DATASET_PATH>/<gender>/<clothing_category>/<item_id>/<image>.jpg |
| ``` |
| 3. Run: |
| ```bash |
| python prepare_metadata.py |
| ``` |
| This produces `original_metadata.csv`, `full_metadata.csv`, and |
| `original_metadata_filtered.csv` in your working directory. |
|
|
| ## Model details |
|
|
| - **Backbone:** ResNet50, fine-tuned with batch-hard triplet loss |
| - **Sampler:** CategoryAwarePKSampler |
| - **Retrieval baseline (CLIP zero-shot):** Hit Rate@5 = 0.546 |
| - **Fine-tuned ResNet50:** Hit Rate@5 = 0.819 on controlled test set |
|
|
| ## Usage |
|
|
| ```python |
| from huggingface_hub import snapshot_download |
| |
| snapshot_download( |
| repo_id="ShushanSS/DeepFashionRetrieval", |
| local_dir="./weights", |
| local_dir_use_symlinks=False, |
| ) |
| ``` |
|
|
| ## License |
|
|
| MIT (update if different) |
|
|