finish wiring for --water-size

This commit is contained in:
Starbeamrainbowlabs 2022-10-06 19:21:50 +01:00
parent 5dac70aa08
commit 9f3ae96894
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 5 additions and 2 deletions

View file

@ -46,7 +46,7 @@ def parse_item(metadata, shape_water_desired, water_threshold=0.1):
return tf.function(parse_item_inner)
def make_dataset(filepaths, metadata, shape_watch_desired=[100,100], water_threshold=0.1, compression_type="GZIP", parallel_reads_multiplier=1.5, shuffle_buffer_size=128, batch_size=64, prefetch=True, shuffle=True):
def make_dataset(filepaths, metadata, shape_water_desired=[100,100], water_threshold=0.1, compression_type="GZIP", parallel_reads_multiplier=1.5, shuffle_buffer_size=128, batch_size=64, prefetch=True, shuffle=True):
if "NO_PREFETCH" in os.environ:
logger.info("disabling data prefetching.")
@ -56,7 +56,7 @@ def make_dataset(filepaths, metadata, shape_watch_desired=[100,100], water_thres
)
if shuffle:
dataset = dataset.shuffle(shuffle_buffer_size)
dataset = dataset.map(parse_item(metadata, shape_water_desired=shape_watch_desired, water_threshold=water_threshold), num_parallel_calls=tf.data.AUTOTUNE)
dataset = dataset.map(parse_item(metadata, shape_water_desired=shape_water_desired, water_threshold=water_threshold), num_parallel_calls=tf.data.AUTOTUNE)
if batch_size != None:
dataset = dataset.batch(batch_size, drop_remainder=True)

View file

@ -33,6 +33,8 @@ def run(args):
args.read_multiplier = 1.5
if (not hasattr(args, "water_threshold")) or args.water_threshold == None:
args.water_threshold = 1.5
if (not hasattr(args, "water_size")) or args.water_size == None:
args.water_size = 1.5
# TODO: Validate args here.
@ -43,6 +45,7 @@ def run(args):
dirpath_input=args.input,
batch_size=args.batch_size,
water_threshold=args.water_threshold,
shape_water_desired=[args.water_size, args.water_size]
)
dataset_metadata = read_metadata(args.input)