def _walk_omniglot_dir(directory):
  """Walk an Omniglot directory and yield examples."""
  directory = os.path.join(directory, tf.io.gfile.listdir(directory)[0])
  alphabets = sorted(tf.io.gfile.listdir(directory))
  for alphabet in alphabets:
    alphabet_dir = os.path.join(directory, alphabet)
    characters = sorted(tf.io.gfile.listdir(alphabet_dir))
    for character in characters:
      character_id = int(character[len("character"):]) - 1
      character_dir = os.path.join(alphabet_dir, character)
      images = tf.io.gfile.listdir(character_dir)
      for image in images:
        label, _ = image.split("_")
        label = int(label) - 1
        image_path = os.path.join(character_dir, image)
        yield alphabet, character_id, label, image_path
def _walk_omniglot_dir ( directory ) : directory = os . path . join ( directory , tf . io . gfile . listdir ( directory ) [ 0 ] ) alphabets = sorted ( tf . io . gfile . listdir ( directory ) ) for alphabet in alphabets : alphabet_dir = os . path . join ( directory , alphabet ) characters = sorted ( tf . io . gfile . listdir ( alphabet_dir ) ) for character in characters : character_id = int ( character [ len ( "character" ) : ] ) - 1 character_dir = os . path . join ( alphabet_dir , character ) images = tf . io . gfile . listdir ( character_dir ) for image in images : label , _ = image . split ( "_" ) label = int ( label ) - 1 image_path = os . path . join ( character_dir , image ) yield alphabet , character_id , label , image_path
Walk an Omniglot directory and yield examples.