├── .gitignore ├── .idea ├── .gitignore ├── Deep-Object-Search-With-Hash.iml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── Demo_Video ├── Screenshot from query_result.mp4 - 3.png ├── Shotwell query_result.mp4 - 3.jpg └── test.txt ├── LICENSE ├── README.md ├── create_folder.py ├── lshash ├── PCA_Discrete.py ├── __init__.py ├── lshash.py ├── lshash_2.py ├── lshash_2_py3.py ├── storage.py └── utils.py ├── objFeature └── features_vgg-19 │ └── features_vgg-19.npy ├── objSr ├── bin │ ├── activate │ ├── activate.csh │ ├── activate.fish │ ├── chardetect │ ├── easy_install │ ├── easy_install-3.6 │ ├── estimator_ckpt_converter │ ├── f2py │ ├── f2py3 │ ├── f2py3.6 │ ├── flask │ ├── freeze_graph │ ├── google-oauthlib-tool │ ├── imageio_download_bin │ ├── imageio_remove_bin │ ├── markdown_py │ ├── pip │ ├── pip3 │ ├── pip3.6 │ ├── pyrsa-decrypt │ ├── pyrsa-encrypt │ ├── pyrsa-keygen │ ├── pyrsa-priv2pub │ ├── pyrsa-sign │ ├── pyrsa-verify │ ├── pytesseract │ ├── python │ ├── python3 │ ├── python3.6 │ ├── range-detector │ ├── saved_model_cli │ ├── skivi │ ├── tensorboard │ ├── tf_upgrade_v2 │ ├── tflite_convert │ ├── toco │ ├── toco_from_protos │ └── wheel ├── lib64 ├── pyvenv.cfg └── share │ ├── doc │ └── networkx-2.4 │ │ ├── LICENSE.txt │ │ ├── examples │ │ ├── 3d_drawing │ │ │ ├── README.txt │ │ │ └── mayavi2_spring.py │ │ ├── README.txt │ │ ├── advanced │ │ │ ├── README.txt │ │ │ ├── plot_eigenvalues.py │ │ │ ├── plot_heavy_metal_umlaut.py │ │ │ ├── plot_iterated_dynamical_systems.py │ │ │ └── plot_parallel_betweenness.py │ │ ├── algorithms │ │ │ ├── README.txt │ │ │ ├── hartford_drug.edgelist │ │ │ ├── plot_beam_search.py │ │ │ ├── plot_blockmodel.py │ │ │ ├── plot_davis_club.py │ │ │ ├── plot_krackhardt_centrality.py │ │ │ └── plot_rcm.py │ │ ├── basic │ │ │ ├── README.txt │ │ │ ├── plot_properties.py │ │ │ └── plot_read_write.py │ │ ├── drawing │ │ │ ├── README.txt │ │ │ ├── chess_masters_WCC.pgn.bz2 │ │ │ ├── knuth_miles.txt.gz │ │ │ ├── lanl_routes.edgelist │ │ │ ├── plot_atlas.py │ │ │ ├── plot_chess_masters.py │ │ │ ├── plot_circular_tree.py │ │ │ ├── plot_degree_histogram.py │ │ │ ├── plot_degree_rank.py │ │ │ ├── plot_directed.py │ │ │ ├── plot_edge_colormap.py │ │ │ ├── plot_ego_graph.py │ │ │ ├── plot_four_grids.py │ │ │ ├── plot_giant_component.py │ │ │ ├── plot_house_with_colors.py │ │ │ ├── plot_knuth_miles.py │ │ │ ├── plot_labels_and_colors.py │ │ │ ├── plot_lanl_routes.py │ │ │ ├── plot_node_colormap.py │ │ │ ├── plot_random_geometric_graph.py │ │ │ ├── plot_sampson.py │ │ │ ├── plot_simple_path.py │ │ │ ├── plot_spectral_grid.py │ │ │ ├── plot_unix_email.py │ │ │ ├── plot_weighted_graph.py │ │ │ └── unix_email.mbox │ │ ├── graph │ │ │ ├── README.txt │ │ │ ├── dot_atlas.py │ │ │ ├── plot_degree_sequence.py │ │ │ ├── plot_erdos_renyi.py │ │ │ ├── plot_expected_degree_sequence.py │ │ │ ├── plot_football.py │ │ │ ├── plot_karate_club.py │ │ │ ├── plot_napoleon_russian_campaign.py │ │ │ ├── plot_roget.py │ │ │ ├── plot_words.py │ │ │ ├── roget_dat.txt.gz │ │ │ └── words_dat.txt.gz │ │ ├── javascript │ │ │ ├── README.txt │ │ │ ├── force.py │ │ │ └── force │ │ │ │ ├── README.txt │ │ │ │ ├── force.css │ │ │ │ ├── force.html │ │ │ │ └── force.js │ │ ├── jit │ │ │ ├── README.txt │ │ │ └── plot_rgraph.py │ │ ├── pygraphviz │ │ │ ├── README.txt │ │ │ ├── plot_pygraphviz_attributes.py │ │ │ ├── plot_pygraphviz_draw.py │ │ │ ├── plot_pygraphviz_simple.py │ │ │ └── plot_write_dotfile.py │ │ └── subclass │ │ │ ├── README.txt │ │ │ ├── plot_antigraph.py │ │ │ └── plot_printgraph.py │ │ └── requirements.txt │ └── python-wheels │ ├── CacheControl-0.11.7-py2.py3-none-any.whl │ ├── appdirs-1.4.3-py2.py3-none-any.whl │ ├── certifi-2018.1.18-py2.py3-none-any.whl │ ├── chardet-3.0.4-py2.py3-none-any.whl │ ├── colorama-0.3.7-py2.py3-none-any.whl │ ├── distlib-0.2.6-py2.py3-none-any.whl │ ├── distro-1.0.1-py2.py3-none-any.whl │ ├── html5lib-0.999999999-py2.py3-none-any.whl │ ├── idna-2.6-py2.py3-none-any.whl │ ├── ipaddress-0.0.0-py2.py3-none-any.whl │ ├── lockfile-0.12.2-py2.py3-none-any.whl │ ├── packaging-17.1-py2.py3-none-any.whl │ ├── pip-9.0.1-py2.py3-none-any.whl │ ├── pkg_resources-0.0.0-py2.py3-none-any.whl │ ├── progress-1.2-py2.py3-none-any.whl │ ├── pyparsing-2.2.0-py2.py3-none-any.whl │ ├── requests-2.18.4-py2.py3-none-any.whl │ ├── retrying-1.3.3-py2.py3-none-any.whl │ ├── setuptools-39.0.1-py2.py3-none-any.whl │ ├── six-1.11.0-py2.py3-none-any.whl │ ├── urllib3-1.22-py2.py3-none-any.whl │ ├── webencodings-0.5-py2.py3-none-any.whl │ └── wheel-0.30.0-py2.py3-none-any.whl ├── object_detection_YOLO.py ├── requirements.txt └── start.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | /venv/ 7 | /temp/ 8 | objFeature/ 9 | /Cropped_Images/ 10 | 11 | *.npy 12 | # C extensions 13 | *.so 14 | 15 | # Distribution / packaging 16 | .Python 17 | build/ 18 | develop-eggs/ 19 | dist/ 20 | downloads/ 21 | eggs/ 22 | .eggs/ 23 | lib/ 24 | lib64/ 25 | parts/ 26 | sdist/ 27 | var/ 28 | wheels/ 29 | pip-wheel-metadata/ 30 | share/python-wheels/ 31 | *.egg-info/ 32 | .installed.cfg 33 | *.egg 34 | MANIFEST 35 | 36 | # PyInstaller 37 | # Usually these files are written by a python script from a template 38 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 39 | *.manifest 40 | *.spec 41 | 42 | # Installer logs 43 | pip-log.txt 44 | pip-delete-this-directory.txt 45 | 46 | # Unit test / coverage reports 47 | htmlcov/ 48 | .tox/ 49 | .nox/ 50 | .coverage 51 | .coverage.* 52 | .cache 53 | nosetests.xml 54 | coverage.xml 55 | *.cover 56 | *.py,cover 57 | .hypothesis/ 58 | .pytest_cache/ 59 | 60 | # Translations 61 | *.mo 62 | *.pot 63 | 64 | # Django stuff: 65 | *.log 66 | local_settings.py 67 | db.sqlite3 68 | db.sqlite3-journal 69 | 70 | # Flask stuff: 71 | instance/ 72 | .webassets-cache 73 | 74 | # Scrapy stuff: 75 | .scrapy 76 | 77 | # Sphinx documentation 78 | docs/_build/ 79 | 80 | # PyBuilder 81 | target/ 82 | 83 | # Jupyter Notebook 84 | .ipynb_checkpoints 85 | 86 | # IPython 87 | profile_default/ 88 | ipython_config.py 89 | 90 | # pyenv 91 | .python-version 92 | 93 | # pipenv 94 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 95 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 96 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 97 | # install all needed dependencies. 98 | #Pipfile.lock 99 | 100 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 101 | __pypackages__/ 102 | 103 | # Celery stuff 104 | celerybeat-schedule 105 | celerybeat.pid 106 | 107 | # SageMath parsed files 108 | *.sage.py 109 | 110 | # Environments 111 | .env 112 | .venv 113 | env/ 114 | venv/ 115 | ENV/ 116 | objSr/ 117 | env.bak/ 118 | venv.bak/ 119 | 120 | # Spyder project settings 121 | .spyderproject 122 | .spyproject 123 | 124 | # Rope project settings 125 | .ropeproject 126 | 127 | # mkdocs documentation 128 | /site 129 | 130 | # mypy 131 | .mypy_cache/ 132 | .dmypy.json 133 | dmypy.json 134 | 135 | # Pyre type checker 136 | .pyre/ 137 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/Deep-Object-Search-With-Hash.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <<<<<<< HEAD 6 | 7 | 8 | 9 | 10 | 13 | ======= 14 | 15 | 16 | 17 | >>>>>>> 6c2bc56858d0b33ff9dfe8ced594253f2a9a0289 18 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 122 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | <<<<<<< HEAD 4 | 5 | ======= 6 | 7 | >>>>>>> 6c2bc56858d0b33ff9dfe8ced594253f2a9a0289 8 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Demo_Video/Screenshot from query_result.mp4 - 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/munnafaisal/Deep-Object-Search-With-Hash/b8840f55289ede2f442f7420d6960d58b539ed60/Demo_Video/Screenshot from query_result.mp4 - 3.png -------------------------------------------------------------------------------- /Demo_Video/Shotwell query_result.mp4 - 3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/munnafaisal/Deep-Object-Search-With-Hash/b8840f55289ede2f442f7420d6960d58b539ed60/Demo_Video/Shotwell query_result.mp4 - 3.jpg -------------------------------------------------------------------------------- /Demo_Video/test.txt: -------------------------------------------------------------------------------- 1 | text 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Faisal Ahmed Siddiqi, Anis-Ul-Islam Rafid 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deep-Object-Search-With-Hash 2 | 3 | ## A Short Description Of Project 4 | 5 | This repo contains an object search mechanism with hashing techniques using deep features of available pretrained object detection models. It can detect multiple objects from a given video then read features of those objects from a chosen feature extractor. Afterwards those features are transformed into hash codes using LSH(Locality Sensitive Hashing) technique and indexed into a python “Dictionary”.Finally for a given video it takes objects from the video as a query image and displays the close matched images which features have been previously indexed with hash codes. 6 | 7 | ![Test Image](https://github.com/munnafaisal/Deep-Object-Search-With-Hash/blob/master/Demo_Video/Shotwell%20%20query_result.mp4%20-%203.jpg) 8 | 9 | ## Demo Video Link 10 | 11 | [click here](https://youtu.be/Cxnqk-bWPCc) 12 | 13 | ## Acknowledgements 14 | 15 | To learn more about LSH(Locality Sensitive Hashing) 16 | 17 | visit: 18 | 19 | https://github.com/kayzhu/LSHash 20 | 21 | and 22 | 23 | https://github.com/pixelogik/NearPy 24 | 25 | 26 | ## Environment Setup: 27 | 28 | 29 | ### Installation instructions 30 | 31 | _Run the commands in a terminal or command-prompt. 32 | 33 | - Install `Python 3.6 or >3.6` for your operating system, if it does not already exist. 34 | 35 | - For [Mac](https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg) 36 | 37 | - For [Windows](https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe) 38 | 39 | - For Ubuntu/Debian 40 | 41 | ```bash 42 | sudo apt-get install python3.6 43 | ``` 44 | 45 | Check if the correct version of Python (3.6) is installed. 46 | 47 | ```bash 48 | python --version 49 | ``` 50 | 51 | **Make sure your terminal is at the root of the project i.e. where 'README.md' is located.** 52 | 53 | * Get `virtualenv`. 54 | 55 | ```bash 56 | pip install virtualenv 57 | ``` 58 | 59 | * Create a virtual environment named `.env` using python `3.6` and activate the environment. 60 | 61 | ```bash 62 | # command for gnu/linux systems 63 | virtualenv -p $(which python3.6) .env 64 | 65 | source .env/bin/activate 66 | ``` 67 | * If any error occurs to install a virtual environment you can see this [link](https://github.com/anisrfd/Python-Virtualenv-Setup/blob/master/Python_virtualenv_setup.md) 68 | 69 | 70 | * Install python dependencies from requirements.txt. 71 | ```bash 72 | pip install -r requirements.txt 73 | ``` 74 | 75 | 76 | ## How to run 77 | 78 | After installing all the required libraries run the following commands in the terminal. The details of required input parameters have been described in the following section. 79 | 80 | 81 | 82 | * Step 1: 83 | First run object detection script from terminal using following command 84 | 85 | ```bash 86 | python object_detection_YOLO.py --video_dir