ClassificationInputMixin¶
- class flash.core.data.io.classification_input.ClassificationInputMixin(running_stage=None)[source]¶
The
ClassificationInputMixin
class provides utility methods for handling classification targets.Input
objects that extendClassificationInputMixin
should do the following:In the
load_data
method, include a call toload_target_metadata
. This will determine the format of the targets and store metadata likelabels
andnum_classes
.In the
load_sample
method, useformat_target
to 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
labels
andnum_classes
.- Parameters
target_formatter¶ (
Optional
[TargetFormatter
]) – Optionally provide aTargetFormatter
rather than inferring from the targets.add_background¶ (
bool
) – IfTrue
, a background class will be inserted as class zero iflabels
andnum_classes
are being inferred.
- Return type