def _get_filenames_and_classes(dataset_dir):
 flower_root = os.path.join(dataset_dir, 'flower_photos')
 directories = []
 class_names = []
 for filename in os.listdir(flower_root):
  path = os.path.join(flower_root, filename)
  if os.path.isdir(path):
   directories.append(path)
   class_names.append(filename)
 photo_filenames = []
 for directory in directories:
  for filename in os.listdir(directory):
   path = os.path.join(directory, filename)
   photo_filenames.append(path)
 return (photo_filenames, sorted(class_names))

def _get_filenames_and_classes ( dataset_dir ) : flower_root = os . path . join ( dataset_dir , 'flower_photos' ) directories = [ ] class_names = [ ] for filename in os . listdir ( flower_root ) : path = os . path . join ( flower_root , filename ) if os . path . isdir ( path ) : directories . append ( path ) class_names . append ( filename ) photo_filenames = [ ] for directory in directories : for filename in os . listdir ( directory ) : path = os . path . join ( directory , filename ) photo_filenames . append ( path ) return ( photo_filenames , sorted ( class_names ) )
returns a list of filenames and inferred class names .