Shortcuts

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 extend ClassificationInputMixin should do the following:

  • In the load_data method, include a call to load_target_metadata. This will determine the format of the targets and store metadata like labels and num_classes.

  • In the load_sample method, use format_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.

Parameters

target (Any) – The target to format.

Return type

Any

Returns

The formatted target.

load_target_metadata(targets, target_formatter=None, add_background=False)[source]

Determine the target format and store the labels and num_classes.

Parameters
  • targets (Optional[List[Any]]) – The list of targets.

  • target_formatter (Optional[TargetFormatter]) – Optionally provide a TargetFormatter rather than inferring from the targets.

  • add_background (bool) – If True, a background class will be inserted as class zero if labels and num_classes are being inferred.

Return type

None

Read the Docs v: 0.7.2
Versions
latest
stable
0.7.2
0.7.1
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.0
0.3.2
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0post1
docs-fix_typing
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.