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.
- 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
Upload an image of any clothing item and instantly receive personalized recommendations of similar fashion products from the database.
- 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)
- Python 3.7+
- TensorFlow 2.x
- CUDA-compatible GPU (recommended for faster processing)
-
Clone the repository
git clone https://github.com/yourusername/fashion-recognition-recommendation-system.git cd fashion-recognition-recommendation-system -
Create virtual environment
python -m venv fashion_env source fashion_env/bin/activate # On Windows: fashion_env\Scripts\activate
-
Install dependencies
pip install tensorflow streamlit opencv-python scikit-learn numpy pillow tqdm
-
Create required directories
mkdir images uploads sample
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)
- Add fashion images to the
images/directory - Organize images by categories (optional but recommended)
- Supported formats: JPG, PNG, JPEG
Run the feature extraction script to process your dataset:
python app.pyThis 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
Start the Streamlit web interface:
streamlit run main.pyTest with specific images using the test script:
python test.py- 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
- Algorithm: K-Nearest Neighbors with Euclidean distance
- Process: Compare uploaded image features with database
- Output: Top 5 most similar fashion items
- Upload: Simple drag-and-drop interface
- Processing: Real-time feature extraction
- Display: Visual grid of recommendations
- 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
# Adjust in main.py and app.py
INPUT_SHAPE = (224, 224, 3)
N_NEIGHBORS = 6 # Returns top 5 (excluding input image)
SIMILARITY_METRIC = 'euclidean'# Customize UI elements in main.py
st.set_page_config(
page_title="Fashion Recommender",
page_icon="👗",
layout="wide"
)- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
-
Memory Error during feature extraction
- Solution: Process images in smaller batches
- Reduce image resolution if needed
-
Slow recommendations
- Use GPU acceleration
- Consider using approximate nearest neighbors (Annoy, Faiss)
-
Poor recommendations
- Ensure diverse, high-quality dataset
- Consider fine-tuning ResNet50 on fashion data
- 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)
- ResNet50 architecture by Microsoft Research
- TensorFlow team for the excellent framework
- Streamlit team for the intuitive web framework
- Fashion dataset contributors
Give a ⭐️ if this project helped you!
Built with ❤️ using Python and Deep Learning