class_docstr: The TinyImageNet classification dataset, with 200 classes and 500 images
  per class. See https://tiny-imagenet.herokuapp.com/.
  
  It produces [image, label] where image is a 64x64x3(BGR) image, label is an
  integer in [0, 200).
class_docstr_tok: ["The","TinyImageNet","classification","dataset",",","with","200","classes","and","500","images","per","class",".","See","https",":","\/\/tiny-imagenet.herokuapp.com\/",".","It","produces","[","image",",","label","]","where","image","is","a","64x64x3","(","BGR",")","image",",","label","is","an","integer","in","[","0",",","200",")","."]
docstr: Args:
      dir (str): a directory
      name (str): one of 'train' or 'val'
      shuffle (bool): shuffle the dataset.
          Defaults to True if name=='train'.
docstr_tok: ["Args",":","dir","(","str",")",":","a","directory","name","(","str",")",":","one","of","'train","'","or","'val'","shuffle","(","bool",")",":","shuffle","the","dataset",".","Defaults","to","True","if","name=='train","'","."]
code: def __init__(self, dir, name, shuffle=None):
      """
      Args:
          dir (str): a directory
          name (str): one of 'train' or 'val'
          shuffle (bool): shuffle the dataset.
              Defaults to True if name=='train'.
      """
      assert name in ["train", "val"], name
      dir = Path(os.path.expanduser(dir))
      assert os.path.isdir(dir), dir
      self.full_dir = dir / name
      if shuffle is None:
          shuffle = name == "train"
      self.shuffle = shuffle
  
      with open(dir / "wnids.txt") as f:
          wnids = [x.strip() for x in f.readlines()]
      cls_to_id = {name: id for id, name in enumerate(wnids)}
      assert len(cls_to_id) == 200
  
      self.imglist = []
      if name == "train":
          for clsid, cls in enumerate(wnids):
              cls_dir = self.full_dir / cls / "images"
              for img in cls_dir.iterdir():
                  self.imglist.append((str(img), clsid))
      else:
          with open(self.full_dir / "val_annotations.txt") as f:
              for line in f:
                  line = line.strip().split()
                  img, cls = line[0], line[1]
                  img = self.full_dir / "images" / img
                  clsid = cls_to_id[cls]
                  self.imglist.append((str(img), clsid))
  
imports: import numpy
  import os
  import tarfile
  import tqdm
  from pathlib import Path
  from ...utils import logger
  from ...utils.fs import download, get_dataset_path, mkdir_p
  from ...utils.loadcaffe import get_caffe_pb
  from ...utils.timer import timed_operation
  from ..base import RNGDataFlow
label_desc: Use image node_id 1 to create a new TinyImageNet object from inherited base classes: RNGDataFlow with example: obj = TinyImageNet(dir, name, shuffle)