code: def get_celebA_data(datadir, styleA, styleB=None):
      def read_attr(attrfname):
          with open(attrfname) as f:
              nr_record = int(f.readline())
              headers = f.readline().strip().split()
              data = []
              for line in f:
                  line = line.strip().split()[1:]
                  line = list(map(int, line))
                  assert len(line) == len(headers)
                  data.append(line)
              assert len(data) == nr_record
              return headers, np.asarray(data, dtype="int8")
  
      headers, attrs = read_attr(
          os.path.join(datadir, "list_attr_celeba.txt")
      )
      idxA = headers.index(styleA)
      listA = np.nonzero(attrs[:, idxA] == 1)[0]
      if styleB is not None:
          idxB = headers.index(styleB)
          listB = np.nonzero(attrs[:, idxB] == 1)[0]
      else:
          listB = np.nonzero(attrs[:, idxA] == -1)[0]
  
      def get_filelist(idxlist):
          return [
              os.path.join(datadir, "{:06d}.jpg".format(x + 1))
              for x in idxlist
          ]
  
      dfA = ImageFromFile(get_filelist(listA), channel=3, shuffle=True)
      dfB = ImageFromFile(get_filelist(listB), channel=3, shuffle=True)
      df = JoinData([dfA, dfB])
      augs = [imgaug.CenterCrop(160), imgaug.Resize(64)]
      df = AugmentImageComponents(df, augs, (0, 1))
      df = BatchData(df, BATCH)
      df = MultiProcessRunnerZMQ(df, 3)
      return df
  
file_path: tensorpack/examples/GAN/DiscoGAN-CelebA.py
imports: import argparse
  import numpy
  import os
  import tensorflow
  from tensorpack import *
  from tensorpack.tfutils.scope_utils import auto_reuse_variable_scope
  from tensorpack.tfutils.summary import add_moving_summary
  from GAN import GANModelDesc, SeparateGANTrainer
label_desc: Use image node_id 2 for calling a global function with example usage: get_celebA_data(datadir, styleA, styleB) and returns: df, unknown, headers,  np