class_docstr: Liberated Pixel Cup [(LPC)][1] Sprites Dataset.
  
  This file provides logic to download and build a version of the
  sprites video sequence dataset as used in the Disentangled Sequential
  Autoencoder paper [(Li and Mandt, 2018)][2]. The dataset contains
  sprites (graphics files used to generate animated sequences) of human
  characters wearing a variety of clothing, and performing a variety of
  actions. The paper limits the dataset used for training to four
  attribute categories (skin color, hairstyles, tops, and pants), each
  of which are limited to include six variants. Thus, there are
  6^4 = 1296 possible animated characters in this dataset. The
  characters are shuffled and deterministically split such that 1000
  characters are used for the training set, and 296 are used for the
  testing set. The numbers are consistent with the paper, but the exact
  split is impossible to match given the currently available paper
  details. The actions are limited to three categories (walking,
  casting spells, and slashing), each with three viewing angles.
  Sequences of length T=8 frames are generated depicting a given
  character performing a given action, starting at a random frame in the
  sequence.
  
  Attributes:
    train: Training dataset with 1000 characters each performing an
      action.
    test: Testing dataset with 296 characters each performing an action.
  
  #### References:
  
  [1]: Liberated Pixel Cup. http://lpc.opengameart.org. Accessed:
       2018-07-20.
  [2]: Yingzhen Li and Stephan Mandt. Disentangled Sequential
       Autoencoder. In _International Conference on Machine Learning_,
       2018. https://arxiv.org/abs/1803.02991
class_docstr_tok: ["Liberated","Pixel","Cup","[","(","LPC",")","]","[","1","]","Sprites","Dataset",".","This","file","provides","logic","to","download","and","build","a","version","of","the","sprites","video","sequence","dataset","as","used","in","the","Disentangled","Sequential","Autoencoder","paper","[","(","Li","and","Mandt",",","2018",")","]","[","2","]",".","The","dataset","contains","sprites","(","graphics","files","used","to","generate","animated","sequences",")","of","human","characters","wearing","a","variety","of","clothing",",","and","performing","a","variety","of","actions",".","The","paper","limits","the","dataset","used","for","training","to","four","attribute","categories","(","skin","color",",","hairstyles",",","tops",",","and","pants",")",",","each","of","which","are","limited","to","include","six","variants",".","Thus",",","there","are","6^4","=","1296","possible","animated","characters","in","this","dataset",".","The","characters","are","shuffled","and","deterministically","split","such","that","1000","characters","are","used","for","the","training","set",",","and","296","are","used","for","the","testing","set",".","The","numbers","are","consistent","with","the","paper",",","but","the","exact","split","is","impossible","to","match","given","the","currently","available","paper","details",".","The","actions","are","limited","to","three","categories","(","walking",",","casting","spells",",","and","slashing",")",",","each","with","three","viewing","angles",".","Sequences","of","length","T=8","frames","are","generated","depicting","a","given","character","performing","a","given","action",",","starting","at","a","random","frame","in","the","sequence",".","Attributes",":","train",":","Training","dataset","with","1000","characters","each","performing","an","action",".","test",":","Testing","dataset","with","296","characters","each","performing","an","action",".","#","#","#","#","References",":","[","1","]",":","Liberated","Pixel","Cup",".","http",":","\/\/lpc.opengameart.org",".","Accessed",":","2018-07-20",".","[","2","]",":","Yingzhen","Li","and","Stephan","Mandt",".","Disentangled","Sequential","Autoencoder",".","In","_International","Conference","on","Machine","Learning_",",","2018.","https",":","\/\/arxiv.org\/abs\/1803.02991"]
docstr: Creates the SpritesDataset and stores train and test datasets.
  
  The datasets yield (seq, skin label index, hair label index, top
  label index, pants label index, action label index, skin label name,
  hair label_name, top label name, pants label name, action label
  name) tuples.
  
  Args:
    channels: Number of image channels to yield.
    shuffle_train: Boolean for whether or not to shuffle the training
      set.
    fake_data: Boolean for whether or not to yield synthetic data.
  
  Raises:
    ValueError: If the number of training or testing examples is
      incorrect, or if there is overlap betweem the two datasets.
docstr_tok: ["Creates","the","SpritesDataset","and","stores","train","and","test","datasets",".","The","datasets","yield","(","seq",",","skin","label","index",",","hair","label","index",",","top","label","index",",","pants","label","index",",","action","label","index",",","skin","label","name",",","hair","label_name",",","top","label","name",",","pants","label","name",",","action","label","name",")","tuples",".","Args",":","channels",":","Number","of","image","channels","to","yield",".","shuffle_train",":","Boolean","for","whether","or","not","to","shuffle","the","training","set",".","fake_data",":","Boolean","for","whether","or","not","to","yield","synthetic","data",".","Raises",":","ValueError",":","If","the","number","of","training","or","testing","examples","is","incorrect",",","or","if","there","is","overlap","betweem","the","two","datasets","."]
code: def __init__(self, channels=3, shuffle_train=True, fake_data=False):
      """Creates the SpritesDataset and stores train and test datasets.
  
      The datasets yield (seq, skin label index, hair label index, top
      label index, pants label index, action label index, skin label name,
      hair label_name, top label name, pants label name, action label
      name) tuples.
  
      Args:
        channels: Number of image channels to yield.
        shuffle_train: Boolean for whether or not to shuffle the training
          set.
        fake_data: Boolean for whether or not to yield synthetic data.
  
      Raises:
        ValueError: If the number of training or testing examples is
          incorrect, or if there is overlap betweem the two datasets.
      """
      super(SpritesDataset, self).__init__()
      self.frame_size = FRAME_SIZE
      self.channels = channels
      self.length = 8
      num_train = 1000
      num_test = 296
      characters = [
          (skin, hair, top, pants)
          for skin in sorted(SKIN_COLORS)
          for hair in sorted(HAIRSTYLES)
          for top in sorted(TOPS)
          for pants in sorted(PANTS)
      ]
      random.seed(42)
      random.shuffle(characters)
      train_chars = characters[:num_train]
      test_chars = characters[num_train:]
      num_train_actual = len(set(train_chars))
      num_test_actual = len(set(test_chars))
      num_train_test_overlap = len(set(train_chars) & set(test_chars))
      if num_train_actual != num_train:
          raise ValueError(
              "Unexpected number of training examples: {}.".format(
                  num_train_actual
              )
          )
      if num_test_actual != num_test:
          raise ValueError(
              "Unexpected number of testing examples: {}.".format(
                  num_test_actual
              )
          )
      if (
          num_train_test_overlap > 0
      ):  # pylint: disable=g-explicit-length-test
          raise ValueError(
              "Overlap between train and test datasets detected: {}.".format(
                  num_train_test_overlap
              )
          )
  
      self.train = create_sprites_dataset(
          train_chars,
          ACTIONS,
          DIRECTIONS,
          self.channels,
          self.length,
          shuffle=shuffle_train,
          fake_data=fake_data,
      )
      self.test = create_sprites_dataset(
          test_chars,
          ACTIONS,
          DIRECTIONS,
          self.channels,
          self.length,
          shuffle=False,
          fake_data=fake_data,
      )
  
file_path: probability/tensorflow_probability/examples/sprites_dataset.py
imports: from collections import namedtuple
  import os
  import random
  import zipfile
  from absl import flags
  from six.moves import urllib
  import tensorflow.compat.v1
  from tensorflow.python.ops import lookup_ops
label_desc: Use image node_id 1 to create a new SpritesDataset object from inherited base classes: object with example: obj = SpritesDataset(channels, shuffle_train, fake_data)