美文网首页
Deep Java Library (DJL)

Deep Java Library (DJL)

作者: twappleon | 来源:发表于2019-12-10 14:41 被阅读0次

https://github.com/awslabs/djl#getting-started

// Assume user uses a pre-trained model from model zoo, they just need to load it
    Map<String, String> criteria = new HashMap<>();
    criteria.put("layers", "18");
    criteria.put("flavor", "v1");

    // Load pre-trained model from model zoo
    try (Model<BufferedImage, Classifications> model = MxModelZoo.RESNET.loadModel(criteria)) {
        try (Predictor<BufferedImage, Classifications> predictor = model.newPredictor()) {
            BufferedImage img = readImage(); // read image
            Classifications result = predictor.predict(img);

            // get the classification and probability
            ...
        }
    }

相关文章

网友评论

      本文标题:Deep Java Library (DJL)

      本文链接:https://www.haomeiwen.com/subject/khlggctx.html