public class DL4JInceptionV3Net extends Object implements 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
,
TensorflowImageRecParser
,
TensorflowRESTRecogniser
Constructor and Description |
---|
DL4JInceptionV3Net() |
Modifier and Type | Method and Description |
---|---|
void |
checkInitialization(InitializableProblemHandler problemHandler) |
Set<MediaType> |
getSupportedMimes()
The mimes supported by this recogniser
|
void |
initialize(Map<String,Param> params)
This is the hook for configuring the recogniser
|
boolean |
isAvailable()
Is this service available
|
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<RecognisedObject> |
recognise(InputStream stream,
ContentHandler handler,
Metadata metadata,
ParseContext context)
Recognise the objects in the stream
|
public Set<MediaType> getSupportedMimes()
ObjectRecogniser
getSupportedMimes
in interface ObjectRecogniser
public void initialize(Map<String,Param> params) throws TikaConfigException
ObjectRecogniser
initialize
in interface Initializable
initialize
in interface ObjectRecogniser
params
- configuration instance in the form of contextTikaConfigException
- when there is an issue with configurationpublic void checkInitialization(InitializableProblemHandler problemHandler) throws TikaConfigException
checkInitialization
in interface Initializable
problemHandler
- if there is a problem and no
custom initializableProblemHandler has been configured
via Initializable parameters,
this is called to respond.TikaConfigException
public boolean isAvailable()
ObjectRecogniser
isAvailable
in interface ObjectRecogniser
true
when the service is available, false
otherwisepublic 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<RecognisedObject> recognise(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException
ObjectRecogniser
recognise
in interface ObjectRecogniser
stream
- content streamhandler
- tika's content handlermetadata
- metadata instancecontext
- parser contextRecognisedObject
sIOException
- when an I/O error occursSAXException
- when an issue with XML occursTikaException
- any generic errorCopyright © 2007–1969 The Apache Software Foundation. All rights reserved.