457 Star 3.6K Fork 878

PaddlePaddle / PaddleOCR

 / 详情

djl如何使用ch_PP-OCRv3_det_infer.tar

待办的
创建于  
2023-07-25 11:11
暂无描述。

评论 (3)

yangbr 创建了任务
/**
 * 初始文本检测推理器
 */
public static Predictor<Image, DetectedObjects> loadPredictor() throws ModelNotFoundException, MalformedModelException, IOException {
    try (ZooModel<Image, DetectedObjects> detectionModel = ModelZoo.loadModel(getCriteria())) {
        return detectionModel.newPredictor();
    } catch (Exception e) {
        System.out.println("初始文本检测推理器失败!");
        throw new RuntimeException(e);
    }
}

private static Criteria<Image, DetectedObjects> getCriteria() {
    return Criteria.builder()
            .optEngine("OnnxRuntime")
            .optModelName("inference")
            .setTypes(Image.class, DetectedObjects.class)
            .optModelPath(Paths.get("src/main/resources/text/models/ch_PP-OCRv3_det_infer.tar"))
            .optTranslator(new PpWordDetectionTranslator(new ConcurrentHashMap<String, String>()))
            .optProgress(new ProgressBar())
            .build();
}

我这样引入会报错,提示ai.djl.repository.zoo.ModelNotFoundException: No model with the specified URI or the matching Input/Output type is found.
我怀疑是setTypes给的值不对,但我不知道正确的值是什么

清楚了,不是.optEngine("OnnxRuntime")是.optEngine("PaddlePaddle")

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(1)
Python
1
https://gitee.com/paddlepaddle/PaddleOCR.git
git@gitee.com:paddlepaddle/PaddleOCR.git
paddlepaddle
PaddleOCR
PaddleOCR

搜索帮助

344bd9b3 5694891 D2dac590 5694891