Package boofcv.deepboof
Class BaseImageClassifier
java.lang.Object
boofcv.deepboof.BaseImageClassifier
- All Implemented Interfaces:
ImageClassifier<Planar<GrayF32>>
,ImageModelBase<Planar<GrayF32>>
- Direct Known Subclasses:
ImageClassifierNiNImageNet
,ImageClassifierResNet
,ImageClassifierVggCifar10
public abstract class BaseImageClassifier
extends Object
implements ImageClassifier<Planar<GrayF32>>
Base class for ImageClassifiers which implements common elements
-
Nested Class Summary
Nested classes/interfaces inherited from interface boofcv.abst.scene.ImageClassifier
ImageClassifier.Score
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected DogArray<ImageClassifier.Score>
protected int
protected ClipAndReduce<Planar<GrayF32>>
protected deepboof.graph.FunctionSequence<deepboof.tensors.Tensor_F32,
deepboof.Function<deepboof.tensors.Tensor_F32>> protected deepboof.tensors.Tensor_F32
protected deepboof.tensors.Tensor_F32
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
The original implementation takes in an image then crops it randomly.Returns a list of all the likely categories for the image.int
Returns the category which was the best fit.Returns a list of all the possible categories that a scene can be classified asReturns the type of input imageprotected void
innerProcess
(deepboof.tensors.Tensor_F32 tensorInput) preprocess
(Planar<GrayF32> image) Massage the input image into a format recognized by the networkMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface boofcv.abst.scene.ImageModelBase
loadModel
-
Field Details
-
network
protected deepboof.graph.FunctionSequence<deepboof.tensors.Tensor_F32,deepboof.Function<deepboof.tensors.Tensor_F32>> network -
categories
-
imageType
-
massage
-
imageSize
protected int imageSize -
imageRgb
-
tensorInput
protected deepboof.tensors.Tensor_F32 tensorInput -
tensorOutput
protected deepboof.tensors.Tensor_F32 tensorOutput -
categoryScores
-
categoryBest
protected int categoryBest
-
-
Constructor Details
-
BaseImageClassifier
protected BaseImageClassifier(int imageSize)
-
-
Method Details
-
getInputType
Description copied from interface:ImageModelBase
Returns the type of input image- Specified by:
getInputType
in interfaceImageModelBase<Planar<GrayF32>>
- Returns:
- input image type
-
classify
The original implementation takes in an image then crops it randomly. This is primarily for training but is replicated here to reduce the number of differences- Specified by:
classify
in interfaceImageClassifier<Planar<GrayF32>>
- Parameters:
image
- Image being processed. Must be RGB image. Pixel values must have values from 0 to 255.
-
preprocess
Massage the input image into a format recognized by the network -
innerProcess
protected void innerProcess(deepboof.tensors.Tensor_F32 tensorInput) -
getBestResult
public int getBestResult()Description copied from interface:ImageClassifier
Returns the category which was the best fit.- Specified by:
getBestResult
in interfaceImageClassifier<Planar<GrayF32>>
- Returns:
- best fit category
-
getAllResults
Description copied from interface:ImageClassifier
Returns a list of all the likely categories for the image. What is likely is implementation dependent. Each category should be included at least once and might not be included at all.- Specified by:
getAllResults
in interfaceImageClassifier<Planar<GrayF32>>
- Returns:
- List of categories and scores
-
getCategories
Description copied from interface:ImageClassifier
Returns a list of all the possible categories that a scene can be classified as- Specified by:
getCategories
in interfaceImageClassifier<Planar<GrayF32>>
- Returns:
- Names of categories
-
getImageRgb
-