menu_book Documentation

FashionAI Documentation

Learn how to use the AI-powered clothing detection system with YOLOv8 deep learning.

info 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.

lightbulb
Key Features
Real-time detection, webcam support, color classification, and high accuracy with YOLOv8n.

rocket_launch Quick Start

1. Install Dependencies

Navigate to the backend directory and install required packages:

Bash
cd backend
pip install -r requirements.txt

2. Add Models

Place the trained models in the models/ folder:

  • cloth_classifier.pt - Clothing detection model
  • color_classifier.pt - Color classification model

3. Run Backend

Bash
cd backend
uvicorn app.main:app --reload --port 8000

4. Open Frontend

Bash
cd frontend
python -m http.server 5500

Then open http://127.0.0.1:5500 in your browser.

tips_and_updates
Pro Tip
You can also use VS Code Live Server extension for automatic reload during development.

touch_app How to Use

Image Upload

  1. Go to the App page
  2. Click on the upload area or drag and drop an image
  3. Adjust the confidence threshold if needed (default: 25%)
  4. Click "Detect Clothing" button
  5. View results with bounding boxes and classifications

Live Camera

  1. Go to the App page
  2. Click the "Live Camera" tab
  3. Allow camera access when prompted
  4. Choose between Capture Mode (take photo) or Live Detection (real-time)
  5. View detection results in real-time
warning
Camera Access
Camera access requires HTTPS or localhost. Direct file:// URLs won't work.

category Supported Classes

The model can detect and classify the following 8 clothing types:

๐Ÿ‘• T-Shirt
๐Ÿ‘— Dress
๐Ÿงฅ Jacket
๐Ÿ‘– Pants
๐Ÿ‘” Shirt
๐Ÿฉณ Shorts
๐ŸŽฝ Skirt
๐Ÿงถ Sweater

palette Color Classification

Each detected clothing item is also classified by its dominant color:

Beige
Black
Blue
Gray
Green
Pattern
Red
White

api 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

JSON
{
  "success": true,
  "detections": [
    {
      "className": "Tshirt",
      "confidence": 0.95,
      "bbox": [100, 100, 200, 200],
      "color": "blue",
      "colorConfidence": 0.87,
      "colorHex": "#3B82F6",
      "label": "Blue Tshirt"
    }
  ]
}

cloud_upload Deployment

HuggingFace Spaces

Deploy to HuggingFace Spaces using Gradio:

  1. Create a new Space with Gradio SDK
  2. Upload files from deployment/huggingface/
  3. Upload both model files (.pt)
  4. Your app will be live automatically!

Docker

Build and run with Docker:

Bash
docker build -t fashionai .
docker run -p 8000:8000 fashionai
tips_and_updates
Model Training
Train your own models using the Jupyter notebook in notebooks/cloth_detection_training.ipynb. Works best with Google Colab and T4 GPU.