code: def create_celeba(tfrecord_dir, celeba_dir, cx=89, cy=121):
      print('Loading CelebA from "%s"' % celeba_dir)
      glob_pattern = os.path.join(
          celeba_dir, "img_align_celeba_png", "*.png"
      )
      image_filenames = sorted(glob.glob(glob_pattern))
      expected_images = 202599
      if len(image_filenames) != expected_images:
          error("Expected to find %d images" % expected_images)
  
      with TFRecordExporter(tfrecord_dir, len(image_filenames)) as tfr:
          order = tfr.choose_shuffled_order()
          for idx in range(order.size):
              img = np.asarray(
                  PIL.Image.open(image_filenames[order[idx]])
              )
              assert img.shape == (218, 178, 3)
              img = img[cy - 64 : cy + 64, cx - 64 : cx + 64]
              img = img.transpose(2, 0, 1)  # HWC => CHW
              tfr.add_image(img)
  
imports: import os
  import sys
  import glob
  import argparse
  import threading
  import six.moves.queue
  import traceback
  import numpy
  import tensorflow
  import PIL.Image
  import dnnlib.tflib
  from training import dataset
label_desc: Use image node_id 12 for calling a global function with example usage: create_celeba(tfrecord_dir, celeba_dir, cx, cy) without return types