class_docstr: An instance of PyTorch VisionData the represents the COCO128-segments dataset.
  
  Uses only the 21 categories used also by Pascal-VOC, in order to match the model supplied in this file,
  torchvision's deeplabv3_mobilenet_v3_large.
  
  Parameters
  ----------
  root : str
      Path to the root directory of the dataset.
  name : str
      Name of the dataset.
  train : bool
      if `True` train dataset, otherwise test dataset
  transforms : Callable, optional
      A function/transform that takes in an PIL image and returns a transformed version.
      E.g, transforms.RandomCrop
class_docstr_tok: ["An","instance","of","PyTorch","VisionData","the","represents","the","COCO128-segments","dataset",".","Uses","only","the","21","categories","used","also","by","Pascal-VOC",",","in","order","to","match","the","model","supplied","in","this","file",",","torchvision","'s","deeplabv3_mobilenet_v3_large",".","Parameters","--","--","--","--","--","root",":","str","Path","to","the","root","directory","of","the","dataset",".","name",":","str","Name","of","the","dataset",".","train",":","bool","if","`","True","`","train","dataset",",","otherwise","test","dataset","transforms",":","Callable",",","optional","A","function\/transform","that","takes","in","an","PIL","image","and","returns","a","transformed","version",".","E.g",",","transforms.RandomCrop"]
docstr: Load or download the coco128 dataset with segment annotations.
docstr_tok: ["Load","or","download","the","coco128","dataset","with","segment","annotations","."]
code: def load_or_download(
      cls, train: bool, root: Path = DATA_DIR, test_mode: bool = False
  ) -> "CocoSegmentationDataset":
      """Load or download the coco128 dataset with segment annotations."""
      extract_dir = root / "coco128segments"
      coco_dir = root / "coco128segments" / "coco128-seg"
      folder = "train2017"
  
      if not coco_dir.exists():
          url = "https://ndownloader.figshare.com/files/37650656"
  
          with open(
              os.devnull, "w", encoding="utf8"
          ) as f, contextlib.redirect_stdout(f):
              download_and_extract_archive(
                  url,
                  download_root=str(root),
                  extract_root=str(extract_dir),
                  filename="coco128-segments.zip",
              )
  
          try:
              # remove coco128 README.txt so that it does not come in docs
              os.remove("coco128segments/coco128/README.txt")
          except:  # pylint: disable=bare-except # noqa
              pass
      return CocoSegmentationDataset(
          coco_dir,
          folder,
          train=train,
          transforms=A.Compose([ToTensorV2()]),
          test_mode=test_mode,
      )
  
imports: import contextlib
  import os
  import pathlib
  import typing
  from pathlib import Path
  import albumentations
  import numpy
  import torch
  import torchvision.transforms.functional
  from albumentations.pytorch.transforms import ToTensorV2
  from PIL import Image, ImageDraw
  from torch import nn
  from torch.utils.data import DataLoader
  from typing_extensions import Literal
  from deepchecks.vision.utils.test_utils import get_data_loader_sequential
  from deepchecks.vision.vision_data import BatchOutputFormat, VisionData
  from deepchecks.vision.vision_data.utils import object_to_numpy
label_desc: Use image node_id 4 for calling the CocoSegmentationDataset obj's underlying member method code with example usage: obj.load_or_download(cls, train, root, test_mode) and returns: CocoSegmentationDataset