public Map<Integer, String> loadClassIndex(InputStream stream)
            throws IOException, ParseException {
        String content = IOUtils.toString(stream, StandardCharsets.UTF_8);
        JSONObject jIndex = (JSONObject) new JSONParser().parse(content);
        Map<Integer, String> classMap = new HashMap<>();
        for (Object key : jIndex.keySet()) {
            JSONArray names = (JSONArray) jIndex.get(key);
            classMap.put(Integer.parseInt(key.toString()), names.get(names.size() - 1).toString());
        }
        return classMap;
    }
Loads the class to

@param stream label index stream
@return Map of integer -&gt; label name
@throws IOException    when the stream breaks unexpectedly
@throws ParseException when the input doesn't contain a valid JSON map
tika-parsers/tika-parsers-ml/tika-dl/src/main/java/org/apache/tika/dl/imagerec/DL4JInceptionV3Net.java