Deep Java Library (DJL)

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

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

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

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

你可能感兴趣的:(Deep Java Library (DJL))