Skip to content

Perform reverse image search on a database using a Siamese Network

License

Notifications You must be signed in to change notification settings

DSC-BVP/reversee

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReverSEE

CNN to recommend similar T-shirt's from the database

Dataset

Cannot put the URL for the dataset publicly, but you can email me if you are interested.

  • model/scraper/scraper.py to scrape the images
  • model/scraper/resize.py to crop them to 130x150 images

Training the model

  • It uses PyTorch with CUDA to train. If you don't have a GPU, replace all the .cuda() variables.

  • There are two different models, A regular CNN and a Siamese Network Model.

  • To use the Regular CNN

    • Use model/scraper/gen_classes.py to generate the labels for the model
    • Use model/train_cnn.py to train the model. Customize the batch size to what your GPU can accomodate.
      • parameters
        • --images_dir : Path with resized images
        • --batch_size : Training Batch Size
        • --epochs : No Of Epochs To Train For
        • --savefile : Save model with filename
        • --learnrate : Learning Rate
        • --labelfile : CSV Containing the labels
  • To use the Siamese Network

    • use model/train.py to train the model
      • parameters:
        • --images_dir : Path with resized images
        • --batch_size : Training Batch Size
        • --epochs : No Of Epochs To Train For
        • --learnrate : Learning Rate
        • --savefile : Save model with filename

Using the model

  • You can use the QueryTest.ipynb notebook for testing against images in the folder
  • You can use the test.ipynb for testing against images in the dataset
  • Use the Flask app (app/application.py) to access the trained model (model.h5) using the REST API
    • /api/match for the Siamese Network
    • /api/matchcnn for the Regular CNN

Using the REST API with the Siamese Network is not practical at the moment, because with a dataset of 10000 images it takes 100 seconds to find the top 10 matches.

Frontend

  • A frontend is present inside /docs to access the REST API (thanks @kautukkundan)
  • Also hosted on arush15june.github.io/reversee

Attributions

TODO

  • Siamese Network and CNN Comparison

About

Perform reverse image search on a database using a Siamese Network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 98.8%
  • Python 1.2%