From 596084bf43ff85acdf82b01f12ba1d7051fd6590 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Wed, 7 Aug 2024 12:08:00 -0400 Subject: [PATCH] Create the output directory if it doesn't already exist. Otherwise, the script fails if it doesn't exist. --- research/delf/delf/python/training/build_image_dataset.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/research/delf/delf/python/training/build_image_dataset.py b/research/delf/delf/python/training/build_image_dataset.py index 5716933e384..2ed5b4ba897 100644 --- a/research/delf/delf/python/training/build_image_dataset.py +++ b/research/delf/delf/python/training/build_image_dataset.py @@ -49,6 +49,7 @@ import csv import os +import pathlib from absl import app from absl import flags @@ -476,6 +477,10 @@ def _build_test_tfrecord_dataset(csv_path, image_dir): def main(unused_argv): + # Create the output directory if it does not exist. + directory_path = pathlib.Path(FLAGS.output_directory) + directory_path.mkdir(parents=True, exist_ok=True) + _build_train_tfrecord_dataset(FLAGS.train_csv_path, FLAGS.train_clean_csv_path, FLAGS.train_directory,