class_docstr: Face data set for model training and validating
  
  Examples:
  
      ./CelebAMask
          |---test
          |---train
              |---images
                  |---0.jpg
                  |---1.jpg
              |---labels
                  |---0.png
                  |---1.png
              |---edges
                  |---0.png
                  |---1.png
          |---valid
          |---label_names.txt
          |---test_list.txt
          |---train_list.txt
              |---images/0.jpg labels/0.png
              |---images/1.jpg labels/1.png
          |---valid_list.txt
  
  Args:
    root: A string, training/validating dataset path, e.g. "./CelebAMask"
    dataset: A string, one of `"train"`, `"test"`, `"valid"`.
    crop_size: A list of two intergers.
    scale_factor: A float number.
    rotation_factor: An integer number.
    ignore_label: An integer number, default is 255.
    transformer: A function of torchvision.transforms.Compose([])
class_docstr_tok: ["Face","data","set","for","model","training","and","validating","Examples",":",".\/CelebAMask","|","--","-test","|","--","-train","|","--","-images","|","--","-0.jpg","|","--","-1.jpg","|","--","-labels","|","--","-0.png","|","--","-1.png","|","--","-edges","|","--","-0.png","|","--","-1.png","|","--","-valid","|","--","-label_names.txt","|","--","-test_list.txt","|","--","-train_list.txt","|","--","-images\/0.jpg","labels\/0.png","|","--","-images\/1.jpg","labels\/1.png","|","--","-valid_list.txt","Args",":","root",":","A","string",",","training\/validating","dataset","path",",","e.g",".","``",".\/CelebAMask","''","dataset",":","A","string",",","one","of","`","``","train","''","`",",","`","``","test","''","`",",","`","``","valid","''","`",".","crop_size",":","A","list","of","two","intergers",".","scale_factor",":","A","float","number",".","rotation_factor",":","An","integer","number",".","ignore_label",":","An","integer","number",",","default","is","255.","transformer",":","A","function","of","torchvision.transforms.Compose","(","[","]",")"]
code: def __init__(
      self,
      root: str,
      dataset: str,
      crop_size: list = [473, 473],
      scale_factor: float = 0.25,
      rotation_factor: int = 30,
      ignore_label: int = 255,
      transform=None,
  ) -> None:
      self.root = root
      self.dataset = dataset
      self.crop_size = np.asarray(crop_size)
      self.scale_factor = scale_factor
      self.rotation_factor = rotation_factor
      self.ignore_label = ignore_label
      self.transform = transform
  
      self.flip_prob = 0.5
      self.flip_pairs = [[4, 5], [6, 7]]
      self.aspect_ratio = crop_size[1] * 1.0 / crop_size[0]
  
      self.file_list_name = osp.join(root, dataset + "_list.txt")
      self.im_list = [
          line.split()[0][7:-4]
          for line in open(self.file_list_name).readlines()
      ]
      self.number_samples = len(self.im_list)
  
file_path: insightface/parsing/dml_csr/dataset/datasets.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import cv2
  import numpy
  import os.path
  import pickle
  import random
  import torch
  import torchvision.transforms.functional
  from glob import glob
  from typing import Tuple
  from utils import transforms
label_desc: Use image node_id 1 to create a new FaceDataSet object from inherited base classes: torch.utils.data with example: obj = FaceDataSet(root, dataset, crop_size, scale_factor, rotation_factor, ignore_label, transform)