This project is a Fashion Recommender System that recommends visually similar fashion styles based on a user-uploaded image. It leverages a pre-trained ResNet50 model to extract image features and find the most relevant matches from a dataset.
- Pre-trained Model: Uses ResNet50 for feature extraction.
- Efficient Search: Finds the top 5 most similar images using the Nearest Neighbors algorithm.
- Interactive UI: Provides an easy-to-use Streamlit interface for uploading images and viewing recommendations.
- Extracts features from dataset images.
- Saves the precomputed embeddings (
embeddings.pkl
) and filenames (filenames.pkl
).
- Implements the Streamlit interface.
- Loads precomputed embeddings and filenames for efficient recommendations.
- Provides a recommendation system based on user-uploaded images.
-
Feature Extraction:
- Images are resized to
224x224
and preprocessed using ResNet50. - Extracted features are normalized using L2 norm.
- Images are resized to
-
Recommendation:
- The Nearest Neighbors algorithm (Euclidean distance) identifies the closest matches.
-
Display:
- Displays the uploaded image and top 5 similar images in a grid layout.
- Python 3.8.10
- A TensorFlow-compatible environment
-
Clone the Repository:
git clone <repository-url> cd <repository-folder>
-
Create a Virtual Environment:
python -m venv env
Activate the environment:
- Windows:
.\env\Scripts\activate
- Mac/Linux:
source env/bin/activate
- Windows:
-
Install Dependencies:
pip install -r requirements.txt
-
Precompute Embeddings (Optional):
- If embeddings need to be regenerated:
python app.py
- If embeddings need to be regenerated:
-
Run the Application:
streamlit run main.py
- Upload a fashion image using the file uploader in the Streamlit app.
- View the uploaded image alongside the top 5 most similar styles from the dataset.
The project dependencies are listed in requirements.txt
:
numpy
tensorflow
streamlit
Pillow
scikit-learn
tqdm
Install them with:
pip install -r requirements.txt