class_docstr: `Semantic Boundaries Dataset <http://home.bharathh.info/pubs/codes/SBD/download.html>`_
  
  The SBD currently contains annotations from 11355 images taken from the PASCAL VOC 2011 dataset.
  
  .. note ::
  
      Please note that the train and val splits included with this dataset are different from
      the splits in the PASCAL VOC dataset. In particular some "train" images might be part of
      VOC2012 val.
      If you are interested in testing on VOC 2012 val, then use `image_set='train_noval'`,
      which excludes all val images.
  
  .. warning::
  
      This class needs `scipy <https://docs.scipy.org/doc/>`_ to load target files from `.mat` format.
  
  Args:
      root (string): Root directory of the Semantic Boundaries Dataset
      image_set (string, optional): Select the image_set to use, ``train``, ``val`` or ``train_noval``.
          Image set ``train_noval`` excludes VOC 2012 val images.
      mode (string, optional): Select target type. Possible values 'boundaries' or 'segmentation'.
          In case of 'boundaries', the target is an array of shape `[num_classes, H, W]`,
          where `num_classes=20`.
      download (bool, optional): If true, downloads the dataset from the internet and
          puts it in root directory. If dataset is already downloaded, it is not
          downloaded again.
      transforms (callable, optional): A function/transform that takes input sample and its target as entry
          and returns a transformed version. Input sample is PIL image and target is a numpy array
          if `mode='boundaries'` or PIL image if `mode='segmentation'`.
class_docstr_tok: ["`","Semantic","Boundaries","Dataset","<","http",":","\/\/home.bharathh.info\/pubs\/codes\/SBD\/download.html",">","`","_","The","SBD","currently","contains","annotations","from","11355","images","taken","from","the","PASCAL","VOC","2011","dataset",".","..","note",":",":","Please","note","that","the","train","and","val","splits","included","with","this","dataset","are","different","from","the","splits","in","the","PASCAL","VOC","dataset",".","In","particular","some","``","train","''","images","might","be","part","of","VOC2012","val",".","If","you","are","interested","in","testing","on","VOC","2012","val",",","then","use","`","image_set='train_noval","'","`",",","which","excludes","all","val","images",".","..","warning",":",":","This","class","needs","`","scipy","<","https",":","\/\/docs.scipy.org\/doc\/",">","`","_","to","load","target","files","from","`",".mat","`","format",".","Args",":","root","(","string",")",":","Root","directory","of","the","Semantic","Boundaries","Dataset","image_set","(","string",",","optional",")",":","Select","the","image_set","to","use",",","``","train","``",",","``","val","``","or","``","train_noval","``",".","Image","set","``","train_noval","``","excludes","VOC","2012","val","images",".","mode","(","string",",","optional",")",":","Select","target","type",".","Possible","values","'boundaries","'","or","'segmentation","'",".","In","case","of","'boundaries","'",",","the","target","is","an","array","of","shape","`","[","num_classes",",","H",",","W","]","`",",","where","`","num_classes=20","`",".","download","(","bool",",","optional",")",":","If","true",",","downloads","the","dataset","from","the","internet","and","puts","it","in","root","directory",".","If","dataset","is","already","downloaded",",","it","is","not","downloaded","again",".","transforms","(","callable",",","optional",")",":","A","function\/transform","that","takes","input","sample","and","its","target","as","entry","and","returns","a","transformed","version",".","Input","sample","is","PIL","image","and","target","is","a","numpy","array","if","`","mode='boundaries","'","`","or","PIL","image","if","`","mode='segmentation","'","`","."]
code: def _get_boundaries_target(self, filepath: str) -> np.ndarray:
      mat = self._loadmat(filepath)
      return np.concatenate(
          [
              np.expand_dims(
                  mat["GTcls"][0]["Boundaries"][0][i][0].toarray(),
                  axis=0,
              )
              for i in range(self.num_classes)
          ],
          axis=0,
      )
  
file_path: vision/torchvision/datasets/sbd.py
imports: import os
  import shutil
  from typing import Any, Callable, Optional, Tuple
  import numpy
  from PIL import Image
  from .utils import download_and_extract_archive, download_url, verify_str_arg
  from .vision import VisionDataset
label_desc: Use image node_id 3 for calling the SBDataset obj's underlying member method code with example usage: obj._get_boundaries_target(filepath) and returns: np