yosedie commited on
Commit
a01dcdf
·
verified ·
1 Parent(s): 5bca646

Update Dataset Card to full English with privacy notices

Browse files
Files changed (1) hide show
  1. README.md +30 -390
README.md CHANGED
@@ -4,418 +4,58 @@ task_categories:
4
  - image-segmentation
5
  - image-classification
6
  tags:
 
7
  - carpet-analysis
8
  - defect-detection
9
  - unet
10
  - sam2
11
- - computer-vision
12
- ---
13
-
14
- # 🧵 Carpet Analysis System
15
-
16
- **Sistem AI untuk Analisis & Verifikasi Keaslian Karpet**
17
-
18
- [![Python](https://img.shields.io/badge/Python-3.11-blue.svg)](https://www.python.org/)
19
- [![PyTorch](https://img.shields.io/badge/PyTorch-2.8.0-red.svg)](https://pytorch.org/)
20
- [![ONNX](https://img.shields.io/badge/ONNX-1.23.2-green.svg)](https://onnx.ai/)
21
- [![FastAPI](https://img.shields.io/badge/FastAPI-0.115.5-teal.svg)](https://fastapi.tiangolo.com/)
22
- [![Streamlit](https://img.shields.io/badge/Streamlit-1.41.0-red.svg)](https://streamlit.io/)
23
-
24
- ---
25
-
26
- ## 📋 Deskripsi
27
-
28
- Sistem berbasis **Deep Learning** untuk menganalisis karpet dari gambar mikroskopis dan makroskopis, kemudian memverifikasi keaslian berdasarkan kombinasi material dan jenis karpet, serta memberikan estimasi harga.
29
-
30
- **Fitur Utama:**
31
-
32
- - 🔬 **Material Detection**: Klasifikasi material (Polypropylene/Nylon/Polyester)
33
- - 🎨 **Carpet Segmentation**: Segmentasi karpet untuk quality assessment
34
- - 🏷️ **Type Classification**: Klasifikasi jenis karpet (6 jenis)
35
- - ✅ **Authentication**: Verifikasi keaslian berdasarkan kombinasi material+jenis
36
- - 💰 **Price Estimation**: Estimasi harga untuk karpet asli
37
-
38
- ---
39
-
40
- ## 🎯 Arsitektur Sistem
41
-
42
- ```
43
- ┌─────────────────────────────────────────────────────────────┐
44
- │ STREAMLIT FRONTEND │
45
- │ (Upload Images + Display Results) │
46
- └─────────────────────────┬───────────────────────────────────┘
47
- │
48
- ▼
49
- ┌─────────────────────────────────────────────────────────────┐
50
- │ FASTAPI BACKEND │
51
- ├──────────────────┬──────────────────┬───────────────────────┤
52
- │ CNN-B (8000) │ U-Net (8001) │ CNN-A (8002) │
53
- │ Material │ Segmentation │ Type │
54
- │ EfficientNet │ ResNet34 │ EfficientNet │
55
- └──────────────────┴──────────────────┴───────────────────────┘
56
- │
57
- ▼
58
- ┌─────────────────────────────────────────────────────────────┐
59
- │ SQLITE DATABASE │
60
- │ (Analysis History + Product Catalog) │
61
- └─────────────────────────────────────────────────────────────┘
62
- ```
63
-
64
- ---
65
-
66
- ## 🚀 Quick Start
67
-
68
- ### 1. Install Dependencies
69
-
70
- ```bash
71
- pip install -r requirements.txt
72
- ```
73
-
74
- ### 2. Start Backend API
75
-
76
- ```bash
77
- python deploy_all_models_onnx.py
78
- ```
79
-
80
- **Output:**
81
-
82
- - Port 8000: CNN-B (Material Classification)
83
- - Port 8001: U-Net (Carpet Segmentation)
84
- - Port 8002: CNN-A (Type Classification)
85
-
86
- ### 3. Start Frontend
87
-
88
- ```bash
89
- streamlit run app.py
90
- ```
91
-
92
- **Access:** http://localhost:8501
93
-
94
- ---
95
-
96
- ## 📊 Model Performance
97
-
98
- | Model | Task | Architecture | Accuracy | Inference Time |
99
- | --------- | ----------------------- | ---------------- | ---------- | -------------- |
100
- | **CNN-B** | Material Classification | EfficientNet-B0 | 100% | ~10ms |
101
- | **U-Net** | Carpet Segmentation | ResNet34 encoder | 88.66% IoU | ~45ms |
102
- | **CNN-A** | Type Classification | EfficientNet-B0 | 95.45% | ~15ms |
103
-
104
- **Total Processing Time:** ~70ms per image (ONNX optimized)
105
-
106
  ---
107
 
108
- ## 🗄️ Database Schema
109
-
110
- ### Tabel: `analysis_history`
111
-
112
- Menyimpan semua hasil analisis karpet
113
-
114
- ### Tabel: `carpet_products`
115
 
116
- 6 produk karpet yang dijual:
117
-
118
- 1. Asia Polypropylene (Rp 100K - 200K)
119
- 2. Malaysia Polyester (Rp 200K - 500K)
120
- 3. Mie Polypropylene (Rp 50K - 100K)
121
- 4. Persia Nylon (Rp 400K - 800K)
122
- 5. Polos Polypropylene (Rp 50K - 100K)
123
- 6. Sejadah Nylon (Rp 600K - 950K)
124
-
125
- ### Tabel: `suspicious_patterns`
126
-
127
- Log untuk fraud detection
128
 
129
  ---
130
 
131
- ## 💡 Cara Penggunaan
132
-
133
- ### Via Web Interface (Streamlit)
134
-
135
- 1. **Upload Images**
136
-
137
- - Mikroskopis: Gambar close-up serat karpet
138
- - Makroskopis: Gambar keseluruhan karpet
139
-
140
- 2. **Analyze**
141
-
142
- - Klik tombol "ANALISIS SEKARANG"
143
- - Tunggu ~1 detik untuk hasil
144
-
145
- 3. **View Results**
146
- - Material + confidence
147
- - Jenis + confidence
148
- - Status autentikasi (✅ Asli / 🚨 Palsu)
149
- - Estimasi harga (jika asli)
150
-
151
- ### Via CLI (Command Line)
152
-
153
- ```bash
154
- python carpet_analysis_system.py "mikro.jpg" "makro.jpg"
155
- ```
156
-
157
- ### Via API (REST)
158
-
159
- ```python
160
- import requests
161
 
162
- # Material Detection
163
- response = requests.post(
164
- "http://localhost:8000/predict",
165
- files={'file': open('mikro.jpg', 'rb')}
166
- )
167
- print(response.json())
168
-
169
- # Type Classification
170
- response = requests.post(
171
- "http://localhost:8002/predict",
172
- files={'file': open('makro.jpg', 'rb')}
173
- )
174
- print(response.json())
175
- ```
176
-
177
- ---
178
-
179
- ## 🌐 Deployment
180
-
181
- ### Option 1: ngrok (Demo - 2 Jam Session)
182
-
183
- ```bash
184
- # Terminal 1: Backend
185
- python deploy_all_models_onnx.py
186
-
187
- # Terminal 2: Frontend
188
- streamlit run app.py
189
-
190
- # Terminal 3: Expose
191
- ngrok http 8501
192
- ```
193
-
194
- **Result:** Public HTTPS URL untuk demo!
195
-
196
- ### Option 2: Google Cloud Run (Production 24/7)
197
-
198
- See [DEPLOYMENT.md](host/DEPLOYMENT.md) for detailed guide.
199
-
200
- **FREE TIER:** 2 juta request/bulan - GRATIS!
201
 
202
  ---
203
 
204
- ## 📁 Struktur Folder
205
 
206
- ```
207
- Dataset_Karpet_Skripsi/
208
- ├── deploy_all_models_onnx.py # Backend API (3 servers)
209
- ├── app.py # Frontend Streamlit
210
- ├── database.py # Database operations
211
- ├── database_schema.sql # Database schema
212
- ├── carpet_analysis_system.py # CLI version
213
- ├── requirements.txt # Dependencies
214
- ├── DEPLOYMENT.md # Deployment guide
215
- ├── SUMMARY.md # Complete documentation
216
- │
217
- ├── 06_Models/exports/
218
- │ ├── cnn_a_model.onnx # Type classification
219
- │ ├── cnn_b_model.onnx # Material detection
220
- │ ├── unet_v1_resnet34.onnx # Segmentation
221
- │ └── cnn_a_export_metadata.json # Class names
222
- │
223
- ├── test_set/
224
- │ ├── mikro/ # Mikroskopis images
225
- │ └── makro/ # Makroskopis images
226
- │
227
- └── analysis_results/ # JSON outputs
228
- ```
229
 
230
  ---
231
 
232
- ## 🔧 Requirements
233
-
234
- **Python:** 3.11+
235
-
236
- **Key Dependencies:**
237
 
238
- - PyTorch 2.8.0
239
- - ONNX Runtime 1.23.2
240
- - FastAPI 0.115.5
241
- - Streamlit 1.41.0
242
- - OpenCV 4.10.0
243
- - Pillow 11.0.0
244
-
245
- See [requirements.txt](requirements.txt) for complete list.
246
 
247
  ---
248
 
249
- ## 📊 API Endpoints
250
-
251
- ### CNN-B API (Port 8000)
252
-
253
- **POST** `/predict`
254
-
255
- - **Input:** Image file (mikroskopis)
256
- - **Output:**
257
-
258
- ```json
259
- {
260
- "material": "Polypropylene",
261
- "confidence": 0.9736,
262
- "processing_time": 0.011
263
- }
264
- ```
265
-
266
- ### U-Net API (Port 8001)
267
-
268
- **POST** `/segment`
269
-
270
- - **Input:** Image file (makroskopis)
271
- - **Output:**
272
 
273
- ```json
274
- {
275
- "carpet_coverage": 100.0,
276
- "processing_time": 0.214
 
 
 
277
  }
278
  ```
279
-
280
- ### CNN-A API (Port 8002)
281
-
282
- **POST** `/predict`
283
-
284
- - **Input:** Image file (makroskopis)
285
- - **Output:**
286
-
287
- ```json
288
- {
289
- "predicted_class": "Asia",
290
- "confidence": 0.9885,
291
- "processing_time": 0.031
292
- }
293
- ```
294
-
295
- ---
296
-
297
- ## 🧪 Testing
298
-
299
- ### Test Database
300
-
301
- ```bash
302
- python database.py
303
- ```
304
-
305
- ### Test Backend API
306
-
307
- ```bash
308
- # Start backend first
309
- python deploy_all_models_onnx.py
310
-
311
- # Test endpoints
312
- curl http://localhost:8000/health
313
- curl http://localhost:8001/health
314
- curl http://localhost:8002/health
315
- ```
316
-
317
- ### Test Complete Pipeline
318
-
319
- ```bash
320
- python carpet_analysis_system.py test_set/mikro/pp1.jpg test_set/makro/a1.jpg
321
- ```
322
-
323
- **Expected Output:**
324
-
325
- - ✅ Material: Polypropylene (97.36%)
326
- - ✅ Jenis: Asia (98.85%)
327
- - ✅ AUTHENTIC
328
- - 💰 Harga: Rp 100,000 - Rp 200,000
329
-
330
- ---
331
-
332
- ## 🎓 Teknologi
333
-
334
- ### Deep Learning
335
-
336
- - **Framework:** PyTorch 2.8.0
337
- - **Optimization:** ONNX Runtime (7-8x faster inference)
338
- - **Models:** EfficientNet-B0, U-Net ResNet34
339
-
340
- ### Web Framework
341
-
342
- - **Backend:** FastAPI (async REST API)
343
- - **Frontend:** Streamlit (interactive web app)
344
- - **Server:** Uvicorn (ASGI)
345
-
346
- ### Database
347
-
348
- - **Engine:** SQLite3
349
- - **ORM:** Native Python sqlite3
350
- - **Features:** Views, Indexes, Foreign Keys
351
-
352
- ### Deployment
353
-
354
- - **Demo:** ngrok (HTTPS tunneling)
355
- - **Production:** Google Cloud Run
356
- - **Alternative:** Hugging Face Spaces
357
-
358
- ---
359
-
360
- ## 📈 Performance Benchmarks
361
-
362
- **Hardware:** RTX 5070 Ti Laptop (12GB VRAM)
363
-
364
- | Operation | Time (ONNX) | Time (PyTorch) | Speedup |
365
- | --------- | ----------- | -------------- | ------- |
366
- | CNN-B | 9.6ms | 150ms | 15.6x |
367
- | U-Net | 45.0ms | 250ms | 5.6x |
368
- | CNN-A | 29.0ms | 120ms | 4.1x |
369
- | **Total** | **~84ms** | **~520ms** | **~7x** |
370
-
371
- ---
372
-
373
- ## 🚨 Troubleshooting
374
-
375
- ### "Model not loaded"
376
-
377
- ```bash
378
- # Check ONNX files exist
379
- dir 06_Models\exports\*.onnx
380
- ```
381
-
382
- ### "Connection refused"
383
-
384
- ```bash
385
- # Ensure backend is running
386
- curl http://localhost:8000/health
387
- ```
388
-
389
- ### "Database locked"
390
-
391
- ```bash
392
- # Close other connections
393
- python database.py # Reinitialize
394
- ```
395
-
396
- ---
397
-
398
- ## 📞 Support
399
-
400
- - **Documentation:** See [SUMMARY.md](SUMMARY.md)
401
- - **Deployment:** See [DEPLOYMENT.md](host/DEPLOYMENT.md)
402
- - **Issues:** Check troubleshooting section above
403
-
404
- ---
405
-
406
- ## 📝 License
407
-
408
- © 2025 Carpet Analysis System
409
-
410
- ---
411
-
412
- ## 🙏 Acknowledgments
413
-
414
- - **PyTorch Team** for the deep learning framework
415
- - **ONNX** for cross-platform model optimization
416
- - **FastAPI** for modern REST API framework
417
- - **Streamlit** for rapid web app development
418
-
419
- ---
420
-
421
- **Built with ❤️ for carpet authentication and price estimation**
 
4
  - image-segmentation
5
  - image-classification
6
  tags:
7
+ - computer-vision
8
  - carpet-analysis
9
  - defect-detection
10
  - unet
11
  - sam2
12
+ - automated-inspection
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ---
14
 
15
+ # 🧵 Carpet Analysis & Defect Segmentation Dataset & Evaluation Pipelines
 
 
 
 
 
 
16
 
17
+ This repository provides the core metadata, evaluation benchmarks, masking logs, and training pipelines developed for automated carpet defect detection, material classification, and surface segmentation.
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  ---
20
 
21
+ ## 📌 Dataset Overview
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ * **Domain:** Computer Vision, Industrial Surface Inspection, Textile Quality Assurance.
24
+ * **Tasks:**
25
+ * **Carpet Defect & Surface Segmentation:** High-resolution boundary identification and coverage ratio estimation using U-Net and SAM 2.
26
+ * **Carpet Style Classification:** Automatic classification across various carpet styles (Asia, Malaysia, Mie, Persia, Polos, Sejadah).
27
+ * **Material Identification:** Detection of fiber types (Polypropylene, Nylon, Polyester).
28
+ * **Repository Contents:**
29
+ * `05_Metadata/`: Integration test benchmarks, masking logs, and statistical evaluations.
30
+ * `06_Models/`: Export metadata and deployment configuration specifications.
31
+ * `evaluation/`: Benchmark scripts, metrics calculations, and architectural summaries.
32
+ * `unet1/` & `unet2/`: Training configurations, transfer learning routines, and comparative performance logs.
33
+ * `sam/` & `sam2_models/`: Promptable segmentation logs and inference configurations.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  ---
36
 
37
+ ## 🔒 Privacy & Safety Compliance
38
 
39
+ This public dataset repository contains strictly sanitized code, benchmarking data, and evaluation metadata. All raw media recordings, store video footages, personal identifications, and confidential environment credentials have been completely purged to ensure full privacy compliance.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  ---
42
 
43
+ ## 🚀 Related Resources
 
 
 
 
44
 
45
+ * **Pre-trained ONNX Models:** [yosedie/carpet-analysis-api (Model Hub)](https://huggingface.co/yosedie/carpet-analysis-api)
46
+ * **Live Inference Space:** [yosedie/carpet-analysis-api (Space)](https://huggingface.co/spaces/yosedie/carpet-analysis-api)
47
+ * **Interactive API Documentation:** [https://yosedie-carpet-analysis-api.hf.space/docs](https://yosedie-carpet-analysis-api.hf.space/docs)
 
 
 
 
 
48
 
49
  ---
50
 
51
+ ## 📖 Citation & Usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ ```bibtex
54
+ @misc{carpet_analysis_system,
55
+ author = {yosedie},
56
+ title = {Carpet Analysis System: Automated Defect Detection and Material Classification},
57
+ year = {2026},
58
+ publisher = {Hugging Face},
59
+ howpublished = {\url{https://huggingface.co/datasets/yosedie/carpet-analysis-api}}
60
  }
61
  ```