code: def test_from_fiftyone(tmpdir):
      tmp_dir = Path(tmpdir)
  
      # create random dummy data
  
      images = [
          str(tmp_dir / "img1.png"),
          str(tmp_dir / "img2.png"),
          str(tmp_dir / "img3.png"),
      ]
  
      num_classes: int = 2
      img_size: Tuple[int, int] = (128, 128)
  
      for img_file in images:
          _rand_image(img_size).save(img_file)
  
      targets = [
          np.array(_rand_labels(img_size, num_classes))
          for _ in range(3)
      ]
  
      dataset = fo.Dataset.from_dir(
          str(tmp_dir),
          dataset_type=fo.types.ImageDirectory,
      )
  
      for idx, sample in enumerate(dataset):
          sample["ground_truth"] = fo.Segmentation(
              mask=targets[idx][:, :, 0]
          )
          sample.save()
  
      # instantiate the data module
  
      dm = SemanticSegmentationData.from_fiftyone(
          train_dataset=dataset,
          val_dataset=dataset,
          test_dataset=dataset,
          predict_dataset=dataset,
          batch_size=2,
          num_workers=0,
          num_classes=num_classes,
      )
      assert dm is not None
      assert dm.train_dataloader() is not None
      assert dm.val_dataloader() is not None
      assert dm.test_dataloader() is not None
  
      # check training data
      data = next(iter(dm.train_dataloader()))
      imgs, labels = data[DataKeys.INPUT], data[DataKeys.TARGET]
      assert imgs.shape == (2, 3, 128, 128)
      assert labels.shape == (2, 128, 128)
  
      # check val data
      data = next(iter(dm.val_dataloader()))
      imgs, labels = data[DataKeys.INPUT], data[DataKeys.TARGET]
      assert imgs.shape == (2, 3, 128, 128)
      assert labels.shape == (2, 128, 128)
  
      # check test data
      data = next(iter(dm.test_dataloader()))
      imgs, labels = data[DataKeys.INPUT], data[DataKeys.TARGET]
      assert imgs.shape == (2, 3, 128, 128)
      assert labels.shape == (2, 128, 128)
  
      # check predict data
      data = next(iter(dm.predict_dataloader()))
      imgs = data[DataKeys.INPUT]
      assert imgs.shape == (2, 3, 128, 128)
  
imports: import os
  from pathlib import Path
  from typing import Callable, Dict, List, Tuple
  import numpy
  import pytest
  import torch
  from flash import Trainer
  from flash.core.data.io.input import DataKeys
  from flash.core.data.io.input_transform import InputTransform
  from flash.core.data.transforms import ApplyToKeys
  from flash.core.utilities.imports import _FIFTYONE_AVAILABLE, _MATPLOTLIB_AVAILABLE, _PIL_AVAILABLE, _SEGMENTATION_MODELS_AVAILABLE, _TOPIC_IMAGE_AVAILABLE
  from flash.image import SemanticSegmentation, SemanticSegmentationData
label_desc: Use image node_id 8 for calling the TestSemanticSegmentationData obj's underlying member method code with example usage: obj.test_from_fiftyone(tmpdir) without return types