Package org.apache.tika.dl.imagerec
Class DL4JInceptionV3Net
- java.lang.Object
- 
- org.apache.tika.dl.imagerec.DL4JInceptionV3Net
 
- 
- All Implemented Interfaces:
- Initializable,- ObjectRecogniser
 
 public class DL4JInceptionV3Net extends Object implements ObjectRecogniser DL4JInceptionV3Netis an implementation ofObjectRecogniser. 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: - Since:
- Tika 1.15
- See Also:
- ObjectRecogniser,- ObjectRecognitionParser,- TensorflowImageRecParser,- TensorflowRESTRecogniser
 
- 
- 
Constructor SummaryConstructors Constructor Description DL4JInceptionV3Net()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckInitialization(InitializableProblemHandler problemHandler)Set<MediaType>getSupportedMimes()The mimes supported by this recogniservoidinitialize(Map<String,Param> params)This is the hook for configuring the recogniserbooleanisAvailable()Is this service availableMap<Integer,String>loadClassIndex(InputStream stream)Loads the class toorg.nd4j.linalg.api.ndarray.INDArraypreProcessImage(org.nd4j.linalg.api.ndarray.INDArray input)Pre process image to reduce to make it feedable to inception networkList<RecognisedObject>recognise(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context)Recognise the objects in the stream
 
- 
- 
- 
Method Detail- 
getSupportedMimespublic Set<MediaType> getSupportedMimes() Description copied from interface:ObjectRecogniserThe mimes supported by this recogniser- Specified by:
- getSupportedMimesin interface- ObjectRecogniser
- Returns:
- set of mediatypes
 
 - 
initializepublic void initialize(Map<String,Param> params) throws TikaConfigException Description copied from interface:ObjectRecogniserThis is the hook for configuring the recogniser- Specified by:
- initializein interface- Initializable
- Specified by:
- initializein interface- ObjectRecogniser
- Parameters:
- params- configuration instance in the form of context
- Throws:
- TikaConfigException- when there is an issue with configuration
 
 - 
checkInitializationpublic void checkInitialization(InitializableProblemHandler problemHandler) throws TikaConfigException - Specified by:
- checkInitializationin interface- Initializable
- Parameters:
- problemHandler- if there is a problem and no custom initializableProblemHandler has been configured via Initializable parameters, this is called to respond.
- Throws:
- TikaConfigException
 
 - 
isAvailablepublic boolean isAvailable() Description copied from interface:ObjectRecogniserIs this service available- Specified by:
- isAvailablein interface- ObjectRecogniser
- Returns:
- truewhen the service is available,- falseotherwise
 
 - 
preProcessImagepublic 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- Parameters:
- input- Input image
- Returns:
- processed image
 
 - 
loadClassIndexpublic Map<Integer,String> loadClassIndex(InputStream stream) throws IOException, org.json.simple.parser.ParseException Loads the class to- Parameters:
- stream- label index stream
- Returns:
- Map of integer -> label name
- Throws:
- IOException- when the stream breaks unexpectedly
- org.json.simple.parser.ParseException- when the input doesn't contain a valid JSON map
 
 - 
recognisepublic List<RecognisedObject> recognise(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException Description copied from interface:ObjectRecogniserRecognise the objects in the stream- Specified by:
- recognisein interface- ObjectRecogniser
- Parameters:
- stream- content stream
- handler- tika's content handler
- metadata- metadata instance
- context- parser context
- Returns:
- List of RecognisedObjects
- Throws:
- IOException- when an I/O error occurs
- SAXException- when an issue with XML occurs
- TikaException- any generic error
 
 
- 
 
-