Datasets:
Tasks:
Image Classification
Formats:
imagefolder
Size:
< 1K
Tags:
computer-vision
image-classification
carpet-analysis
textile-classification
material-identification
License:
Update Dataset Card to full English with privacy notices
Browse files3 unmodified lines4567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204213 unmodified lines- image-segmentation- image-classificationtags:- carpet-analysis- defect-detection- unet- sam2- computer-vision---# π§΅ Carpet Analysis System**Sistem AI untuk Analisis & Verifikasi Keaslian Karpet**[](https://www.python.org/)[](https://pytorch.org/)[](https://onnx.ai/)[](https://fastapi.tiangolo.com/)[](https://streamlit.io/)---## π DeskripsiSistem berbasis **Deep Learning** untuk menganalisis karpet dari gambar mikroskopis dan makroskopis, kemudian memverifikasi keaslian berdasarkan kombinasi material dan jenis karpet, serta memberikan estimasi harga.**Fitur Utama:**- π¬ **Material Detection**: Klasifikasi material (Polypropylene/Nylon/Polyester)- π¨ **Carpet Segmentation**: Segmentasi karpet untuk quality assessment- π·οΈ **Type Classification**: Klasifikasi jenis karpet (6 jenis)- β **Authentication**: Verifikasi keaslian berdasarkan kombinasi material+jenis- π° **Price Estimation**: Estimasi harga untuk karpet asli---## π― Arsitektur Sistem```ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ STREAMLIT FRONTEND ββ (Upload Images + Display Results) ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ FASTAPI BACKEND βββββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββββββββ€β CNN-B (8000) β U-Net (8001) β CNN-A (8002) ββ Material β Segmentation β Type ββ EfficientNet β ResNet34 β EfficientNet βββββββββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ SQLITE DATABASE ββ (Analysis History + Product Catalog) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ```---## π Quick Start### 1. Install Dependencies```bashpip install -r requirements.txt```### 2. Start Backend API```bashpython deploy_all_models_onnx.py```**Output:**- Port 8000: CNN-B (Material Classification)- Port 8001: U-Net (Carpet Segmentation)- Port 8002: CNN-A (Type Classification)### 3. Start Frontend```bashstreamlit run app.py```**Access:** http://localhost:8501---## π Model Performance| Model | Task | Architecture | Accuracy | Inference Time || --------- | ----------------------- | ---------------- | ---------- | -------------- || **CNN-B** | Material Classification | EfficientNet-B0 | 100% | ~10ms || **U-Net** | Carpet Segmentation | ResNet34 encoder | 88.66% IoU | ~45ms || **CNN-A** | Type Classification | EfficientNet-B0 | 95.45% | ~15ms |**Total Processing Time:** ~70ms per image (ONNX optimized)---## ποΈ Database Schema### Tabel: `analysis_history`Menyimpan semua hasil analisis karpet### Tabel: `carpet_products`6 produk karpet yang dijual:1. Asia Polypropylene (Rp 100K - 200K)2. Malaysia Polyester (Rp 200K - 500K)3. Mie Polypropylene (Rp 50K - 100K)4. Persia Nylon (Rp 400K - 800K)5. Polos Polypropylene (Rp 50K - 100K)6. Sejadah Nylon (Rp 600K - 950K)### Tabel: `suspicious_patterns`Log untuk fraud detection---## π‘ Cara Penggunaan### Via Web Interface (Streamlit)1. **Upload Images**- Mikroskopis: Gambar close-up serat karpet- Makroskopis: Gambar keseluruhan karpet2. **Analyze**- Klik tombol "ANALISIS SEKARANG"- Tunggu ~1 detik untuk hasil3. **View Results**- Material + confidence- Jenis + confidence- Status autentikasi (β Asli / π¨ Palsu)- Estimasi harga (jika asli)### Via CLI (Command Line)```bashpython carpet_analysis_system.py "mikro.jpg" "makro.jpg"```### Via API (REST)```pythonimport requests# Material Detectionresponse = requests.post("http://localhost:8000/predict",files={'file': open('mikro.jpg', 'rb')})print(response.json())# Type Classificationresponse = requests.post("http://localhost:8002/predict",files={'file': open('makro.jpg', 'rb')})print(response.json())```---## π Deployment### Option 1: ngrok (Demo - 2 Jam Session)```bash# Terminal 1: Backendpython deploy_all_models_onnx.py# Terminal 2: Frontendstreamlit run app.py# Terminal 3: Exposengrok http 8501```**Result:** Public HTTPS URL untuk demo!### Option 2: Google Cloud Run (Production 24/7)See [DEPLOYMENT.md](host/DEPLOYMENT.md) for detailed guide.**FREE TIER:** 2 juta request/bulan - GRATIS!---## π Struktur Folder```Dataset_Karpet_Skripsi/βββ deploy_all_models_onnx.py # Backend API (3 servers)βββ app.py # Frontend Streamlitβββ database.py # Database operationsβββ database_schema.sql # Database schemaβββ carpet_analysis_system.py # CLI versionβββ requirements.txt # Dependenciesβββ DEPLOYMENT.md # Deployment guideβββ SUMMARY.md # Complete documentationββββ 06_Models/exports/β βββ cnn_a_model.onnx # Type classificationβ βββ cnn_b_model.onnx # Material detectionβ βββ unet_v1_resnet34.onnx # Segmentationβ βββ cnn_a_export_metadata.json # Class namesββββ test_set/β βββ mikro/ # Mikroskopis imagesβ βββ makro/ # Makroskopis imagesββββ analysis_results/ # JSON outputs```---## π§ Requirements**Python:** 3.11+**Key Dependencies:**- PyTorch 2.8.0- ONNX Runtime 1.23.2- FastAPI 0.115.5- Streamlit 1.41.0- OpenCV 4.10.0- Pillow 11.0.0See [requirements.txt](requirements.txt) for complete list.---## π API Endpoints### CNN-B API (Port 8000)**POST** `/predict`- **Input:** Image file (mikroskopis)- **Output:**```json{"material": "Polypropylene","confidence": 0.9736,"processing_time": 0.011}```### U-Net API (Port 8001)**POST** `/segment`- **Input:** Image file (makroskopis)- **Output:**```json{"carpet_coverage": 100.0,"processing_time": 0.214}```### CNN-A API (Port 8002)**POST** `/predict`- **Input:** Image file (makroskopis)- **Output:**```json{"predicted_class": "Asia","confidence": 0.9885,"processing_time": 0.031}```---## π§ͺ Testing### Test Database```bashpython database.py```### Test Backend API```bash# Start backend firstpython deploy_all_models_onnx.py# Test endpointscurl http://localhost:8000/healthcurl http://localhost:8001/healthcurl http://localhost:8002/health```### Test Complete Pipeline```bashpython carpet_analysis_system.py test_set/mikro/pp1.jpg test_set/makro/a1.jpg```**Expected Output:**- β Material: Polypropylene (97.36%)- β Jenis: Asia (98.85%)- β AUTHENTIC- π° Harga: Rp 100,000 - Rp 200,000---## π Teknologi### Deep Learning- **Framework:** PyTorch 2.8.0- **Optimization:** ONNX Runtime (7-8x faster inference)- **Models:** EfficientNet-B0, U-Net ResNet34### Web Framework- **Backend:** FastAPI (async REST API)- **Frontend:** Streamlit (interactive web app)- **Server:** Uvicorn (ASGI)### Database- **Engine:** SQLite3- **ORM:** Native Python sqlite3- **Features:** Views, Indexes, Foreign Keys### Deployment- **Demo:** ngrok (HTTPS tunneling)- **Production:** Google Cloud Run- **Alternative:** Hugging Face Spaces---## π Performance Benchmarks**Hardware:** RTX 5070 Ti Laptop (12GB VRAM)| Operation | Time (ONNX) | Time (PyTorch) | Speedup || --------- | ----------- | -------------- | ------- || CNN-B | 9.6ms | 150ms | 15.6x || U-Net | 45.0ms | 250ms | 5.6x || CNN-A | 29.0ms | 120ms | 4.1x || **Total** | **~84ms** | **~520ms** | **~7x** |---## π¨ Troubleshooting### "Model not loaded"```bash# Check ONNX files existdir 06_Models\exports\*.onnx```### "Connection refused"```bash# Ensure backend is runningcurl http://localhost:8000/health```### "Database locked"```bash# Close other connectionspython database.py # Reinitialize```---## π Support- **Documentation:** See [SUMMARY.md](SUMMARY.md)- **Deployment:** See [DEPLOYMENT.md](host/DEPLOYMENT.md)- **Issues:** Check troubleshooting section above---## π LicenseΒ© 2025 Carpet Analysis System---## π Acknowledgments- **PyTorch Team** for the deep learning framework- **ONNX** for cross-platform model optimization- **FastAPI** for modern REST API framework- **Streamlit** for rapid web app development---**Built with β€οΈ for carpet authentication and price estimation**3 unmodified lines456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960613 unmodified lines- image-segmentation- image-classificationtags:- computer-vision- carpet-analysis- defect-detection- unet- sam2- automated-inspection---# π§΅ Carpet Analysis & Defect Segmentation Dataset & Evaluation PipelinesThis repository provides the core metadata, evaluation benchmarks, masking logs, and training pipelines developed for automated carpet defect detection, material classification, and surface segmentation.---## π Dataset Overview* **Domain:** Computer Vision, Industrial Surface Inspection, Textile Quality Assurance.* **Tasks:*** **Carpet Defect & Surface Segmentation:** High-resolution boundary identification and coverage ratio estimation using U-Net and SAM 2.* **Carpet Style Classification:** Automatic classification across various carpet styles (Asia, Malaysia, Mie, Persia, Polos, Sejadah).* **Material Identification:** Detection of fiber types (Polypropylene, Nylon, Polyester).* **Repository Contents:*** `05_Metadata/`: Integration test benchmarks, masking logs, and statistical evaluations.* `06_Models/`: Export metadata and deployment configuration specifications.* `evaluation/`: Benchmark scripts, metrics calculations, and architectural summaries.* `unet1/` & `unet2/`: Training configurations, transfer learning routines, and comparative performance logs.* `sam/` & `sam2_models/`: Promptable segmentation logs and inference configurations.---## π Privacy & Safety ComplianceThis 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.---## π Related Resources* **Pre-trained ONNX Models:** [yosedie/carpet-analysis-api (Model Hub)](https://huggingface.co/yosedie/carpet-analysis-api)* **Live Inference Space:** [yosedie/carpet-analysis-api (Space)](https://huggingface.co/spaces/yosedie/carpet-analysis-api)* **Interactive API Documentation:** [https://yosedie-carpet-analysis-api.hf.space/docs](https://yosedie-carpet-analysis-api.hf.space/docs)---## π Citation & Usage```bibtex@misc{carpet_analysis_system,author = {yosedie},title = {Carpet Analysis System: Automated Defect Detection and Material Classification},year = {2026},publisher = {Hugging Face},howpublished = {\url{https://huggingface.co/datasets/yosedie/carpet-analysis-api}}}```
README.md+30-390