File size: 3,913 Bytes
5f34061
 
 
 
 
 
a2789cc
5f34061
 
 
3e2fcff
 
 
 
 
 
d5a3442
3e2fcff
 
 
 
 
 
 
 
d5a3442
 
add4fd0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3e2fcff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260d93c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
043b519
260d93c
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
title: Garment Attribute Predictor
emoji: 👕
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: true
---

# 👕 Fashion Attribute Predictor

Ein Gradio-basierter Hugging Face Space zur Vorhersage von Attributen aus Modebildern (z. B. T-Shirts, Pullover, etc.)  
Das Modell sagt für jede Attributgruppe (z. B. Farbe, Material, Schnitt) **das wahrscheinlichste Merkmal** vorher – inklusive **Confidence-Score**.

---

## 🔍 Funktionen

- 📸 Unterstützung für Bild-Upload
- 🧠 Vorhersage von Attributen aus 228 Kategorien
- 📊 Strukturierte **JSON-Ausgabe** mit `label`, `score` und `confidence`
- ✅ Einfache Integration in Datenbanken, APIs oder Forschungsprojekte

---

## 🧩 Unterstützte Attributgruppen

Das Modell liefert jeweils **das wahrscheinlichste Attribut** aus jeder dieser Gruppen:

| Attributgruppe | Beschreibung (Beispiele)                        |
|----------------|-------------------------------------------------|
| `category`     | Kleidungstyp (z. B. T-Shirts, Jeans, Blazer)     |
| `color`        | Farbton (z. B. Red, Black, Blue)                 |
| `material`     | Materialtyp (z. B. Cotton, Leather, Lace)        |
| `style`        | Stil (z. B. Vintage, Bandage, Peplum)            |
| `pattern`      | Muster (z. B. Striped, Polka Dot, Floral)        |
| `sleeve`       | Ärmeltyp (z. B. Sleeveless, Long Sleeves)        |
| `neckline`     | Ausschnittform (z. B. V-Neck, Round Neck)        |
| `gender`       | Gender-Zielgruppe (Male, Female, Neutral)        |

---

## 📦 Ausgabeformat (Beispiel)

```json
{
  "category": {
    "label": "T-Shirts",
    "score": 0.9123,
    "confidence": "high"
  },
  "color": {
    "label": "Red",
    "score": 0.4871,
    "confidence": "low"
  }
}
```

- **score**: Modellwahrscheinlichkeit (0.0–1.0)
- **confidence**: `"high"` wenn Score ≥ 0.5, sonst `"low"`

---

## 📁 Dateien

| Datei                        | Beschreibung |
|-----------------------------|--------------|
| `app.py`                    | Haupt-Interface mit JSON-Ausgabe |
| `model_loader.py`           | Lädt das trainierte ResNet50-Modell |
| `index_to_attr.py`          | Mapping von Indizes zu Attributnamen |
| `model/AttrPredModel_StateDict.pth` | Vorgefertigte Modellgewichte |

---

## ⚙️ Modell-Details

- Backbone: `ResNet50`
- Trainingsdaten: iMaterialist (Fashion) Challenge 2018
- Vorhersageformat: Multi-Label (228 binäre Attribute)
- Eingabegröße: 512×512 RGB
- Normalisierung: mean=[0.6765, 0.6347, 0.6207], std=[0.3284, 0.3371, 0.3379]

---

## 📚 Lizenz & Nutzung

Nur für nicht-kommerzielle Forschungszwecke.  
Modelldaten basieren auf öffentlich verfügbaren Wettbewerbsdaten von FGVC5/Kaggle.

---

## 🧑‍💻 Erstellt von

Andreas Jewtschuk  
Masterarbeit – E-Commerce, Ernst-Abbe-Hochschule Jena  
[2025]


---

## 📥 Modellquelle

Dieses Projekt basiert auf dem vortrainierten Modell aus:

**VisualFashionAttributePrediction**  
by [Malte Prinzler](https://github.com/malteprinzler)  
🔗 https://github.com/malteprinzler/VisualFashionAttributePrediction

Das Modell wurde ursprünglich im Rahmen der [iMaterialist Challenge (Fashion) 2018](https://www.kaggle.com/competitions/imaterialist-challenge-fashion-2018/) trainiert und basiert auf einem ResNet50-Backbone.


---

## 🔧 Modifikationen durch den Autor

Im Rahmen dieser Anwendung wurde ausschließlich die **Ausgabe der Attributvorhersagen** verändert:

- Ursprünglich wurden nur Attribute mit einem Score über 0.5 angezeigt.
- In dieser Version wird **für jede Attributgruppe** (z. B. Farbe, Material, Ärmel) das **wahrscheinlichste Attribut** angezeigt – unabhängig vom Score.
- Zusätzlich wird eine Einschätzung über die Modellzuversicht (`confidence`: "high" / "low") auf Basis eines Schwellenwerts von 0.5 ausgegeben.

Das Modell selbst wurde nicht verändert.