magwyz / pastec Goto Github PK
View Code? Open in Web Editor NEWImage recognition open source index and search engine
Home Page: http://pastec.io
License: GNU Lesser General Public License v3.0
Image recognition open source index and search engine
Home Page: http://pastec.io
License: GNU Lesser General Public License v3.0
I trace the code to see what is going on but cannot understand what really ransac does here. Could someone explain to me ?
Don't you think it is better to use larger values for image_id. I like to ought this change but what parts of the code depended to that change? Any help would be great.
I have seen that no loop is used around a call of the function "pthread_cond_wait".
Would you like to reuse anything from my message on the topic "spurious wakeup"?
Hey there, first of all - thanks for the awesome tool, i tried using the pastec via docker image and it turned out to be great for a very specific task - matching images.
However i found that its hard to scale pastec server under load. What that mean is - there are always multiple write and read operation, where write is making a PUT
request to index a new image and read being a search operation for a user-generated image. My current setup is pretty simple, 8GB ram droplet on DigitalOcean with 10 write workers that are constantly adding images and a few search workers that actually perform similarity searches.
I havent dug into the codebase, but from what i see right now it looks like that backend is being very slow when running search queries during the "inserts". In the setup i described above it takes approximately 12-16 seconds to run a single search query, with user provided image being ~ 50kb, 300px wide.
So my question is pretty simple - how does one scale out pastec? I know there's a paid offering on the website, but i was wondering if there's something could be done before moving onto paid plain.
Sometimes it will crash on my server (ubuntu 16.04). And there is nothing log to show why it crash..
hope you can give me some hints.
Hello,
on debian sid with libjsoncpp-dev 1.6.5 installed cmake doesn't find it:
- Could NOT find libjsoncpp (missing: LIBJSONCPP_INCLUDE_DIR)
Looking at the cmake module it looks like it's looking for libjsoncpp but here it's called jsoncpp:
$ pkg-config --cflags jsoncpp
-I/usr/include/jsoncpp
Tried cooking this patch but does not help:
diff --git a/cmake/Modules/Findjsoncpp.cmake b/cmake/Modules/Findjsoncpp.cmake
index 4857396..c0dfbce 100644
--- a/cmake/Modules/Findjsoncpp.cmake
+++ b/cmake/Modules/Findjsoncpp.cmake
@@ -6,12 +6,12 @@
# LIBJSONCPP_DEFINITIONS - Compiler switches required for using libjsoncpp
find_package(PkgConfig)
-pkg_check_modules(PC_LIBJSONCPP QUIET libjsoncpp)
+pkg_check_modules(PC_LIBJSONCPP QUIET jsoncpp)
set(LIBJSONCPP_DEFINITIONS ${PC_LIBJSONCPP_CFLAGS_OTHER})
find_path(LIBJSONCPP_INCLUDE_DIR json.h
HINTS ${PC_LIBJSONCPP_INCLUDEDIR} ${PC_LIBJSONCPP_INCLUDE_DIRS}
- PATH_SUFFIXES libjsoncpp)
+ PATH_SUFFIXES jsoncpp)
find_library(LIBJSONCPP_LIBRARY jsoncpp
HINTS ${PC_LIBJSONCPP_LIBDIR} ${PC_LIBJSONCPP_LIBRARY_DIRS} )
Would you like to wrap any pointer data members with the template class "std::unique_ptr"?
Update candidates:
Hi,
Very cool software!
Is it possible to make a search where the image recognition is only used to compare a single entry in the index? The only answers can be same image or different images. It would be a cool feature!
Hi,
I have 2 errors :
1/ test.dat exist (created by api -> Save Index)
Input: pastec -i test.dat
Output:
Pastec Index v0.0.1
Reading the numbers of occurences.
Counting the number of words per image.
Loading the index in memory.
Reading the visual words file.
Could not open the input file.
2/ If I used your file (visualWordsORB.dat)
Input: pastec -i visualWordsORB.dat
Output:
Pastec Index v0.0.1
Reading the numbers of occurences.
Counting the number of words per image.
Loading the index in memory.
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)
Only solution work: pastec visualWordsORB.dat, but the file is always initialized.
Thanks for your help
Hi i got Segmentation fault (core dumped) when same image added again. How to fix it.
Hello,
Thanks for this great project. I would like to know if this is possible to isolate the algorithm responsible for creating the signature/fingerprint for image search query. For example, we have a mobile application and we would like to send only the signature (the signature should be computed with mobile application) to the pastec server in order to have very fast answer.
The setup page is missing a line to cd into the repo before creating the build folder.
Hello all. I've Pastec working on my server but I'd like to automatically start when my Ubuntu server is up. Is that possible? Nowadays I've to start manually. Thanks!
I've tried setting up and installing Pastec numerous times with no success. I've tried on my Mac running 10.10.2 AND an EC2 instance running Ubuntu 14.
I keep getting the same error that the following can not be found:
LIBJSONCPP LIBRARY (ADVANCED)
I've tried installing jsoncpp with brew, cmake, cmake-gui, and make. I'm not sure where the issue lies but I can't get anywhere and am getting burnt trying to figure it out.
Any help/advice on getting pastec up and running would be greatly appreciated.
From the website:
"Next Pastec releases will contain tools that will allow you to generate your own list of visual words."
From the documentation:
"This call saves the index data in a specified path."
Before I install to give it a try I would like to know if it's possible to save the index once you've built it?
Is there a support for unix sockets?
If yes, how to enable it? Using ./pastec -p unix:///tmp/pastec.sock visualWordsORB.dat
doesn't seem to work, nor using unix:/tmp/pastec.sock
.
If no, would it be possible to add it?
I'm working on a project for personal use and education and I've been able to compile and run Pastec with no issues. Adding and searching images works great, but I'm not sure what the purpose of the "Save an index", "load an index" or "clear the index" in the API is for. Why is this needed? Any information (or even links to documentation that I can read) would be a great help. Just trying to learn.
Thanks so much in advance,
Floyd
I Compile pastec in ubuntu but i don't know how to start it
Sorry I'm a beginner Please i need some help
curl -X PUT --data-binary @/mnt/hgfs/share2ubuntu/data/train_images/airplanes/image_0041.jpg http://localhost:4212/index/images/41
poly@poly:~/pastec/build$ curl -X POST --data-binary @/mnt/hgfs/share2ubuntu/data/test_image/image_0001.jpg http://localhost:4212/index/searcher
{"bounding_rects":[{"height":105,"width":363,"x":102,"y":86}],"image_ids":[1],"scores":[609.0],"tags":[""],"type":"SEARCH_RESULTS"}
"tsgd":[""] -->How can I add tags for images by curl command,thanks
Would you like to replace any double quotes by angle brackets around file names for include statements?
While compiling this on Arch Linux against opencv 3.1.0 I get this:
[svenstaro:~/src/pastec/build] dist-ver(+2/-2) ± make
[ 9%] Building CXX object CMakeFiles/pastec.dir/src/orb/orbfeatureextractor.cpp.o
/home/svenstaro/src/pastec/src/orb/orbfeatureextractor.cpp: In member function ‘virtual u_int32_t ORBFeatureExtractor::processNewImage(unsigned int, unsigned int, char*, unsigned int&)’:
/home/svenstaro/src/pastec/src/orb/orbfeatureextractor.cpp:53:24: error: invalid cast to abstract class type ‘cv::ORB’
ORB(2000, 1.02, 100)(img, noArray(), keypoints, descriptors);
^
In file included from /usr/include/opencv2/features2d/features2d.hpp:48:0,
from /home/svenstaro/src/pastec/src/orb/orbfeatureextractor.cpp:28:
/usr/include/opencv2/features2d.hpp:254:20: note: because the following virtual functions are pure within ‘cv::ORB’:
class CV_EXPORTS_W ORB : public Feature2D
^
/usr/include/opencv2/features2d.hpp:292:26: note: virtual void cv::ORB::setMaxFeatures(int)
CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
^
/usr/include/opencv2/features2d.hpp:293:25: note: virtual int cv::ORB::getMaxFeatures() const
CV_WRAP virtual int getMaxFeatures() const = 0;
^
/usr/include/opencv2/features2d.hpp:295:26: note: virtual void cv::ORB::setScaleFactor(double)
CV_WRAP virtual void setScaleFactor(double scaleFactor) = 0;
^
/usr/include/opencv2/features2d.hpp:296:28: note: virtual double cv::ORB::getScaleFactor() const
CV_WRAP virtual double getScaleFactor() const = 0;
^
/usr/include/opencv2/features2d.hpp:298:26: note: virtual void cv::ORB::setNLevels(int)
CV_WRAP virtual void setNLevels(int nlevels) = 0;
^
/usr/include/opencv2/features2d.hpp:299:25: note: virtual int cv::ORB::getNLevels() const
CV_WRAP virtual int getNLevels() const = 0;
^
/usr/include/opencv2/features2d.hpp:301:26: note: virtual void cv::ORB::setEdgeThreshold(int)
CV_WRAP virtual void setEdgeThreshold(int edgeThreshold) = 0;
^
/usr/include/opencv2/features2d.hpp:302:25: note: virtual int cv::ORB::getEdgeThreshold() const
CV_WRAP virtual int getEdgeThreshold() const = 0;
^
/usr/include/opencv2/features2d.hpp:304:26: note: virtual void cv::ORB::setFirstLevel(int)
CV_WRAP virtual void setFirstLevel(int firstLevel) = 0;
^
/usr/include/opencv2/features2d.hpp:305:25: note: virtual int cv::ORB::getFirstLevel() const
CV_WRAP virtual int getFirstLevel() const = 0;
^
/usr/include/opencv2/features2d.hpp:307:26: note: virtual void cv::ORB::setWTA_K(int)
CV_WRAP virtual void setWTA_K(int wta_k) = 0;
^
/usr/include/opencv2/features2d.hpp:308:25: note: virtual int cv::ORB::getWTA_K() const
CV_WRAP virtual int getWTA_K() const = 0;
^
/usr/include/opencv2/features2d.hpp:310:26: note: virtual void cv::ORB::setScoreType(int)
CV_WRAP virtual void setScoreType(int scoreType) = 0;
^
/usr/include/opencv2/features2d.hpp:311:25: note: virtual int cv::ORB::getScoreType() const
CV_WRAP virtual int getScoreType() const = 0;
^
/usr/include/opencv2/features2d.hpp:313:26: note: virtual void cv::ORB::setPatchSize(int)
CV_WRAP virtual void setPatchSize(int patchSize) = 0;
^
/usr/include/opencv2/features2d.hpp:314:25: note: virtual int cv::ORB::getPatchSize() const
CV_WRAP virtual int getPatchSize() const = 0;
^
/usr/include/opencv2/features2d.hpp:316:26: note: virtual void cv::ORB::setFastThreshold(int)
CV_WRAP virtual void setFastThreshold(int fastThreshold) = 0;
^
/usr/include/opencv2/features2d.hpp:317:25: note: virtual int cv::ORB::getFastThreshold() const
CV_WRAP virtual int getFastThreshold() const = 0;
^
CMakeFiles/pastec.dir/build.make:206: recipe for target 'CMakeFiles/pastec.dir/src/orb/orbfeatureextractor.cpp.o' failed
make[2]: *** [CMakeFiles/pastec.dir/src/orb/orbfeatureextractor.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pastec.dir/all' failed
make[1]: *** [CMakeFiles/pastec.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Hi
I've started building apps only recently.I am building an app that takes a picture and compares the image with the images I have already uploaded in the pastec database.
I am currently developing the app with ionic 2 with the Pastec api.
I am able to take a photo and send the photo to the server.
Pastec reflects my search requests however I always get the error "IMAGE_NOT_DECODED" .
The following is my code.
scan() {
var options = {
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.CAMERA,
quality: 75,
allowEdit: false,
saveToPhotoAlbum: false
};
Camera.getPicture(options).then((imageData) => {
let base64Image = "data:image/jpeg;base64," + imageData;
console.log(imageData);
this.cameraSuccessCallback(imageData);
}, (err) => {
alert(err);
});
};
cameraSuccessCallback(imageData) {
console.log('called camera success callback');
let data = this.getApi(imageData);
data.subscribe(
res => {
console.log(res);
}
)
};
getApi(imageData) {
console.log('called getapi');
let headers = new Headers({
'AuthKey': 'my auth key'
});
let options = new RequestOptions({ headers: headers });
return this.http.post(
"https://api.pastec.io/indexes/vygfzrfgnqjwmmzzcvae/searcher",
imageData,
options).map(res => res.json());
}
};
Hello my friends,
I want to implement a visual search for many clothes. The pastec is not recommended for such search. What are my options? Is there any change I can make on this project to support such search?
Thank you my friends!
I expect that exception handling is usually supported by a C++ program. I wonder why your function "main" does not contain corresponding try and catch instructions so far.
How do you think about recommendations by Matthew Wilson in an article?
Would you like to adjust the implementation if you consider effects for uncaught/unhandled exceptions like they are described by Danny Kalev?
Hi there, I want to create a service that could help user to recognize objects on photos. So how could I teach this system to recognize my own objects on photo (with tags or something like that)?
Hi there,
We're playing around with pastec at a hackathon and we're having issues installing it. At the cmake stage, we get the error:
CMake Error at CMakeLists.txt:38 (find_package):
By not providing "Findmicrohttpd.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"microhttpd", but CMake did not find one.
Could not find a package configuration file provided by "microhttpd" with
any of the following names:
microhttpdConfig.cmake
microhttpd-config.cmake
Add the installation prefix of "microhttpd" to CMAKE_PREFIX_PATH or set
"microhttpd_DIR" to a directory containing one of the above files. If
"microhttpd" provides a separate development package or SDK, be sure it has
been installed.
These packages should be default. Any ideas?
Hi,
First of all you are the best :) !
Second: Tell me please about the performance, like how many photos can I use in my Index.
Thanks
Dose this can recognition different color image?
Same image, that have a people, but black people and yellow people?
i wanna to search 30 similar images order by score. but pastec always return the most similar one or two.
so are there have some config or param to set threshold or number of return images ?
Hi,
As this is a next release will be available? ("Next Pastec releases will contain tools that will allow you to generate your own list of visual words").
Thanks
Could someone please explain (or point me to resources that explain) what the scores produced by Pastec actually mean? I've got matches (not false positives) where the scores are very different 1009.0, 68.0, 30.0, 22.0
and others (again not false positives) where the scores are very similar 837.0, 837.0, 837.0, 822.0
, so can't figure out the logic.
Any assistance greatly appreciated.
Hi, I see a copy of the GPL and LGPL license in the source repository. I also see LGPL in the headers of the source. What is the official license for Pastec?
Thanks,
Jason
I'm working on a node.js module version of this project and I got stuck with the fallowing issue:
When using the "similarSearch", something is hanging (maybe a dead lock) the process at "getImageWords", if I replace the "i_ret" whit OK value all goes fine. So i suppose that the hanging line is somewhere in "getImageWords" method of the index.
To reproduce the error try adding or removing an image after using the "searchSimilar" method.
If anyone can help me Ill appreciate it.
It could be very interesting if we could use the same install of Pastec for different environments such development, test, production.
Ideally, an option could be given when launching Pastec -d, -t, -p (with a default to -p), and of course the creation of 3 different indexes backwardIndex-dev.dat, backwardIndex-test.dat, backwardIndex-prod.dat
Of course I can install Pastec on a small VPS for tests/dev purposes...but this option looks more practical ?
I have looked at a few source files for your current software. I have noticed that some checks for return codes are missing.
Would you like to add more error handling for return values from functions like the following?
Hi!
Is Pastec suitable for detecting known brand logos in images?
def getIndexImageIds(self):
ret = self.request("index/imageIds", "GET", bytearray(s, "UTF-8"))
self.raiseExceptionIfNeeded(ret["type"])
imageIds = ret["image_ids"]
return imageIds
should read
def getIndexImageIds(self):
ret = self.request("index/imageIds", "GET")
self.raiseExceptionIfNeeded(ret["type"])
imageIds = ret["image_ids"]
return imageIds
There is no data object being passed in this call
How can I add https or/and basic auth ?
Hi there, love the look of this, (you should set up a donation page).
Wanting to use the own server version, though a couple of questions that do not appear to be in any readme.
:- Images (Mentions 4x,xxx images though not in the source (git hub) so do we have to source our own and where do we store the.
:- Disple mentioned, no mention on both on how to put together both (note it's for android we will based in the cloud). https://github.com/Visu4link/displee
:- How/where data feeds, feed from our DB's (as strings of urls or actual images) into the module and return the data to our DB against the images.
:- Any constraints (i.e we will likely be completing 1-10m images a day)?
Many thanks
Some header files reuse words like "index", "messages" and "thread" in the file names which might be popular also in other software development areas.
I suggest to add your project name as a directory in affected path specifications for the preprocessor directive "#include".
How do you think about the reduce the probability for file name clashes here?
I'm trying to add an image to pastec using PUT: /index/images/<id>
. The id is a string representation of a very big int. (i.e. '624257033651527680'). However, when I go look up that id later on, I can't find it. Perhaps this is due to some restrictions on the id. If not, then maybe we have a bug.
If there are any limitations on the id, we should specify it on the API. I'd be happy to send in a pull request for this matter after discussing the issue.
Following the step by step setup instruction it fails to compile with the following error :
pastec/src/orb/orbfeatureextractor.cpp:53:24: error: no matching function for call to ‘cv::ORB::ORB(int, double, int)’
I compiled on debian wheezy.
I have actually an issue when I launch a PUT request after a POST request (Ubuntu 14.04).
Process:
1 PUT (to save a target image):
root@pastec:~# curl -X PUT --data-binary @images/targets/1-ashton-hills-vineyard-pinot.jpg http://localhost:4212/index/images/1 Image 1 added: 946 hits. {"image_id":1,"nb_features_extracted":1877,"type":"IMAGE_ADDED"}
One other PUT:
root@pastec:~# curl -X PUT --data-binary @images/targets/1-ashton-hills-vineyard-pinot.jpg http://localhost:4212/index/images/1 Image 1 removed. Image 1 added: 946 hits. {"image_id":1,"nb_features_extracted":1877,"type":"IMAGE_ADDED"}
No problems with other PUTs...
Now I launch 1 POST (to launch a matching):
curl -X POST --data-binary @images/searches/1-ashton-hills-vineyard-pinot.jpg http://localhost:4212/index/searcher Loading the image and extracting the ORBs. Image too large, resizing. time: 181 ms. Looking for the visual words. time: 1163 ms. 943 visual words kept for the request. 1 images indexed in the index. time: 1 ms. Ranking the images. init threads time: 0 ms. compute time: 1 ms. reduce time: 0 ms. rankedResult time: 0 ms. Reranking 300 among 1 images. time: 0 ms. Returning the results. Id: 1, score: 94 {"bounding_rects":[{"height":695,"width":493,"x":102,"y":176}],"image_ids":[1],"scores":[94.0],"tags":[""],"type":"SEARCH_RESULTS"}
OK, it works.
But now I can't send a new PUT. I didn't get any response from Pastec... seems it is locked !
curl -X PUT --data-binary @images/targets/1-ashton-hills-vineyard-pinot.jpg http://localhost:4212/index/images/1
=> no response even after a long time
But I can send other POSTs without problems :
curl -X POST --data-binary @images/searches/1-ashton-hills-vineyard-pinot.jpg http://localhost:4212/index/searcher Loading the image and extracting the ORBs. Image too large, resizing. time: 206 ms. Looking for the visual words. time: 1145 ms. 943 visual words kept for the request. 1 images indexed in the index. time: 1 ms. Ranking the images. init threads time: 0 ms. compute time: 0 ms. reduce time: 0 ms. rankedResult time: 0 ms. Reranking 300 among 1 images. time: 0 ms. Returning the results. Id: 1, score: 94 {"bounding_rects":[{"height":695,"width":493,"x":102,"y":176}],"image_ids":[1],"scores":[94.0],"tags":[""],"type":"SEARCH_RESULTS"}
It is a very strange behaviour.
I have tried the test many times: each I launch a POST... I can't launch PUT just after...
Hello, I have installed pastec server on my server, and now I'm trying to make a post to add photos...
When I do curl -X PUT --data-binary
Was just curious if you'd thought of including FREAK & BRISK as options. Have you experimented with these at all? Do you see any improvements?
Hi Guys,
Can you help me I have Inserted more than 500 records into the Pastec Server
While I'm trying to retrieve the records Matching with the Image as mentioned below Command. I'm getting only 100 records.
curl -X POST --data-binary @/home/test/img/request.jpg http://localhost:4212/index/searcher
Can you please guide/help me How can I retrieve more than 100 images
Thanks
Raju
The function "pthread_cond_signal" does not belong to the list of async-signal-safe functions.
I guess that a different program design will be needed for your function "intHandler".
Hi, I am trying to use the API to make POST request but I am not able to get required result. I only get this the error "Misformatted_Request". Here is my request and response:
curl --header "AuthKey: xxxxxxxxxx" -X POST -F image="@c:/home/bag.jpg" https://api.pastec.io/indexes/xxxxxxxxxx/index/searcher
{"type":"MISFORMATTED_REQUEST"}
The POST is the only problem I am facing as I can add or remove any image from my index. Please help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.