guojin-yan / PaddleOCR-OpenVINO-CSharp

Deploying PaddleOCR model based on OpenVINO C# API.
Apache License 2.0
35 stars 5 forks source link

Can not inference with Multilingual_PP-OCRv3_det_infer #8

Open DungHD-1997 opened 1 week ago

DungHD-1997 commented 1 week ago

First of all, thank you for sharing the code. Now I can use your default configuration. But when I want to use multilingual text detection model, the current code will show an error as below. Is it true that the current code cannot support multilingual text detection model? Thank you!

My code :

        string det_model = "./Multilingual_PP-OCRv3_det_infer/inference.pdmodel";
        string cls_model = "./ch_ppocr_mobile_v2.0_cls_infer/inference.pdmodel";
        string rec_model = "./japan_PP-OCRv4_rec_infer/inference.pdmodel";
        string key_path = "japan_dict.txt";

        RuntimeOption.RecOption.label_path = key_path;
        OCRPredictor ocr = new OCRPredictor(det_model, cls_model, rec_model);

        string img_path = @"C:\Code\PaddleOCR-Sample\sample.jpg";
        Mat img = Cv2.ImRead(img_path);

        List<OCRPredictResult> ocr_results = ocr.ocr(img, true, true, false);
        List<OCRPredictResult> ocr_finals = new List<OCRPredictResult>();

        PaddleOcrUtility.print_result(ocr_finals);
        Mat new_image = PaddleOcrUtility.visualize_bboxes(img, ocr_finals);
        Cv2.ImShow("result", new_image);
        Cv2.WaitKey(0);

Error:

image