FashionAI Documentation
Learn how to use the AI-powered clothing detection system with YOLOv8 deep learning.
About FashionAI
FashionAI is an AI-powered clothing detection system that uses YOLOv8 deep learning to detect and classify clothing items in images. It can identify 8 different types of clothing and classify their colors into 8 color categories.
The system is built with a modern tech stack including PyTorch for deep
learning,
FastAPI for the backend API, and a responsive web interface for easy
interaction.
Quick Start
1. Install Dependencies
Navigate to the backend directory and install required packages:
cd backend
pip install -r requirements.txt
2. Add Models
Place the trained models in the models/ folder:
cloth_classifier.pt- Clothing detection modelcolor_classifier.pt- Color classification model
3. Run Backend
cd backend
uvicorn app.main:app --reload --port 8000
4. Open Frontend
cd frontend
python -m http.server 5500
Then open http://127.0.0.1:5500 in your browser.
How to Use
Image Upload
- Go to the App page
- Click on the upload area or drag and drop an image
- Adjust the confidence threshold if needed (default: 25%)
- Click "Detect Clothing" button
- View results with bounding boxes and classifications
Live Camera
- Go to the App page
- Click the "Live Camera" tab
- Allow camera access when prompted
- Choose between Capture Mode (take photo) or Live Detection (real-time)
- View detection results in real-time
Supported Classes
The model can detect and classify the following 8 clothing types:
Color Classification
Each detected clothing item is also classified by its dominant color:
API Reference
The backend exposes a REST API for clothing detection:
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check with model status |
/detect |
POST | Detect clothing in uploaded image |
/detect/batch |
POST | Batch detection for multiple images |
/classes |
GET | List supported clothing classes |
Example Response
{
"success": true,
"detections": [
{
"className": "Tshirt",
"confidence": 0.95,
"bbox": [100, 100, 200, 200],
"color": "blue",
"colorConfidence": 0.87,
"colorHex": "#3B82F6",
"label": "Blue Tshirt"
}
]
}
Deployment
HuggingFace Spaces
Deploy to HuggingFace Spaces using Gradio:
- Create a new Space with Gradio SDK
- Upload files from
deployment/huggingface/ - Upload both model files (
.pt) - Your app will be live automatically!
Docker
Build and run with Docker:
docker build -t fashionai .
docker run -p 8000:8000 fashionai
notebooks/cloth_detection_training.ipynb.
Works best with Google Colab and T4 GPU.