Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

wechat_qrcode throw unspecified error when load caffe model #3822

Open
JackCCCCC opened this issue Nov 12, 2024 · 0 comments
Open

wechat_qrcode throw unspecified error when load caffe model #3822

JackCCCCC opened this issue Nov 12, 2024 · 0 comments
Labels
question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org/

Comments

@JackCCCCC
Copy link

System information (version)
  • OpenCV => 4.10.0
  • Operating System / Platform => Ubuntu20.04
  • Compiler => gcc9
Detailed description

I use the wechat_qrcode module of OpenCV4.10.0 for QR code recognition. Due to program dependencies, I need to use a higher version of protobuf. When I use protobuf version<=3.19, my program can load the caffe model and recognize the QR code normally. But if I upgrade the version of protobuf to 3.24.2 (protobuf version is confirmed to match), loading the model will throw an exception

My code is as follows
  cv::Ptr<cv::wechat_qrcode::WeChatQRCode> detector_;
    try {
      std::string detect_prototxt = "detect.prototxt";
      std::string detect_caffemodel = "detect.caffemodel";
      std::string sr_prototxt ="sr.prototxt";
      std::string sr_caffemodel = "sr.caffemodel";
      detector_ = cv::makePtr<cv::wechat_qrcode::WeChatQRCode>(
        detect_prototxt, detect_caffemodel, sr_prototxt, sr_caffemodel);
    } catch (const std::exception& e) {
        std::cout <<
            "\n---------------------------------------------------------------\n"
            "Failed to initialize WeChatQRCode.\n"
            "Please, download 'detector.*' and 'sr.*' from\n"
            "https://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode\n"
            "and put them into the current directory.\n"
            "---------------------------------------------------------------\n";
        std::cout << e.what() << std::endl;
    }
    std::vector<std::string> res =detector_->detectAndDecode(img, points);
Corresponding program exception
Failed to initialize WeChatQRCode.
Please, download 'detector.*' and 'sr.*' from
https://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode
and put them into the current directory.
---------------------------------------------------------------
OpenCV(4.10.0) /home/user/zros/out/opencv-4.10.0/modules/dnn/src/caffe/caffe_importer.cpp:603: error: (-2:Unspecified error) DNN/Caffe: Build OpenCV with Protobuf to import Caffe models in function 'readNetFromCaffe'
@opencv-alalek opencv-alalek added the question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org/ label Nov 18, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org/
Projects
None yet
Development

No branches or pull requests

2 participants