How To Set Up Your Own Local Image Search Engine in Minutes

--

Some weeks ago, we released the Free Plan of our visual search engine. Today, we’re going to show how you can create your own local image search engine using pixolution Flow. It’s a great way to visually explore your image collection or play around with visual search to advance a project idea.

If the terms Python and Docker don’t shock you and you’ve opened a terminal before, then this tutorial is for you. You should have basic technical knowledge, but even with little knowledge, a little courage might be enough to successfully fire up your image search engine. ;-)

Let’s begin.

Big Data Jobs

Step 1: Download the free version of pixolution Flow

The free version of pixolution Flow, our visual image search engine based on Apache Solr, is packaged as a Docker image. You need a working Python 3.8 environment and a recent version of Docker installed.

To download and run pixolution Flow from Docker Hub:

docker pull pixolution/flow
docker run -p8983:8983 pixolution/flow

To test the running instance, we provide a repo with Python example code which gets you started quickly. Clone this Git repo:

git clone https://github.com/pixolution/flow-examples.git

We recommend creating a new Python virtual environment to have a clean installation of the examples and prevent dependency conflicts.

python3 -m venv flow-examples/venv

Go to project root and activate the virtual environment:

cd flow-examples
source venv/bin/activate

Upgrade pip and install the python dependencies:

pip3 install --upgrade pip
pip3 install -r requirements.txt

Trending AI Articles:

1. Why Corporate AI projects fail?

2. How AI Will Power the Next Wave of Healthcare Innovation?

3. Machine Learning by Using Regression Model

4. Top Data Science Platforms in 2021 Other than Kaggle

Step 2: Choose your own images or web images

Next, define your image collection. You can go with your local images or you can use web images. When you choose web images we have a little guidance for you: Use an image scraper to download images from DuckDuckGo (please consider the image licenses depending on the image usage).

Clone the repo:

git clone https://github.com/pixolution/image-scraper.git

Again, create a virtual environment:

cd image-scraper
python3 -mvenv venv

Enter virtual environment and install requirements:

source venv/bin/activate
pip3 install --upgrade pip
pip3 install -r requirements.txt

Then, search and download images with a given keyword (e.g. autumn):

python3 scrape-images.py
What do you want:
autumn
Number of images?
100

The images are saved in the image-scraper folder:

image-scraper
├── autumnimgs
│ ├── 0.jpg
│ ├── 1.jpg
│ ├── 2.jpg
│ └── ...
├── ...

We repeat this with some other keywords to build a useful image collection fitting our needs. In our case we want to build a seasonal autumn collection with e.g. leaves, pumpkins, apples, grapes. Now, our image collection is complete.

Step 3: Index your images into pixolution Flow

Next, we need to index the images into pixolution Flow. With the free version you can index up to 5,000 images. Index your downloaded images using the script of the flow-examples project:

python3 add_images.py /path/to/image-scraper/

The script scans the folder tree, collects all .jpg, .png and .gif image files and indexes them to pixolution Flow. Depending on your hardware and the number of images the indexing process may take some time.

Step 4: Start searching your image collection

When all images are indexed, you can start exploring the image collection using our similarity search. We have built an HTML search interface that you can open locally in your browser. This is an excellent way to view the visual search results via UI.

Display similar images from your scraped image collection (images found via DuckDuckGo. Images are used only for this presentation purpose).

The UI allows you to randomly display your images, filter for images with empty areas, search by color and search by image to find similar ones. The HTML search interface provides a functional and visual example of the pixolution Flow API. Just open the HTML file of the flow-examples project in your browser:

chromium flow-examples/ui/index.html
firefox flow-examples/ui/index.html

Or simply paste the absolute file path of ui/index.html in your browser. Now, enjoy your image search engine and tell us about your experience. We’re always curious to learn about your own visual search projects.

And if you feel like needing more guidance, please check out our detailed Readme on GitHub.

Originally published on https://pixolution.org/blog.

Don’t forget to give us your 👏 !

--

--

Self-hosted AI image search & custom AI solutions. We turn data into actions, ultimately increasing workflow efficiency and productivity.