Shortcuts

ImageClassificationData

class flash.image.classification.data.ImageClassificationData(train_input=None, val_input=None, test_input=None, predict_input=None, data_fetcher=None, val_split=None, batch_size=None, num_workers=0, sampler=None, pin_memory=True, persistent_workers=True, output_transform=None)[source]

Data module for image classification tasks.

classmethod from_datasets(train_dataset=None, val_dataset=None, test_dataset=None, predict_dataset=None, train_transform=<class 'flash.image.classification.transforms.ImageClassificationInputTransform'>, val_transform=<class 'flash.image.classification.transforms.ImageClassificationInputTransform'>, test_transform=<class 'flash.image.classification.transforms.ImageClassificationInputTransform'>, predict_transform=<class 'flash.image.classification.transforms.ImageClassificationInputTransform'>, input_cls=<class 'flash.core.data.data_module.DatasetInput'>, transform_kwargs=None, **data_module_kwargs)[source]

Creates a DataModule object from the given datasets using the Input of name DATASETS from the passed or constructed InputTransform.

Parameters
  • train_dataset (Optional[Dataset]) – Dataset used during training.

  • val_dataset (Optional[Dataset]) – Dataset used during validating.

  • test_dataset (Optional[Dataset]) – Dataset used during testing.

  • predict_dataset (Optional[Dataset]) – Dataset used during predicting.

  • train_transform (~INPUT_TRANSFORM_TYPE) – The dictionary of transforms to use during training which maps InputTransform hook names to callable transforms.

  • val_transform (~INPUT_TRANSFORM_TYPE) – The dictionary of transforms to use during validation which maps InputTransform hook names to callable transforms.

  • test_transform (~INPUT_TRANSFORM_TYPE) – The dictionary of transforms to use during testing which maps InputTransform hook names to callable transforms.

  • predict_transform (~INPUT_TRANSFORM_TYPE) – The dictionary of transforms to use during predicting which maps InputTransform hook names to callable transforms.

  • input_cls (Type[Input]) – Input class used to create the datasets.

  • transform_kwargs (Optional[Dict]) – Additional keyword arguments to be used when constructing the transform.

  • data_module_kwargs (Any) – Additional keyword arguments to use when constructing the DataModule.

Return type

DataModule

Returns

The constructed data module.

Examples:

data_module = DataModule.from_datasets(
    train_dataset=train_dataset,
)
classmethod from_labelstudio(export_json=None, train_export_json=None, val_export_json=None, test_export_json=None, predict_export_json=None, data_folder=None, train_data_folder=None, val_data_folder=None, test_data_folder=None, predict_data_folder=None, train_transform=<class 'flash.image.classification.transforms.ImageClassificationInputTransform'>, val_transform=<class 'flash.image.classification.transforms.ImageClassificationInputTransform'>, test_transform=<class 'flash.image.classification.transforms.ImageClassificationInputTransform'>, predict_transform=<class 'flash.image.classification.transforms.ImageClassificationInputTransform'>, input_cls=<class 'flash.core.integrations.labelstudio.input.LabelStudioImageClassificationInput'>, transform_kwargs=None, val_split=None, multi_label=False, **data_module_kwargs)[source]

Creates a DataModule object from the given export file and data directory using the Input of name FOLDERS from the passed or constructed InputTransform.

Parameters
  • export_json (Optional[str]) – path to label studio export file

  • train_export_json (Optional[str]) – path to label studio export file for train set,

  • specified (overrides _sphinx_paramlinks_flash.image.classification.data.ImageClassificationData.from_labelstudio.data_folder if) –

  • val_export_json (Optional[str]) – path to label studio export file for validation

  • test_export_json (Optional[str]) – path to label studio export file for test

  • predict_export_json (Optional[str]) – path to label studio export file for predict

  • data_folder (Optional[str]) – path to label studio data folder

  • train_data_folder (Optional[str]) – path to label studio data folder for train data set,

  • specified

  • val_data_folder (Optional[str]) – path to label studio data folder for validation data

  • test_data_folder (Optional[str]) – path to label studio data folder for test data

  • predict_data_folder (Optional[str]) – path to label studio data folder for predict data

  • train_transform (~INPUT_TRANSFORM_TYPE) – The dictionary of transforms to use during training which maps InputTransform hook names to callable transforms.

  • val_transform (~INPUT_TRANSFORM_TYPE) – The dictionary of transforms to use during validation which maps InputTransform hook names to callable transforms.

  • test_transform (~INPUT_TRANSFORM_TYPE) – The dictionary of transforms to use during testing which maps InputTransform hook names to callable transforms.

  • predict_transform (~INPUT_TRANSFORM_TYPE) – The dictionary of transforms to use during predicting which maps InputTransform hook names to callable transforms.

  • data_fetcher – The BaseDataFetcher to pass to the DataModule.

  • input_transform – The InputTransform to pass to the DataModule. If None, cls.input_transform_cls will be constructed and used.

  • val_split (Optional[float]) – The val_split argument to pass to the DataModule.

  • multi_label (Optional[bool]) – Whether the labels are multi encoded

  • image_size – Size of the image.

  • data_module_kwargs (Any) – Additional keyword arguments to use when constructing the datamodule.

Return type

ImageClassificationData

Returns

The constructed data module.

Examples:

data_module = DataModule.from_labelstudio(
    export_json='project.json',
    data_folder='label-studio/media/upload',
    val_split=0.8,
)
input_transform_cls

alias of flash.image.classification.transforms.ImageClassificationInputTransform

set_block_viz_window(value)[source]

Setter method to switch on/off matplotlib to pop up windows.

Return type

None

Read the Docs v: stable
Versions
latest
stable
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
pdf
html
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.