This is the end-to-end implementation of image search engine. The image search engines allow us to retrive similar images based on the query one.
- Clone the repository, and navigate to the downloaded folder.
git clone https://github.com/lucko515/image-search-engine
-
Install TensorFlow.
- Option 1: To install TensorFlow with GPU support, follow the guide to install the necessary NVIDIA software on your system.
pip install tensorflow-gpu==1.12.0
- Option 2: To install TensorFlow with CPU support only,
pip install tensorflow==1.12.0
-
Install a few pip packages.
pip install -r requirements.txt
-
Download CIFAR-10 dataset.
1. Put downloaded data into dataset folder 2. Put all images from `dataset/train` to `static/images`
1. Preprocessed the dataset (not covered here) 2. Save each image in the jpg/png format into train/test folders 3. Rest of the project stays the same
-
Run throuh image-search project.ipynb and generate all necessary files
-
Start the app.py file and enjoy!
We could use color intesity to produce additional features and improve our image search engine. Good read for this: Pyimagesearch color histograms
The Flask approach works, but it is not scalable. If you want to create the system more scalable you will need to change the implementation to TensorFlow Serving.
The updated version of files are in the folder.
How to server the model using the TensorFlow serving: tutorial
1. Put folder `models` inside the root dir
2. replace all files in the root to make this project use TensorFlow Serving
NOTE:
If you have the following error:
Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.
The potential solution is to downgrade your TensorFlow version to 1.4.0.