Image Classification
Transformers
Safetensors
siglip
multi-label
fashion
apparel
manufacturing
quality-control
siglip2
Instructions to use resoa/garment-attributes with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use resoa/garment-attributes with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="resoa/garment-attributes") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoProcessor, AutoModelForImageClassification processor = AutoProcessor.from_pretrained("resoa/garment-attributes") model = AutoModelForImageClassification.from_pretrained("resoa/garment-attributes", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| license: apache-2.0 | |
| tags: | |
| - image-classification | |
| - multi-label | |
| - fashion | |
| - apparel | |
| - manufacturing | |
| - quality-control | |
| - siglip2 | |
| datasets: | |
| - Fashionpedia | |
| metrics: | |
| - f1 | |
| - average-precision | |
| pipeline_tag: image-classification | |
| library_name: transformers | |
| # garment-attributes | |
| Multi-label classification of fine-grained garment construction attributes | |
| from a garment crop: silhouette, length, neckline/collar/sleeve/pocket type, | |
| opening/closure type, waistline, textile pattern, finishing techniques, and | |
| fabric appearance. SigLIP2 vision encoder (Apache 2.0) with a classification | |
| head, fine-tuned on per-instance attribute annotations from | |
| [Fashionpedia](https://fashionpedia.github.io/home/) (CC BY 4.0). | |
| Label space: the 218 Fashionpedia attributes with β₯100 | |
| training instances (the full list with supergroups and support counts ships | |
| in `label_space.json` and in `config.json` `id2label`). Attributes map to | |
| tech pack fields β e.g. *opening type* β construction/closure, *textile | |
| pattern* β BOM/fabric β per the pipeline's `docs/taxonomy.md`. | |
| Loads with stock `transformers` β no remote code: | |
| ```python | |
| from transformers import AutoImageProcessor, AutoModelForImageClassification | |
| import torch | |
| from PIL import Image | |
| model = AutoModelForImageClassification.from_pretrained("resoa/garment-attributes") | |
| proc = AutoImageProcessor.from_pretrained("resoa/garment-attributes") | |
| img = Image.open("garment_crop.jpg") # crop of ONE garment, not a full scene | |
| probs = torch.sigmoid(model(**proc(images=img, return_tensors="pt")).logits)[0] | |
| for i, p in enumerate(probs): | |
| if p > 0.5: | |
| print(model.config.id2label[i], round(p.item(), 3)) | |
| ``` | |
| ## Intended use | |
| - Estimate visible construction characteristics of a manufactured garment | |
| from a photo (crop the garment first β use `garment-detector-seg`). | |
| - Cross-check a sample against tech pack attributes ("single-breasted", | |
| "welt pockets", "no distressing"). | |
| **Important:** input must be a single-garment crop. Full-scene inputs | |
| degrade accuracy sharply; that is what the detector stage is for. | |
| **Out of scope:** fiber content, GSM, measurements, stitch class, color | |
| (color is measured deterministically in the pipeline, not classified). | |
| ## Training | |
| - Base: `google/siglip2-base-patch16-224` (Apache 2.0). | |
| - Data: 156,937 Fashionpedia per-instance crops with attribute labels | |
| (`scripts/prepare_attribute_data.py`; 8% bbox padding, min crop 48 px, | |
| attributes with 100+ train instances). | |
| - Objective: sigmoid BCE (`problem_type="multi_label_classification"`). | |
| - Recipe: `scripts/train_attributes.py` with `configs/attributes_mac.yaml` | |
| (4 epochs, batch 32, lr 2e-5, cosine schedule, trained on Apple-silicon | |
| MPS in ~4.5 hours; val metrics improved monotonically each epoch). | |
| ## Evaluation (Fashionpedia val2020 instances) | |
| | Metric | Value | | |
| |---|---| | |
| | macro mAP | 0.442 | | |
| | micro F1 @ 0.5 | 0.710 | | |
| | macro F1 @ 0.5 | 0.306 | | |
| | eval instances | 3,711 | | |
| | evaluable labels | 212 of 218 | | |
| **Read the per-attribute table** (`per_attribute.md`, shipped in this repo) | |
| before using any single attribute for QC decisions: performance varies | |
| widely by attribute, and rare attributes (support near the cutoff) can be | |
| substantially weaker. We publish the full table, including the bad rows, | |
| on purpose. | |
| ## Known limitations & biases | |
| - Multi-label confidences are not calibrated probabilities; the reference | |
| pipeline routes 0.5β0.7 confidence predictions to human review. | |
| - Absence of a prediction is weak evidence of absence (occlusion, angle). | |
| - Trained on worn-garment street photos; flat-lay/factory photos are | |
| out-of-domain β fine-tune on in-domain crops for production use. | |
| - Attribute definitions follow Fashionpedia's expert ontology, which may | |
| differ from a specific factory's terminology; the supergroup mapping in | |
| `label_space.json` is the bridge. | |
| ## License & attribution | |
| Weights: Apache 2.0. Data: Fashionpedia, CC BY 4.0 β cite Jia et al., | |
| ECCV 2020. Base model: SigLIP2 (Google, Apache 2.0), Tschannen et al., 2025. | |