- This will be a simple guide to set things up so that you can contribute to this project.
- As of now everything will run locally and the paths are absolute. So you may face some issues but we have tried our best to make this proof of concept modular and easy to build upon.
This README is focused on simple image indexer and some suggestions to improve the current state.
-
We have used
PostgreSQL 11.5.1
which is a powerful, open source object-relational database system. This is currently holding the results created by the indexer. To download PostgreSQL click here. -
It's recommended to use Anaconda Distribution for Python. If you don't have one, download from this from here. Create a conda environment.
conda create -n vison
-
We have used
flask
to build python server.flask_wtf
is used as a flask extension toWTforms
library. Install the following packages.pip install flask pip install flask_wtf
-
psycopg2
is used as PostgreSQL database adapter for the Python programming language.pip install psycopg2
-
Since the images are indexed we need to detect the objects in that image. For this we built a custom detection module. For this to work without error. Make sure to have the following frameworks/libraries installed.
tensorflow >= 1.13.1 keras >= 2.2.4 openCV >= 3.4.1 imutils >= 0.5.2
To install them do the following. (It would be best if you use anaconda. We love anaconda.)
pip install tensorflow pip install keras pip install opencv-python / conda install opencv
-
The
YOLO
object detection is using this pretrained weights on 80 classes. Download the following zip file from here. Once it's downloaded doextract to this folder
and copy the folder namedyolo-coco
toindexer/yolo
. -
The most important thing to an image indexer is image itself. We used Google's open image dataset extended. Download the dataset from here. Download
set 1
along withimage id's
andimage labels
. In theindexImages.py
script make sure to change the path to images.
We have tried listing all the requirements. In case something is left out do raise an issue. We will add that to the README.
-
Once everything is ready. Fire your PostgreSQL server. Name the database as
vision_demo_indexdb
. Go toindexer/postgresqlDB
and runtestConnection.py
. You will encounter an error while establishing your connection with PostgreSQL. Open the script and change the password in the 4th line of the script. This password is the one which you were asked to set while installing PostgreSQL. Make sure to change the password in all the subsequent scripts. (Sorry for inconvenience. I will create a friendly module to save you from this hassle.) -
Run
createTableAddCol.py
. This will create the table namedimage_index
and will add all the classes that yolo is trained on as the column toimage_index
. -
Go to
indexer/yolo
and runindexImages.py
. To do so use the following command line commandpython indexImages.py -y yolo-coco -b False
. Make sure to change the image path to the downloaded dataset. (imgPath
) Your database will be populated with data. -
Finally run
app.py
. To do so use the following commandpython app.py -y yolo-coco -b False
. This will fire your flask server. Go to your browser and typelocalhost:5000
on the URL box. You will find a simple form. -
Type in something like
person
orcat
ortoothbrush
and you may get dummy links like.
- Advance indexing algorithm. Advance query algorithm need to be developed or implemented.
- Expose the indexer with endpoints.
Happy Searching :D