diff --git a/openbr/plugins/dlib.cpp b/openbr/plugins/dlib.cpp index 564cb24..f79d852 100644 --- a/openbr/plugins/dlib.cpp +++ b/openbr/plugins/dlib.cpp @@ -80,6 +80,7 @@ class DObjectDetectTransform : public Transform private: typedef scan_fhog_pyramid > image_scanner_type; mutable object_detector detector; + mutable QMutex mutex; void train(const TemplateList &data) { @@ -88,7 +89,7 @@ private: foreach (const Template &t, data) { if (!t.file.rects().isEmpty()) { - cv_image cimg(t.m().clone()); + cv_image cimg(t.m().clone()); array2d image; assign_image(image,cimg); @@ -115,18 +116,21 @@ private: trainer.set_num_threads(max(1,QThread::idealThreadCount())); trainer.set_c(C); trainer.set_epsilon(epsilon); + trainer.be_verbose(); detector = trainer.train(samples, boxes); } void project(const Template &src, Template &dst) const - { + { dst = src; - cv_image cimg(src.m().clone()); + cv_image cimg(src.m().clone()); array2d image; assign_image(image,cimg); + QMutexLocker locker(&mutex); std::vector dets = detector(image); + locker.unlock(); for (int i=0; i