MCPcopy Create free account
hub / github.com/google-research/language / main

Function main

language/capwap/preprocessing/coco_text_planner.py:74–101  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

72
73
74def main(argv):
75 if len(argv) > 1:
76 raise app.UsageError("Too many command-line arguments.")
77
78 tf.logging.set_verbosity(tf.logging.INFO)
79 tf.io.gfile.makedirs(FLAGS.output_dir)
80
81 pattern = "%s/%s-*" % (FLAGS.sqa_path, FLAGS.split)
82 questions = load_synthetic_questions(pattern)
83
84 # Convert to ImageMetadata.
85 images = []
86 for image_id, data in questions.items():
87 metadata = image_utils.ImageMetadata(
88 image_id=image_id,
89 question_ids=data["question_ids"],
90 questions=data["questions"],
91 answers=data["answers"],
92 captions=data["captions"],
93 objects="%s/%s_features.hdf5" % (FLAGS.coco_path, FLAGS.split))
94 images.append(metadata)
95
96 # Dump to sharded TFRecords.
97 io_utils.convert_to_tfrecords(
98 dataset=images,
99 num_shards=FLAGS.num_shards,
100 basename=os.path.join(FLAGS.output_dir, FLAGS.split),
101 example_fn=io_utils.vqa_example)
102
103
104if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

load_synthetic_questionsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…