Pastec.io is an OSS feature recognition project that provides an http interface to train and search for matches.
Get pastec:
$ git clone [email protected]:Visu4link/pastec.git && cd pastec
Get dependencies:
$ brew install homebrew/science/opencv jsoncpp libmicrohttpd
Build:
$ mkdir build && cmake ../ && make
Get "visual words" datafile:
$ curl http://pastec.io/files/visualWordsORB.tar.gz | tar xvz
Run:
$ ./pastec -p 4242 visualWordsORB.dat
Add an image:
$ curl -X PUT --data-binary @/path/to/img.jpg http://localhost:4242/index/images/23
{
"image_id" : 23,
"type" : "IMAGE_ADDED"
}
Remove an image:
$ curl -X DELETE http://localhost:4242/index/images/23
{
"image_id" : 23,
"type" : "IMAGE_REMOVED"
}
Search:
$ curl -X POST --data-binary @/home/test/img/request.jpg http://localhost:4242/index/searcher
{
"filepath":"./3107100095036_002.jpg",
"rects":{"height":636,"width":421,"x":43,"y":62},
"score":42
}
Save index:
curl -X POST -d '{"type":"WRITE", "index_path":"training-index.dat"}' http://localhost:4242/index/io
{
"type" : "INDEX_WRITTEN"
}
Load index:
curl -X POST -d '{"type":"LOAD", "index_path":"training-index.dat"}' http://localhost:4242/index/io
{
"type" : "INDEX_LOADED"
}
Clear index:
$ curl -X POST -d '{"type":"CLEAR"}' http://localhost:4242/index/io
{"type":"INDEX_CLEARED"}
- interactions are all over http, downstream of user-facing app
- web app needs to assign indexes & prevent id collisions