Skip to content

riyanshibariyaa/Fashion-Recognition-Recommendation-System-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fashion Recognition & Recommendation System 👗🤖

An AI-powered clothing recognition and recommendation system that identifies fashion items in images and suggests similar products using deep learning and computer vision techniques.

🌟 Features

  • Image Recognition: Identify clothing items from uploaded imagess
  • Smart Recommendations: Get 5 similar fashion items based on visual similarity
  • Deep Learning Backend: Powered by ResNet50 for accurate feature extraction
  • User-Friendly Interface: Clean Streamlit web application
  • Real-time Processing: Fast image analysis and recommendation generation
  • Scalable Architecture: Easy to extend with more fashion categories

🚀 Demo

Upload an image of any clothing item and instantly receive personalized recommendations of similar fashion products from the database.

🛠️ Technology Stack

  • Deep Learning: TensorFlow, Keras
  • Computer Vision: OpenCV, PIL
  • Machine Learning: scikit-learn (Nearest Neighbors)
  • Web Framework: Streamlit
  • Data Processing: NumPy, Pandas
  • Model: ResNet50 (pre-trained on ImageNet)

📋 Prerequisites

  • Python 3.7+
  • TensorFlow 2.x
  • CUDA-compatible GPU (recommended for faster processing)

🔧 Installation

  1. Clone the repository

    git clone https://github.com/yourusername/fashion-recognition-recommendation-system.git
    cd fashion-recognition-recommendation-system
  2. Create virtual environment

    python -m venv fashion_env
    source fashion_env/bin/activate  # On Windows: fashion_env\Scripts\activate
  3. Install dependencies

    pip install tensorflow streamlit opencv-python scikit-learn numpy pillow tqdm
  4. Create required directories

    mkdir images uploads sample

📁 Project Structure

fashion-recognition-recommendation-system/
│
├── app.py                 # Feature extraction and model training
├── main.py               # Streamlit web application
├── test.py               # Testing and validation script
├── README.md             # Project documentation
├── requirements.txt      # Python dependencies
│
├── images/               # Dataset directory (add your fashion images here)
├── sample/               # Sample test images
├── uploads/              # Temporary upload directory
│
├── embeddings.pkl        # Extracted feature vectors (generated)
├── filenames.pkl         # Image file paths (generated)
└── models/               # Saved model files (optional)

🚀 Usage

Step 1: Prepare Your Dataset

  1. Add fashion images to the images/ directory
  2. Organize images by categories (optional but recommended)
  3. Supported formats: JPG, PNG, JPEG

Step 2: Extract Features

Run the feature extraction script to process your dataset:

python app.py

This will:

  • Load the ResNet50 model
  • Extract features from all images in the images/ directory
  • Save feature vectors to embeddings.pkl
  • Save file paths to filenames.pkl

Step 3: Launch the Web Application

Start the Streamlit web interface:

streamlit run main.py

Step 4: Test Individual Images (Optional)

Test with specific images using the test script:

python test.py

🎯 How It Works

1. Feature Extraction Pipeline

  • Input: Fashion images in various formats
  • Processing: ResNet50 CNN extracts 2048-dimensional feature vectors
  • Normalization: Features are normalized using L2 norm
  • Storage: Features saved as pickle files for quick access

2. Similarity Matching

  • Algorithm: K-Nearest Neighbors with Euclidean distance
  • Process: Compare uploaded image features with database
  • Output: Top 5 most similar fashion items

3. Web Interface

  • Upload: Simple drag-and-drop interface
  • Processing: Real-time feature extraction
  • Display: Visual grid of recommendations

📊 Model Performance

  • Feature Extraction: ResNet50 (ImageNet pre-trained)
  • Feature Dimension: 2048
  • Similarity Metric: Euclidean Distance
  • Recommendation Speed: ~1-2 seconds per query
  • Accuracy: Depends on dataset quality and diversity

🔧 Configuration

Model Parameters

# Adjust in main.py and app.py
INPUT_SHAPE = (224, 224, 3)
N_NEIGHBORS = 6  # Returns top 5 (excluding input image)
SIMILARITY_METRIC = 'euclidean'

Streamlit Configuration

# Customize UI elements in main.py
st.set_page_config(
    page_title="Fashion Recommender",
    page_icon="👗",
    layout="wide"
)

🤝 Contributing

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

🐛 Known Issues & Solutions

Common Problems:

  1. Memory Error during feature extraction

    • Solution: Process images in smaller batches
    • Reduce image resolution if needed
  2. Slow recommendations

    • Use GPU acceleration
    • Consider using approximate nearest neighbors (Annoy, Faiss)
  3. Poor recommendations

    • Ensure diverse, high-quality dataset
    • Consider fine-tuning ResNet50 on fashion data

📈 Future Enhancements

  • Add clothing category classification
  • Implement color and pattern filtering
  • Add user feedback loop for improved recommendations
  • Support for multiple clothing items in single image
  • Mobile app version
  • Integration with e-commerce APIs
  • Advanced filtering (price, brand, size)

🙏 Acknowledgments

  • ResNet50 architecture by Microsoft Research
  • TensorFlow team for the excellent framework
  • Streamlit team for the intuitive web framework
  • Fashion dataset contributors

⭐ Show Your Support

Give a ⭐️ if this project helped you!


Built with ❤️ using Python and Deep Learning