shakewingo / furniture-recommender-system

An end-to-end development of living room furniture recommender system based on both text and image Latent Dirichlet Allocation (LDA)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Living Room Furniture Recommender System

This is an end-to-end development of living room furniture recommender system. The repo contains three parts: web scraping from furniture.ca, recommender system algorithm and a local web application via flask.

Environment Setup

The project is written in macOS arm64, for virtual env setup and tensorflow installed on Mac M1: please carefully refer tensorflow_macos, then after the below env is activated, you'll have to downgrade pillow conda install pillow=8.2.0, downgrade h5py pip install h5py==2.10.0

conda env update --file environment.yml

conda env update --file environment_engine.yml

Part I: Web Scraping

export ROOT=your furniture-recommender-system root path 
conda activate furniture-recommender
  1. python Algorithm/pdt_link_scraper.py to get all product links for living room furnitures. Expect to have file product_links.json generated in root path.
  2. python Algorithm/pdt_info_scraper.py to obtain all product attributes such as name, image, price, description. Expect to have Meta_org folder and Furniture.csv generated in root path.
  • After step 2, you can run python Algorithm/test.py to count categories.

Note that, the above steps could really take 1-2 whole days to finish. The original meta data run on Jun 2020 has 2953 product images and 2904 product records in csv. You can obtain it by running on your own or contact me yaoyingshakewin@gmail.com for a cleaned up version in order to replicate the rest study.

Part II: Multivariant LDA Recommender Algorithm

  1. Prerequisite: finish part I or have Meta_org folder and furniture.csv ready
  2. conda activate furniture-recommender
  3. jupyter lab
  4. Open Algorithm/furniture_recommender_algorithm.ipynb and run

Note that, the recommendation method is based on extracting both text attributes and image features from pre-trained ResNet50 model and then use them to create the bag of words and fit in LDA topic modelling. References:

Part III: Web Application

  1. Prerequisite: can run directly from this repo or finish part II
export FLASK_APP=run.py
export FLASK_ENV=development
conda activate furniture-recommender-engine
cd Engine
flask dropDB
flask createDB
flask importDB
flask run

You should be able to find link such as http://127.0.0.1:5000/ to open. And Bang! It's done!

Note that, the web template is forked from https://github.com/MathMagicx/MediumFlaskImageRecommender

Recommender System Demo

Furniture.Recommender.System.Demo.mp4

About

An end-to-end development of living room furniture recommender system based on both text and image Latent Dirichlet Allocation (LDA)


Languages

Language:Jupyter Notebook 65.4%Language:Python 21.6%Language:CSS 7.3%Language:HTML 4.8%Language:JavaScript 0.9%