Skip to content

Instantly share code, notes, and snippets.

@aaronbuchanan
Last active May 10, 2017 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronbuchanan/6fef80d01e22705c115f6db65a9d8deb to your computer and use it in GitHub Desktop.
Save aaronbuchanan/6fef80d01e22705c115f6db65a9d8deb to your computer and use it in GitHub Desktop.
Pastec notes

Pastec.io is an OSS feature recognition project that provides an http interface to train and search for matches.

Setup on a Mac

Get pastec:

$ git clone git@github.com: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"}

Notes

  • interactions are all over http, downstream of user-facing app
  • web app needs to assign indexes & prevent id collisions

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment