[shotwell/wip/cleanup-facedetect: 5/6] Load torch file independently of caffeemodel




commit 9b86f449c281b69cc8314bedf04b701be56503a7
Author: Jens Georg <mail jensge org>
Date:   Sun Aug 14 19:47:36 2022 +0200

    Load torch file independently of caffeemodel
    
    So we can run the recognition even if there is no detection model

 subprojects/shotwell-facedetect/facedetect-opencv.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/subprojects/shotwell-facedetect/facedetect-opencv.cpp 
b/subprojects/shotwell-facedetect/facedetect-opencv.cpp
index bb887d2f..227593a6 100644
--- a/subprojects/shotwell-facedetect/facedetect-opencv.cpp
+++ b/subprojects/shotwell-facedetect/facedetect-opencv.cpp
@@ -131,13 +131,18 @@ bool loadNet(cv::String baseDir) {
     try {
         faceDetectNet = cv::dnn::readNetFromCaffe(baseDir + "/deploy.prototxt",
                                                   baseDir + "/" + RESNET_DETECT_CAFFE_NET);
-        faceRecogNet = cv::dnn::readNetFromTorch(baseDir + "/" + OPENFACE_RECOG_TORCH_NET);
     } catch(cv::Exception &e) {
         std::cout << "File load failed: " << e.msg << std::endl;
         disableDnn = true;
     }
 
-    if (faceRecogNet.empty() || faceDetectNet.empty()) {
+    try {
+        faceRecogNet = cv::dnn::readNetFromTorch(baseDir + "/" + OPENFACE_RECOG_TORCH_NET);
+    } catch(cv::Exception &e) {
+        std::cout << "File load failed: " << e.msg << std::endl;
+    }
+
+    if (faceDetectNet.empty()) {
         std::cout << "Loading open-face net failed!" << std::endl;
         disableDnn = true;
         return false;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]