Shortcuts

FER2013

class torchvision.datasets.FER2013(root: Union[str, Path], split: str = 'train', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None)[source]

FER2013 Dataset.

Note

This dataset can return test labels only if fer2013.csv OR icml_face_data.csv are present in root/fer2013/. If only train.csv and test.csv are present, the test labels are set to None.

Parameters:
  • root (str or pathlib.Path) – Root directory of dataset where directory root/fer2013 exists. This directory may contain either fer2013.csv, icml_face_data.csv, or both train.csv and test.csv. Precendence is given in that order, i.e. if fer2013.csv is present then the rest of the files will be ignored. All these (combinations of) files contain the same data and are supported for convenience, but only fer2013.csv and icml_face_data.csv are able to return non-None test labels.

  • split (string, optional) – The dataset split, supports "train" (default), or "test".

  • transform (callable, optional) – A function/transform that takes in a PIL image and returns a transformed version. E.g, transforms.RandomCrop

  • target_transform (callable, optional) – A function/transform that takes in the target and transforms it.

Special-members:

__getitem__(idx: int) Tuple[Any, Any][source]
Parameters:

index (int) – Index

Returns:

Sample and meta data, optionally transformed by the respective transforms.

Return type:

(Any)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources