class_docstr: `WIDERFace <http://shuoyang1213.me/WIDERFACE/>`_ Dataset.
  
  Args:
      root (string): Root directory where images and annotations are downloaded to.
          Expects the following folder structure if download=False:
  
          .. code::
  
              <root>
                  └── widerface
                      ├── wider_face_split ('wider_face_split.zip' if compressed)
                      ├── WIDER_train ('WIDER_train.zip' if compressed)
                      ├── WIDER_val ('WIDER_val.zip' if compressed)
                      └── WIDER_test ('WIDER_test.zip' if compressed)
      split (string): The dataset split to use. One of {``train``, ``val``, ``test``}.
          Defaults to ``train``.
      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.
      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.
class_docstr_tok: ["`","WIDERFace","<","http",":","\/\/shuoyang1213.me\/WIDERFACE\/",">","`","_","Dataset",".","Args",":","root","(","string",")",":","Root","directory","where","images","and","annotations","are","downloaded","to",".","Expects","the","following","folder","structure","if","download=False",":","..","code",":",":","<","root",">","\u2514\u2500\u2500","widerface","\u251c\u2500\u2500","wider_face_split","(","'wider_face_split.zip","'","if","compressed",")","\u251c\u2500\u2500","WIDER_train","(","'WIDER_train.zip","'","if","compressed",")","\u251c\u2500\u2500","WIDER_val","(","'WIDER_val.zip","'","if","compressed",")","\u2514\u2500\u2500","WIDER_test","(","'WIDER_test.zip","'","if","compressed",")","split","(","string",")",":","The","dataset","split","to","use",".","One","of","{","``","train","``",",","``","val","``",",","``","test","``","}",".","Defaults","to","``","train","``",".","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",".","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","."]
code: def parse_train_val_annotations_file(self) -> None:
      filename = (
          "wider_face_train_bbx_gt.txt"
          if self.split == "train"
          else "wider_face_val_bbx_gt.txt"
      )
      filepath = os.path.join(self.root, "wider_face_split", filename)
  
      with open(filepath) as f:
          lines = f.readlines()
          file_name_line, num_boxes_line, box_annotation_line = (
              True,
              False,
              False,
          )
          num_boxes, box_counter = 0, 0
          labels = []
          for line in lines:
              line = line.rstrip()
              if file_name_line:
                  img_path = os.path.join(
                      self.root, "WIDER_" + self.split, "images", line
                  )
                  img_path = abspath(expanduser(img_path))
                  file_name_line = False
                  num_boxes_line = True
              elif num_boxes_line:
                  num_boxes = int(line)
                  num_boxes_line = False
                  box_annotation_line = True
              elif box_annotation_line:
                  box_counter += 1
                  line_split = line.split(" ")
                  line_values = [int(x) for x in line_split]
                  labels.append(line_values)
                  if box_counter >= num_boxes:
                      box_annotation_line = False
                      file_name_line = True
                      labels_tensor = torch.tensor(labels)
                      self.img_info.append(
                          {
                              "img_path": img_path,
                              "annotations": {
                                  "bbox": labels_tensor[
                                      :, 0:4
                                  ].clone(),  # x, y, width, height
                                  "blur": labels_tensor[:, 4].clone(),
                                  "expression": labels_tensor[
                                      :, 5
                                  ].clone(),
                                  "illumination": labels_tensor[
                                      :, 6
                                  ].clone(),
                                  "occlusion": labels_tensor[
                                      :, 7
                                  ].clone(),
                                  "pose": labels_tensor[:, 8].clone(),
                                  "invalid": labels_tensor[
                                      :, 9
                                  ].clone(),
                              },
                          }
                      )
                      box_counter = 0
                      labels.clear()
              else:
                  raise RuntimeError(
                      f"Error parsing annotation file {filepath}"
                  )
  
file_path: vision/torchvision/datasets/widerface.py
imports: import os
  from os.path import abspath, expanduser
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import torch
  from PIL import Image
  from .utils import download_and_extract_archive, download_file_from_google_drive, extract_archive, verify_str_arg
  from .vision import VisionDataset
label_desc: Use image node_id 5 for calling the WIDERFace obj's underlying member method code with example usage: obj.parse_train_val_annotations_file() without return types