This repo cantains the training code used during Visual Similarity research at Fynd. One can easily reproduce our state of the art models MILDNet and Ranknet and 2 other research works from the past. 25 configs are present which constitutes configurations of most critical experiments by us.
For more details, refer to the Colab Notebook (execute training on Free GPUs or TPUs provided by Google in just 2 clicks) or head to our research papers on Arxiv:
We have also open-sourced 8 of our top experiment results with weights here. To analyze and compare all the results (training) head to this Colab notebook. To get an idea on using any of our open-sourced models models to find n similar items (inferencing) from your entire dataset head to this Colab notebook.
Visual Recommendation is a crucial feature for any ecommerce platform. It gives the platform power of instantly suggesting similar looking products to what a user is browsing, thus capturing his/her immediate intent which could result in higher customer engagment (CTR) and hence the conversion.
The task of identifying similar products is not trivial as the details concerned here (pattern, structure etc.) are complexely grained in the product image pixels and these product comes in various variety even within the same class. CNNs have showed great understanding and results in this task.
The base of such a system is a CNN extracting key features from product images and returning a vector respresenting those features. When these embeddings for all the products are mapped on an n-dimensional space, it places similar products closer to non-similar items. The nearest neighbours are then the top most visual similar items. Below diagram gives a brief overview:
We carried out various experiments to study the performace of 4 research works (including ours). 8 of those variants can be readily tested here by this notebook:
Based on this experiments, below is the list of all the configs available to try out:
Note that mildnet_contrastive.cnf and the Default Models configs are the models compared in the research paper.
execute.py: Single point entry for running training job on local or Google Cloud ML Engine. Asks user whether to run the training locally or on ML Engine. The user then need to select a config from a list of configs. Finally, the script executes gcloud.local.run.keras.sh if user selects to run locally or gcloud.remote.run.keras.sh if user selects to run on Google Cloud ML Engine. Make sure to setup settings.cfg if running on ML Engine.
MILDNet_on_Colab.ipynb: Google Colaboratory notebook, gives a brief introduction of the task. Also one can execute training in just 2 clicks: -- 1. Open notebook on google colab. -- 2. From menu select Runtime -> Run all
Make sure to have gsutil installed and the user to be logged in:
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud init
Install requirements:
pip install -r requirements-local-cpu.txt
pip install -r requirements-local-gpu.txt
Set below configs in settings.cfg:
Config for the job to be trained need to be added in job_config folder
Run python execute.py
Stream logs on terminal using:
gcloud ml-engine jobs stream-logs {{job_name}}
Check tensorboard of ongoing training using:
tensorboard --logdir=gs://fynd-open-source/research/MILDNet/top_jobs/{{job_name}} --port=8080
Hyperdash: Either use Hyperdash Website or Android App/iOS App to monitor logs.
Please read CONTRIBUTING.md and CONDUCT.md for details on our code of conduct, and the process for submitting pull requests to us.
Please see HISTORY.md. For the versions available, see the tags on this repository.
This project is licensed under the Apache License - see the LICENSE.txt file for details