This project implements a comprehensive product recommendation system for an e-commerce platform. The system utilizes multiple recommendation techniques including collaborative filtering, content-based filtering, hybrid approach, and an advanced multi-modal deep learning model to provide highly personalized product recommendations to users based on their purchase and browsing history.
- Collaborative Filtering: Recommends products based on the purchase behavior of similar users.
- Content-Based Filtering: Recommends products based on the attributes of the products the user has previously interacted with.
- Hybrid Approach: Combines collaborative and content-based filtering for more robust recommendations.
- Multi-Modal Deep Learning: Leverages product images, text descriptions, and user-item interactions using a sophisticated neural network architecture.
- User-Friendly Interface: A web application built with Flask for easy interaction and visualization of recommendations.
- Python: For backend logic and data processing.
- PyTorch: For building and training the multi-modal neural network model.
- Flask: Web framework for creating the web application.
- Pandas: For data manipulation and analysis.
- Sentence Transformers: For natural language processing of product descriptions.
- PyTorch Geometric: For graph-based neural network components.
- ResNet50: For image feature extraction.
- HTML/CSS: For frontend design.
The recommendation system consists of four main components:
-
Collaborative Filtering Module: Analyzes user purchase patterns to find similar users and recommend products they've purchased.
-
Content-Based Filtering Module: Analyzes product attributes (especially categories) and user browsing history to recommend similar products.
-
Hybrid Recommendation Module: Combines results from both collaborative and content-based approaches, with fallback to popular products when necessary.
-
Multi-Modal Deep Learning Model: A sophisticated neural network that processes:
- User embeddings
- Product embeddings
- Image features (using ResNet50 with fashion-specific optimizations)
- Text features (using Sentence Transformers)
- Graph-based relationships (using Graph Convolutional Networks)
- Python 3.x
- PyTorch
- Flask
- Pandas
- Sentence Transformers
- PyTorch Geometric
- Torchvision
- PIL
-
Clone the repository:
git clone <repository-url>
-
Navigate to the project directory:
cd er
-
Install the required packages:
pip install -r requirements.txt
-
Download the DeepFashion dataset from official website
-
Create a
datasets
directory in the project root:mkdir datasets
-
Extract the downloaded dataset into the
datasets
directory. The directory structure should look like:datasets/ ├── shape_ann/ ├── test_images/ └── train_images/
-
Place the following data files in the project root:
- users_expanded.csv
- products_expanded.csv
- product_images_expanded.csv
- purchases_expanded.csv
- browsing_history_expanded.csv
Note: The dataset files are not included in the repository due to their large size. Please download them separately.
-
Start the Flask server:
python app.py
-
Open your web browser and navigate to http://127.0.0.1:5000.
users_expanded.csv
: Contains user information.products_expanded.csv
: Contains product details such as name, category, description, price, and rating.product_images_expanded.csv
: Contains mappings between products and their image files.purchases_expanded.csv
: Contains user purchase history.browsing_history_expanded.csv
: Contains user browsing history.
The system uses fashion product images from the DeepFashion dataset, which includes various clothing items with multiple view angles (front, side, back, full). The multi-modal model is specifically optimized for fashion recommendations with view-aware processing.
- Enter a user ID and select a recommendation method (collaborative, content-based, hybrid, or multi-modal).
- Click on "Get Recommendations" to view the recommended products.
- The system will display both products the user has interacted with and new recommendations.
The multi-modal model (MultiModalModel
class) integrates multiple data sources:
- Collaborative Filtering Component: User and product embeddings.
- Image Processing Component: Fashion-optimized ResNet50 with view-type awareness (front, side, back, full views).
- Text Processing Component: Sentence transformer to encode product descriptions.
- Graph Component: Graph convolutional network for modeling product relationships.
- Fusion Layer: Combines all modalities for final recommendation scores.
If you would like to contribute to this project, please fork the repository and submit a pull request.
-
More Data: Plans to expand the dataset to enhance the model's recommendation capabilities.
-
Clean UI: Improving the user interface (UI) to enhance user experience and engagement.
-
Feedback Mechanism: Implement a way for users to provide feedback on the recommendations, which can help refine the system.
-
Explainability: Work on explaining the reasoning behind recommendations, which can enhance user trust and satisfaction.
-
Model Optimization: Fine-tune the multi-modal model for better performance and faster inference.
-
Additional Modalities: Incorporate more data sources such as user demographics and seasonal trends.