ClassificationInputMixin¶
- class flash.core.data.io.classification_input.ClassificationInputMixin(running_stage=None)[source]¶
The
ClassificationInputMixinclass provides utility methods for handling classification targets.Inputobjects that extendClassificationInputMixinshould do the following:In the
load_datamethod, include a call toload_target_metadata. This will determine the format of the targets and store metadata likelabelsandnum_classes.In the
load_samplemethod, useformat_targetto convert the target to a standard format for use with our tasks.
- format_target(target)[source]¶
Format a single target according to the previously computed target format and metadata.
- load_target_metadata(targets, target_formatter=None, add_background=False)[source]¶
Determine the target format and store the
labelsandnum_classes.- Parameters
target_formatter¶ (
Optional[TargetFormatter]) – Optionally provide aTargetFormatterrather than inferring from the targets.add_background¶ (
bool) – IfTrue, a background class will be inserted as class zero iflabelsandnum_classesare being inferred.
- Return type