Penguni commited on
Commit
070d178
·
1 Parent(s): f0e8b42

Upload 6 files

Browse files
Files changed (6) hide show
  1. .gitignore +2 -0
  2. Dockerfile +23 -0
  3. LICENSE +21 -0
  4. Procfile +1 -0
  5. README.md +35 -11
  6. requirements.txt +28 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ config/
2
+ .DS_Store
Dockerfile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # start with a base image
2
+ FROM ubuntu:16.04
3
+
4
+ # install dependencies
5
+ RUN apt-get update
6
+ RUN apt-get install -y python python-pip
7
+ RUN apt-get install -y libglib2.0-0
8
+
9
+ # Copy the current directory contents into the container
10
+ COPY . .
11
+
12
+ # Install any needed packages specified in requirements.txt
13
+ RUN pip install --trusted-host pypi.python.org -r requirements.txt
14
+
15
+ # Make port 8000 available outside this container
16
+ EXPOSE 8000
17
+
18
+ # Set the working directory to /app
19
+ WORKDIR app
20
+
21
+ # run script to generate image histogram from DB
22
+ # Run app.py when the container launches
23
+ CMD ["gunicorn", "-b", "0.0.0.0:8000", "app:app"]
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Kene Udeh
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.
Procfile ADDED
@@ -0,0 +1 @@
 
 
1
+ web: cd app && gunicorn app:app
README.md CHANGED
@@ -1,11 +1,35 @@
1
- ---
2
- title: Image Search Engine
3
- emoji: 🐨
4
- colorFrom: purple
5
- colorTo: blue
6
- sdk: docker
7
- pinned: false
8
- license: other
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Image-Search-Engine
2
+ Content-Based Image Retrieval System Implemented Using Python, Flask And OpenCV.
3
+ * Given a query image, this app returns other images from database in order of similar color content.
4
+ * Uses a color histogram to define the color content of an image, uses chi-squared distance to determine
5
+ how similar two image histograms are.
6
+
7
+ ## Usage Guide
8
+ 1. To use a different image dataset (optional)
9
+ * Populate image DB in `app/static/images`
10
+ * Then in Terminal:
11
+ ```bash
12
+ >> python3 -m venv venv
13
+ >> source venv/bin/activate
14
+ >> pip install -r requirements.txt
15
+ >> cd app
16
+ >> python index.py --dataset static/images --index index.csv
17
+ ```
18
+
19
+ 2. Run locally using Docker
20
+ * Install [Docker](https://docs.docker.com/install/#supported-platforms)
21
+ * Then in Terminal:
22
+ ```bash
23
+ >> docker build --tag=imagesearch .
24
+ >> docker run -p 80:8000 imagesearch
25
+ ```
26
+ * You should be able to access app at `localhost:80` in browser
27
+
28
+
29
+ ### Sources
30
+ * [pyimagesearch.com](https://www.pyimagesearch.com/start-here-learn-computer-vision-opencv/)
31
+ * [flask docs](http://flask.pocoo.org)
32
+ * [content-based image retrieval](https://en.wikipedia.org/wiki/Content-based_image_retrieval)
33
+
34
+
35
+ Project was made possible thanks to the many guides provided by [@Adrian Rosebrock](https://twitter.com/pyimagesearch) on [pyimagesearch.com](https://www.pyimagesearch.com/start-here-learn-computer-vision-opencv/)
requirements.txt ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ appdirs==1.4.0
2
+ certifi==2018.8.24
3
+ click==6.7
4
+ cloudpickle==0.8.0
5
+ cycler==0.10.0
6
+ dask==1.1.4
7
+ decorator==4.0.11
8
+ Flask==1.0.2
9
+ gunicorn==19.7.0
10
+ itsdangerous==0.24
11
+ Jinja2>=2.10.1
12
+ MarkupSafe==1.0
13
+ matplotlib==2.0.0
14
+ networkx==1.11
15
+ numpy==1.12.0
16
+ olefile==0.44
17
+ opencv-contrib-python==3.3.0.9
18
+ packaging==16.8
19
+ Pillow==6.2.0
20
+ pyparsing==2.1.10
21
+ python-dateutil==2.6.0
22
+ pytz==2016.10
23
+ PyWavelets==1.0.2
24
+ scikit-image==0.14.2
25
+ scipy==0.19.0
26
+ six==1.10.0
27
+ toolz==0.8.2
28
+ Werkzeug==0.15.3