elasticsearch image search engine

elasticsearch image search engine

Rate this article

Share this article

Content-Based Image Retrieval Plugin for Elasticsearch. It allows users to index images and search for similar images. http://demo.elasticsearch-image.com/

The Image Plugin is a Content-Based Image Retrieval Plugin for Elasticsearch using LIRE (Lucene Image Retrieval). It allows users to index images and search for similar images.

elasticsearch image search engine

It adds a image field type and a image query

See http://demo.elasticsearch-image.com for a demo of the plugin

To install the plugin, simply run:

bin/plugin -install com.github.kzwang/elasticsearch-image/1.2.0

Example

Create Mapping

curl -XPUT 'localhost:9200/test/test/_mapping' -d '{
    "test": {
        "properties": {
            "my_img": {
                "type": "image",
                "feature": {
                    "CEDD": {
                        "hash": "BIT_SAMPLING"
                    },
                    "JCD": {
                        "hash": ["BIT_SAMPLING", "LSH"]
                    },
                    "FCTH": {}
                },
                "metadata": {
                    "jpeg.image_width": {
                        "type": "string",
                        "store": "yes"
                    },
                    "jpeg.image_height": {
                        "type": "string",
                        "store": "yes"
                    }
                }
            }
        }
    }
}'

type should be imageMandatory

feature is a map of features for index. Mandatory, at least one is required

hash can be set if you want to search on the hash. Optional

metadata is a map of metadata for the index, only those metadata will be indexed. See MetadataOptional

Index Image

curl -XPOST 'localhost:9200/test/test' -d '{
    "my_img": "... base64 encoded image ..."
}'

Search Image

curl -XPOST 'localhost:9200/test/test/_search' -d '{
    "query": {
        "image": {
            "my_img": {
                "feature": "CEDD",
                "image": "... base64 encoded image to search ...",
                "hash": "BIT_SAMPLING",
                "boost": 2.1,
                "limit": 100
            }
        }
    }
}'

feature should be one of the features in the mapping. Mandatory

image base64 of the image to search. Optional if search using existing image

hash should be the same to the hash set in mapping. Optional

limit limit the number of results returned (per shard) for scoring. Optional, only works when hash is specified

boost score boost Optional

Search Image using the existing image in the index

curl -XPOST 'localhost:9200/test/test/_search' -d '{
    "query": {
        "image": {
            "my_img": {
                "feature": "CEDD",
                "index": "test",
                "type": "test",
                "id": "image1",
                "path": "my_image",
                "hash": "BIT_SAMPLING"
            }
        }
    }
}'

index the index to fetch the image from. Default to current index. Optional

type the type to fetch image from. Mandatory

id the id of the document to fetch image from. Mandatory

path the field specified as path to fetch image from. Mandatory

routing a custom routing value to be used when retrieving the external image doc. Optional

 

Metadata

Metadata is extracted using metadata-extractor. See SampleOutput for some examples of metadata.

The field name in index will be directory.tag_name, all lower case and space becomes underscore(_). e.g. if the Directory is JPEG and Tag Name is Image Height, the field name will be jpeg.image_height

Supported Image Formats

Images are processed by Java ImageIO, supported formats can be found here

Additional formats can be supported by ImageIO plugins, for example TwelveMonkeys

Supported Features

AUTO_COLOR_CORRELOGRAMBINARY_PATTERNS_PYRAMIDCEDDSIMPLE_COLOR_HISTOGRAMCOLOR_LAYOUTEDGE_HISTOGRAMFCTHGABORJCDJOINT_HISTOGRAMJPEG_COEFFICIENT_HISTOGRAMLOCAL_BINARY_PATTERNSLUMINANCE_LAYOUTOPPONENT_HISTOGRAMPHOGROTATION_INVARIANT_LOCAL_BINARY_PATTERNSSCALABLE_COLORTAMURA

Supported Hash Mode

BIT_SAMPLINGLSH

Hash will increase search speed with large data sets

See Large image data sets with LIRE ?some new numbers

Settings

Setting Description Default
index.image.use_thread_pool use multiple thread when multiple features are required True
index.image.ignore_metadata_error ignore errors happened during extract metadata from image True

 

You can also create your own image search engine using expertrec. (price- 9 USD Per month)

  1. Go to image search engine creator.
  2. Enter your website URL.
  3. Choose your nearest data center.
  4. Enable image search to on.
  5. Initiate crawl.
  6. Check out your image search demo.
  7. Take live.

Sign Up for ExpertRec

Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like