The Image Plugin is an Content Based Image Retrieval Plugin for Elasticsearch using LIRE (Lucene Image Retrieval). It allows users to index images and search for similar images.
It adds an image
field type and an image
query
See http://demo.elasticsearch-image.com for a demo of the plugin
In order to install the plugin, simply run: bin/plugin -install com.github.kzwang/elasticsearch-image/1.2.0
.
Image Plugin | elasticsearch | Release date |
---|---|---|
1.3.0-SNAPSHOT (master) | 1.1.0 | |
1.2.0 | 1.0.1 | 2014-03-20 |
1.1.0 | 1.0.1 | 2014-03-13 |
1.0.0 | 1.0.1 | 2014-03-05 |
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 image
. Mandatory
feature
is a map of features for index. Mandatory, at least one is required
hash
can be set if you want to search on hash. Optional
metadata
is a map of metadata for index, only those metadata will be indexed. See Metadata. Optional
curl -XPOST 'localhost:9200/test/test' -d '{
"my_img": "... base64 encoded 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 image to search. Optional if search using existing image
hash
should be 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
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 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 are 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
Images are processed by Java ImageIO, supported formats can be found here
Additional formats can be supported by ImageIO plugins, for example TwelveMonkeys
AUTO_COLOR_CORRELOGRAM
, BINARY_PATTERNS_PYRAMID
, CEDD
, SIMPLE_COLOR_HISTOGRAM
, COLOR_LAYOUT
, EDGE_HISTOGRAM
, FCTH
, GABOR
, JCD
, JOINT_HISTOGRAM
, JPEG_COEFFICIENT_HISTOGRAM
, LOCAL_BINARY_PATTERNS
, LUMINANCE_LAYOUT
, OPPONENT_HISTOGRAM
, PHOG
, ROTATION_INVARIANT_LOCAL_BINARY_PATTERNS
, SCALABLE_COLOR
, TAMURA
Hash will increase search speed with large data sets
See Large image data sets with LIRE ?some new numbers
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 |
- Use multi-thread when multiple features are required to improve index speed
- Allow index metadata
- Allow query by existing image in index
- Added
limit
inimage
query - Added plugin version in es-plugin.properties
- initial release