OBJECT
- Type of objectANNOTATION
- Type of annotationFEATURE
- Type of feature extracted and cached.public class FeatureCachingIncrementalBatchAnnotator<OBJECT,ANNOTATION,FEATURE> extends IncrementalAnnotator<OBJECT,ANNOTATION>
BatchAnnotator
to behave like a
IncrementalAnnotator
by caching extracted features and then
performing training only when annotate(Object)
is called.
Because the features are cached, the internal annotator must rely on a
IdentityFeatureExtractor
or similar, and thus not perform any
extraction itself.
Constructor and Description |
---|
FeatureCachingIncrementalBatchAnnotator(FeatureExtractor<FEATURE,OBJECT> extractor,
BatchAnnotator<FEATURE,ANNOTATION> batchAnnotator)
Construct with the given feature extractor and batch annotator, and use
an in-memory cache.
|
FeatureCachingIncrementalBatchAnnotator(FeatureExtractor<FEATURE,OBJECT> extractor,
BatchAnnotator<FEATURE,ANNOTATION> batchAnnotator,
GroupedListCache<ANNOTATION,FEATURE> cache)
Construct with the given feature extractor and batch annotator, and use
an in-memory cache.
|
Modifier and Type | Method and Description |
---|---|
List<ScoredAnnotation<ANNOTATION>> |
annotate(OBJECT object)
Generate annotations for the given object.
|
Set<ANNOTATION> |
getAnnotations() |
void |
reset()
Reset the object to its initial condition, as if
it hasn't seen any training data.
|
void |
train(Annotated<OBJECT,ANNOTATION> annotated)
Train/update object using a new instance.
|
train, train, trainMultiClass
classify
public FeatureCachingIncrementalBatchAnnotator(FeatureExtractor<FEATURE,OBJECT> extractor, BatchAnnotator<FEATURE,ANNOTATION> batchAnnotator)
extractor
- the extractorbatchAnnotator
- the annotatorpublic FeatureCachingIncrementalBatchAnnotator(FeatureExtractor<FEATURE,OBJECT> extractor, BatchAnnotator<FEATURE,ANNOTATION> batchAnnotator, GroupedListCache<ANNOTATION,FEATURE> cache)
extractor
- the extractorbatchAnnotator
- the annotatorcache
- the cachepublic void train(Annotated<OBJECT,ANNOTATION> annotated)
IncrementalTrainer
annotated
- instance to train withpublic void reset()
IncrementalTrainer
public Set<ANNOTATION> getAnnotations()
public List<ScoredAnnotation<ANNOTATION>> annotate(OBJECT object)
Annotator
object
- the image