A Hierarchical-Learning based Reverse Image Search Engine for humans.
Hierarchical modules:
- Classification
- Transfer Learning based feature generator
You can install Conda for python which resolves all the dependencies for machine learning.
pip install -r requirements.txt
Reverse image search (or as it is more technically known, instance retrieval) enables developers and researchers to build scenarios beyond simple keyword search. From discovering visually similar objects on Pinterest to recommending similar songs on Spotify to camera-based product search on Amazon, a similar class of technology under the hood is used. This is inspired by the following modules
- Image Similarity
- Feature Extraction
- Similarity Search
Currently, I have used the Caltech 101 Dataset. In this dataset, we have pictures of objects belonging to 101 categories. About 40 to 800 images per category and most categories have about 50 images. However, the learnings from this can be extrapolated for domain specific datasets.
Elasticsearch has been used as a search engine. Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Specifically, this pipeline uses dense_vactor
field in elasticsearch. A dense_vector
field stores dense vectors of float values.
βββ VisualSearch (Current Directory)
βββ data : Data folder
βββ a
βββ 1.png
βββ 2.png
.
.
βββ b
.
.
βββ z
βββ models : Trained classifier model
βββ classifier.h5 : classifier model
βββ resources : resources folder
βββ src : Source code
βββ classifier
βββ Classifier.py
βββ elasticsearch
βββ ElasticSearch.py
βββ pretrained
βββ PretrainedFactory.py
βββ ResNet50.py
βββ utils
βββ utils.py
βββ VisualSearch.py : Driving class
βββ application.yaml : yaml properties
βββ LICENSE
βββ requirements.txt
βββ readme.md
- Classifier : Training on pretrained - ResNet50 for classifying
- Feature Extractor : Pretrained ResNet50 for feature extraction
- Search Engine : Elasticsearch as a search engine
If you face any problem, kindly raise an issue
- The pipeline is setup to be a one-click program.
- Configure the
application.yaml
file - Run
VisualSearch.py
to run the application.
python3 VisualSearch.py -yml application.yaml