public class DL4JInceptionV3Net extends Object implements org.apache.tika.parser.recognition.ObjectRecogniser
DL4JInceptionV3Net is an implementation of ObjectRecogniser.
This object recogniser is powered by Deeplearning4j.
This implementation is pre configured to use Google's InceptionV3 model pre trained on
ImageNet corpus. The models references in default settings are originally trained and exported from Keras and imported using DL4J's importer tools.
Although this implementation is made to work out of the box without user attention, for advances users who are interested in tweaking the settings, the following fields are configurable:
ObjectRecogniser,
ObjectRecognitionParser,
org.apache.tika.parser.recognition.tf.TensorflowImageRecParser,
org.apache.tika.parser.recognition.tf.TensorflowRESTRecogniser| Modifier and Type | Field and Description |
|---|---|
static String |
DEF_LABEL_MAPPING |
static String |
DEF_MODEL_JSON |
| Constructor and Description |
|---|
DL4JInceptionV3Net() |
| Modifier and Type | Method and Description |
|---|---|
static File |
cachedDownload(File cacheDir,
URI uri) |
void |
checkInitialization(org.apache.tika.config.InitializableProblemHandler problemHandler) |
Set<org.apache.tika.mime.MediaType> |
getSupportedMimes() |
void |
initialize(Map<String,org.apache.tika.config.Param> params) |
boolean |
isAvailable() |
Map<Integer,String> |
loadClassIndex(InputStream stream)
Loads the class to
|
org.nd4j.linalg.api.ndarray.INDArray |
preProcessImage(org.nd4j.linalg.api.ndarray.INDArray input)
Pre process image to reduce to make it feedable to inception network
|
List<org.apache.tika.parser.recognition.RecognisedObject> |
recognise(InputStream stream,
ContentHandler handler,
org.apache.tika.metadata.Metadata metadata,
org.apache.tika.parser.ParseContext context) |
public static final String DEF_MODEL_JSON
public static final String DEF_LABEL_MAPPING
public Set<org.apache.tika.mime.MediaType> getSupportedMimes()
getSupportedMimes in interface org.apache.tika.parser.recognition.ObjectRecogniserpublic static File cachedDownload(File cacheDir, URI uri) throws IOException
IOExceptionpublic void initialize(Map<String,org.apache.tika.config.Param> params) throws org.apache.tika.exception.TikaConfigException
initialize in interface org.apache.tika.config.Initializableinitialize in interface org.apache.tika.parser.recognition.ObjectRecogniserorg.apache.tika.exception.TikaConfigExceptionpublic void checkInitialization(org.apache.tika.config.InitializableProblemHandler problemHandler)
throws org.apache.tika.exception.TikaConfigException
checkInitialization in interface org.apache.tika.config.Initializableorg.apache.tika.exception.TikaConfigExceptionpublic boolean isAvailable()
isAvailable in interface org.apache.tika.parser.recognition.ObjectRecogniserpublic org.nd4j.linalg.api.ndarray.INDArray preProcessImage(org.nd4j.linalg.api.ndarray.INDArray input)
input - Input imagepublic Map<Integer,String> loadClassIndex(InputStream stream) throws IOException, org.json.simple.parser.ParseException
stream - label index streamIOException - when the stream breaks unexpectedlyorg.json.simple.parser.ParseException - when the input doesn't contain a valid JSON mappublic List<org.apache.tika.parser.recognition.RecognisedObject> recognise(InputStream stream, ContentHandler handler, org.apache.tika.metadata.Metadata metadata, org.apache.tika.parser.ParseContext context) throws IOException, SAXException, org.apache.tika.exception.TikaException
recognise in interface org.apache.tika.parser.recognition.ObjectRecogniserIOExceptionSAXExceptionorg.apache.tika.exception.TikaExceptionCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.