/** * Train the annotator with the given grouped dataset. Internally, the * dataset is converted to a list containing exactly one reference to each * object in the dataset with (potentially) multiple annotations. * * @param dataset * the dataset to train on */ public void train(GroupedDataset<ANNOTATION, ? extends ListDataset<OBJECT>, OBJECT> dataset) { train(AnnotatedObject.createList(dataset)); } }
@Override public List<ScoredAnnotation<ANNOTATION>> annotate(OBJECT object) { if (isInvalid) { batchAnnotator.train(objectCache.getDataset()); isInvalid = false; } return batchAnnotator.annotate(object); } }
@Override public List<ScoredAnnotation<ANNOTATION>> annotate(OBJECT object) { if (isInvalid) { batchAnnotator.train(featureCache.getDataset()); isInvalid = false; } return batchAnnotator.annotate(extractor.extractFeature(object)); } }
/** * Train the annotator on the given streams. The streams are annotated with * the appropriate annotation, and sample chunks (and therefore buffers) are * gathered from the streams into batches to train the annotator. * * @param streams * The annotated streams */ public void train(final List<IndependentPair<AudioStream, ANNOTATION>> streams) { // Convert all the incoming streams into AnnotatedObject instances // where the sample buffer for each final List<Annotated<SampleBuffer, ANNOTATION>> list = new ArrayList<Annotated<SampleBuffer, ANNOTATION>>(); for (final IndependentPair<AudioStream, ANNOTATION> stream : streams) { SampleChunk sc = null; while ((sc = stream.firstObject().nextSampleChunk()) != null) { final SampleBuffer sb = sc.getSampleBuffer(); final AnnotatedObject<SampleBuffer, ANNOTATION> a = AnnotatedObject.create(sb, stream.secondObject()); list.add(a); } } // Train the annotator for the streams this.annotator.train(list); }
/** * Train the annotator on the given streams. The streams are annotated with * the appropriate annotation, and sample chunks (and therefore buffers) are * gathered from the streams into batches to train the annotator. * * @param streams * The annotated streams */ public void train(final List<IndependentPair<AudioStream, ANNOTATION>> streams) { // Convert all the incoming streams into AnnotatedObject instances // where the sample buffer for each final List<Annotated<SampleBuffer, ANNOTATION>> list = new ArrayList<Annotated<SampleBuffer, ANNOTATION>>(); for (final IndependentPair<AudioStream, ANNOTATION> stream : streams) { SampleChunk sc = null; while ((sc = stream.firstObject().nextSampleChunk()) != null) { final SampleBuffer sb = sc.getSampleBuffer(); final AnnotatedObject<SampleBuffer, ANNOTATION> a = AnnotatedObject.create(sb, stream.secondObject()); list.add(a); } } // Train the annotator for the streams this.annotator.train(list); }