ml4a / ml4a-ofx

A collection of openFrameworks apps for working with machine learning
http://ml4a.github.io
1.22k stars 279 forks source link

[question] Cannot load .dat files #5

Closed gerardobort closed 7 years ago

gerardobort commented 7 years ago

Hi @genekogan, just a question... After building the app ReverseImageSearchFast successfully, I'm having troubles when trying to load the .dat files (any of the ones provided on the guide). I could identify where this is happening, but couldn't find a solution yet... I was wondering if this is familiar to you? I tried this in two Macs, same error, one 15" Nvidia GPU + Cuda installed, and the other an 13" Intel.

screen shot 2017-03-16 at 11 14 57 am

(I've added AA1, AA2, AA3 logs to track where it dies.... the source is at the bottom of this question)

[notice ] Loading from /Users/gbort/Desktop/COCO-ml4a/mscoco_145k_rp32.dat
[notice ] AA1
ReverseImageSearchFast(67100,0x7fff7458d000) malloc: *** mach_vm_map(size=14109161666195456) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

....then if I change vector<string> filenames; by vector<char> filenames;, it explodes on the following sentence...

HOST_OS=Darwin
[ error ] Can't find network file ../../../../models/image-net-2012.sqlite3
[ error ] ofTessellator: performTessellation(): mesh polygon tessellation failed, winding mode 0
[ error ] ofTessellator: performTessellation(): mesh polygon tessellation failed, winding mode 0
[ error ] ofTessellator: performTessellation(): mesh polygon tessellation failed, winding mode 0
[ error ] ofTessellator: performTessellation(): mesh polygon tessellation failed, winding mode 0
[ error ] ofTessellator: performTessellation(): mesh polygon tessellation failed, winding mode 0
[ error ] ofTessellator: performTessellation(): mesh polygon tessellation failed, winding mode 0
[notice ] Loading from /Users/gbort/Desktop/COCO-ml4a/mscoco_145k_rp32.dat
[notice ] AA1
[notice ] AA2
libc++abi.dylib: terminating with uncaught exception of type dlib::serialization_error: Error deserializing object of type double
   while deserializing a dlib::matrix
/bin/sh: line 1: 70940 Abort trap: 6           ./ReverseImageSearchFast
make: *** [run] Error 134

Here's the method that fails... with the extra logs I added...

//--------------------------------------------------------------
void ofApp::load(string path) {
    ofLog()<<"Loading from "<<path;
    const char *filepath = path.c_str();
    ifstream fin(filepath, ios::binary);
    vector<vector<double> > projectedEncodings;
    vector<char> filenames;
    vector<double> column_means;
    dlib::matrix<double, 0, 0> E, V;
    dlib::deserialize(projectedEncodings, fin);
    ofLog()<<"AA1";
    dlib::deserialize(filenames, fin);
    ofLog()<<"AA2";
    dlib::deserialize(E, fin);
    ofLog()<<"AA3";
    dlib::deserialize(V, fin);
    ofLog()<<"AA4";
    dlib::deserialize(column_means, fin);
    ofLog()<<"AA5";
    pca.setE(E);
    pca.setV(V);
    pca.setColumnMeans(column_means);
    images.clear();
genekogan commented 7 years ago

those models you are trying to load are for ReverseObjectSearch not ReverseImageSearch. the latter doesn't have any uploaded at the moment because they are too big and i need to do something similar as for the former.

gerardobort commented 7 years ago

Thanks for the rapid response @genekogan! I may have misunderstood the reading, you pointed those files on the ReverseImageSearch guide, and I just tried with them (http://ml4a.github.io/guides/ReverseObjectSearchFast/). Will try by loading a folder instead and generate my own models.

genekogan commented 7 years ago

don't think i did... only place i can recall pointing to them is in the ReverseObjectSearch guide. is it linked to somewhere else?

gerardobort commented 7 years ago

@genekogan oh, my bad.... yes, that's the guide but I was trying the wrong app :man_facepalming:.