Classify Images with DeepDetect
DeepDetect and SearchBlox together allow you to classify images using machine learning. JSON REST API is used to connect DeepDetect to SearchBlox
DeepDetect
DeepDetect is a deep learning API and server written in C++11. It makes state-of-the-art deep learning easy to work with and integrate into existing applications.
For more details on DeepDetect and installation procedure please refer to:
http://www.deepdetect.com/overview/introduction/
http://www.deepdetect.com/overview/installing/
Integrating with SearchBlox
The steps to connect DeepDetect to SearchBlox are provided below:
- Create custom collection in SearchBlox.
- Follow the steps for setting up an image classifier listed here: http://www.deepdetect.com/tutorials/imagenet-classifier/
- DeepDetect and SearchBlox use the same port 8080, so start DeepDetect with
./dede -port 8888
in order to avoid conflict. - Tag and index a URL image in a single call. There are two options:
a. indexing categories as keywords:
curl -XPOST "http://localhost:8888/predict" -d '{"service":"imageserv","parameters":{"mllib":{"gpu":true},"input":{"width":224,"height":224},"output":{"best":3,"template":"{\"apikey\":\"D96FB202C5907C6C8488DF2A87CD9182\",\"document\":{\"colname\":\"dd\",{{#body}}{{#predictions}} \"url\":\"{{uri}}\",\"uid\":\"{{uri}}\",\"alpha\":\"string\",\"title\":\"{{uri}}\",\"keywords\": \"{{#classes}} {{cat}}, {{/classes}}\" {{/predictions}}{{/body}},\"meta\":{} }}","network":{"url":"http://localhost:8080/searchblox/rest/v1/api/add","http_method":"POST"}}},"data":["http://i.ytimg.com/vi/0vxOhd4qlnA/maxresdefault.jpg"]}'
b. indexing categories and scores into meta:
curl -XPOST "http://localhost:8888/predict" -d '{"service":"imageserv","parameters":{"mllib":{"gpu":true},"input":{"width":224,"height":224},"output":{"best":3,"template":"{\"apikey\":\"D96FB202C5907C6C8488DF2A87CD9182\",\"document\":{\"colname\":\"dd\",{{#body}}{{#predictions}} \"url\":\"{{uri}}\",\"uid\":\"{{uri}}\",\"alpha\":\"string\",\"title\":\"{{uri}}\",\"meta\":{\"categories\": [ {{#classes}} { \"category\":\"{{cat}}\",\"score\":{{prob}} } {{^last}},{{/last}}{{/classes}} ]} {{/predictions}}{{/body}} }}","network":{"url":"http://localhost:8080/searchblox/rest/v1/api/add","http_method":"POST"}}},"data":["http://i.ytimg.com/vi/0vxOhd4qlnA/maxresdefault.jpg"]}'
Updated almost 5 years ago