Skip to content

adi-devv/Flickd-AI-Hackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ₯ Flickd - AI-Powered Fashion Detection and Matching

Python Version License YOLOv8 CLIP

AI-powered fashion detection and matching system for Flickd

πŸ“‹ Overview

This project is developed for Flickd Hackathon, a new-age fashion app that brings AI-powered fashion detection to your fingertips. The system enhances Flickd's capabilities by:

  • Automatically detecting fashion items in user-uploaded videos
  • Matching detected items with similar products from Flickd's catalog
  • Analyzing fashion styles and vibes to provide personalized recommendations
  • Enabling seamless product discovery and shopping experiences

Built with cutting-edge AI technologies, this system helps Flickd users discover fashion items they love, find similar products, and get style recommendations - all through the power of computer vision and natural language processing.

πŸ› οΈ Technologies Used

  • Python 3.8+ β€” Core programming language
  • YOLOv8 (Ultralytics) β€” State-of-the-art object detection
  • OpenAI CLIP β€” Vision-language model for product matching
  • FAISS β€” Efficient similarity search and indexing
  • PyTorch β€” Deep learning framework
  • OpenCV β€” Image and video processing
  • Pandas β€” Data manipulation and analysis
  • NumPy β€” Numerical computing
  • scikit-learn β€” Machine learning utilities
  • FastAPI β€” API development (for serving models)
  • Jupyter Notebook β€” Experimentation and model training
  • Matplotlib/Seaborn β€” Visualization (for analysis and plots)
  • Requests β€” HTTP requests for image downloads
  • jsonschema β€” Output validation

✨ Key Features

🎯 Core Capabilities

  • Video Processing

    • Intelligent frame extraction
    • High-performance video analysis
    • Batch processing support
  • Fashion Detection

    • YOLOv8-based object detection
    • Multi-class fashion item recognition
    • Real-time processing capabilities
  • Product Matching

    • CLIP embeddings for semantic matching
    • FAISS indexing for fast similarity search
    • Smart caching system
  • Style Analysis

    • Vibe classification
    • Color analysis
    • Style matching

πŸš€ Getting Started

Prerequisites

  • Python 3.8 or higher
  • CUDA-capable GPU (recommended)
  • Git

Installation

  1. Clone the Repository

    git clone https://github.com/adi-devv/Flickd-AI-Hackathon.git
    cd Flickd-AI-Hackathon
  2. Set Up Virtual Environment

    # Create virtual environment
    python -m venv venv
    
    # Activate virtual environment
    # On Windows:
    venv\Scripts\activate
    # On Unix or MacOS:
    source venv/bin/activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Download YOLOv8 Model

    wget https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m.pt

πŸ“ Project Structure

Flickd/
β”œβ”€β”€ main.py                      # Main processing script
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ cache/
β”‚   β”‚   β”œβ”€β”€ cache_metadata.pkl
β”‚   β”‚   β”œβ”€β”€ faiss_index.bin
β”‚   β”‚   β”œβ”€β”€ product_info.pkl
β”‚   β”‚   └── product_id_to_indices.pkl
β”‚   β”œβ”€β”€ product_data.csv
β”‚   └── images.csv
β”œβ”€β”€ detected_frames/
β”‚   └── detected_frame_*.jpg
β”œβ”€β”€ cropped_frames/
β”‚   └── crop_frame_*_*.jpg
β”œβ”€β”€ frames/
β”‚   └── frame_*.jpg
β”œβ”€β”€ outputs/
β”‚   β”œβ”€β”€ output_*.json
β”‚   └── vibe_*.json
β”œβ”€β”€ models/
β”‚   └── yolov8m.pt
β”œβ”€β”€ api/
β”‚   └── app.py
β”œβ”€β”€ dataset/
β”‚   └── fashion_dataset/
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ data.yaml
└── .gitignore

Key Components

  • main.py: Core processing script that handles video analysis, object detection, and product matching
  • data/: Contains all data-related files and caches
    • cache/: Stores precomputed embeddings and indices for faster processing
    • product_data.csv: Product catalog with details like type, description, and tags
    • images.csv: Image URLs and metadata for product matching
  • detected_frames/: Contains frames with detection bounding boxes
  • cropped_frames/: Contains individual cropped fashion items from detected frames
    • Files are named as crop_frame_[frame_number]_[item_class].jpg
  • outputs/: JSON files containing detection results and style classifications
  • models/: Contains the YOLOv8 model weights
  • api/: API implementation for serving the model
  • dataset/: Training and validation datasets
  • data.yaml: Configuration file for model parameters and paths

πŸ’» Usage

Basic Usage

python main.py \
    --video_path path/to/video.mp4 \
    --images_csv path/to/images.csv \
    --product_data_csv path/to/products.csv \
    --caption "Your video caption" \
    --video_id "unique_id" \
    --output_json_path path/to/output.json

Input Requirements

  • Video File: MP4 format recommended
  • Product Catalog: CSV files with required fields
  • Optional: Vibe taxonomy for classification

Output Format

The system generates:

  • Visual Outputs

    • Detected frames with bounding boxes
    • Annotated video frames
  • JSON Output

    {
      "detections": [
        {
          "item": "dress",
          "confidence": 0.95,
          "matches": [...],
          "vibe": "casual"
        }
      ]
    }

⚑ Performance

  • Speed

    • Fast frame processing
    • Efficient similarity search
    • Optimized caching
  • Accuracy

    • High-precision detection
    • Semantic matching
    • Style classification

Model Training Details

Model Performance

Training Results

Training Results Training metrics over epochs showing mAP, precision, recall, and loss

Confusion Matrix

Confusion Matrix Confusion matrix showing model's classification performance

Precision-Recall Curves

PR Curves Precision-Recall curves for different confidence thresholds

Validation Results

Validation Batch Example validation batch showing model predictions

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

AI pipeline for fashion item detection in video reels, utilizing a fine-tuned YOLOv8 model that achieved 82.9% [email protected] and 52% mAP@[0.5:0.95] on 10 fashion categories.

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors