detection from code

143 views
Skip to first unread message

cmog...@gmail.com

unread,
Mar 17, 2013, 7:09:15 AM3/17/13
to ebl...@googlegroups.com
Hello,
I'm trying to do detection from code, I decided to start from simple, from mnist detection. From terminal it works well, then I opened detect.cpp and tried to take needed code.

MAIN_QTHREAD(int, argc, char **, argv)
{
try
{
cout << "Start\n";
string conffname = "/home/cmogilko/eblearn/demos/mnist/mnist.conf";
configuration conf(conffname, true, true, false); // configuration file
conf.set("run_type", "detect"); // tell conf that we are in train mode
conf.resolve();

if (!conf.exists("root2") || !conf.exists("current_dir"))
{
conf.set("root2", "/home/cmogilko/eblearn/demos/minst");
conf.set("current_dir", "/home/cmogilko/eblearn/demos/minst");
}
bool sync = conf.exists_true("sync_outputs");

mutex out_mutex;

detection_thread<float> *dt = new detection_thread<float>(conf, &out_mutex, NULL, NULL, sync);

dt->start();

string ffname("/home/cmogilko/eblearn/tools/data/mnist/3.ppm");
string fname("2");
bool res = dt->set_data(ffname, fname, 1);
cout << "set data = " << res << endl;

bboxes bb;
idx<ubyte> detframe;
uint total_saved = 0;
string processed_fname;
uint processed_id = 0;
svector<midx<float> > samples;
bboxes bbsamples;
bool skipped = false;

bool updated = dt->get_data(bb, detframe, total_saved, processed_fname, &processed_id, &samples, &bbsamples, &skipped);

cout << updated << endl;

if (!dt->finished())
dt->stop();
delete dt;
}
eblcatch();
return 0;
}

But after set_data always appears Segmentation fault and get_data never invokes. And if I comment set_data-get_data sections, it will be dt->start(); dt->stop(); It will never terminates, it freezes before stop().

What is wrong?

the_minion

unread,
Mar 18, 2013, 9:44:32 AM3/18/13
to ebl...@googlegroups.com, cmog...@gmail.com

cmog...@gmail.com

unread,
Mar 23, 2013, 10:47:51 AM3/23/13
to ebl...@googlegroups.com, cmog...@gmail.com
Thanks a lot, but there is seg fault again. I have checked something and found out that problem in mutex.
Simple program causes Segmentation fault:

MAIN_QTHREAD(int, argc, char **, argv)
{
mutex m;
return 0;
}

On destructor: *** glibc detected *** free(): invalid next size (fast)

But it works well:
pthread_mutex_t mut;
pthread_mutex_init(&mut, NULL);
pthread_mutex_destroy(&mut);

And mutex works in detect-terminal utility. What can it be?

понедельник, 18 марта 2013 г., 17:44:32 UTC+4 пользователь the_minion написал:

the_minion

unread,
Mar 25, 2013, 9:39:40 AM3/25/13
to ebl...@googlegroups.com, cmog...@gmail.com
cmogilko,

Great that you found the problem. I can't reproduce it on my side, so I can't find an issue.
--
S

cmog...@gmail.com

unread,
Mar 27, 2013, 10:14:16 AM3/27/13
to ebl...@googlegroups.com, cmog...@gmail.com
Hi again,
I found solution, I didn't know that I must define __PTHREAD__ by myself.

Now I trying to detect SVHN demo from code. I added to config file next lines:
classes = /home/cmogilko/eblearn/demos/svhn/svhn/svhn_ynuv7_train_classes.mat # names and # of classes
scaling_type = 4 # 4: no multi-scaling, just original 28x28 image
camera = directory # input images come from a directory
input_dir = /home/cmogilko/eblearn/demos/ # directory for input images
weights = net00400.mat

But next error was occured:
Error: deep copy not implemented in l1penalty, in copy at /usr/include/eblearn/ebl_arch.hpp:347

What's wrong? Thanks.

понедельник, 25 марта 2013 г., 17:39:40 UTC+4 пользователь the_minion написал:

soumith

unread,
Mar 27, 2013, 10:47:18 AM3/27/13
to ebl...@googlegroups.com, cmog...@gmail.com
You need to remove l1penalty entries in the conf for detection. It is a module that is used for regularization during training.

--
You received this message because you are subscribed to the Google Groups "eblearn" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eblearn+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Reply all
Reply to author
Forward
0 new messages