mirror of
https://github.com/sbrl/research-rainfallradar
synced 2024-11-22 01:12:59 +00:00
ai: how did things get this confusing
This commit is contained in:
parent
1c5defdcd6
commit
1d1533d160
2 changed files with 3 additions and 4 deletions
|
@ -14,7 +14,7 @@ def model_rainfallwater_contrastive(metadata, shape_water, batch_size=64, featur
|
|||
water_width, water_height = shape_water # shape = [width, height]
|
||||
water_channels = 1 # added in dataset → make_dataset → parse_item
|
||||
|
||||
rainfall_width, rainfall_height = math.floor(rainfall_width / 2), math.floor(rainfall_height / 2)
|
||||
# rainfall_width, rainfall_height = math.floor(rainfall_width / 2), math.floor(rainfall_height / 2)
|
||||
|
||||
logger.info("SOURCE shape_rainfall " + str(metadata["rainfallradar"]))
|
||||
logger.info("SOURCE shape_water " + str(metadata["waterdepth"]))
|
||||
|
|
|
@ -31,13 +31,12 @@ def parse_item(metadata, shape_water_desired):
|
|||
rainfall = tf.reshape(rainfall, tf.constant(metadata["rainfallradar"], dtype=tf.int32))
|
||||
water = tf.reshape(water, tf.constant(metadata["waterdepth"], dtype=tf.int32))
|
||||
|
||||
rainfall = tf.transpose(rainfall, [1, 2, 0])
|
||||
rainfall = tf.image.resize(rainfall, tf.cast(tf.constant(metadata["waterdepth"]) / 2, dtype=tf.int32))
|
||||
rainfall = tf.transpose(rainfall, [1, 2, 0]) # channels_first → channels_last
|
||||
# rainfall = tf.image.resize(rainfall, tf.cast(tf.constant(metadata["rainfallradar"]) / 2, dtype=tf.int32))
|
||||
|
||||
water = tf.expand_dims(water, axis=-1) # [width, height] → [width, height, channels]
|
||||
water = tf.image.crop_to_bounding_box(water, water_offset_x, water_offset_y, water_width_target, water_height_target)
|
||||
|
||||
# TODO: The shape of the resulting tensor can't be statically determined, so we need to reshape here
|
||||
print("DEBUG:dataset ITEM rainfall:shape", rainfall.shape, "water:shape", water.shape)
|
||||
# TODO: Any other additional parsing here, since multiple .map() calls are not optimal
|
||||
return ((rainfall, water), tf.ones(1))
|
||||
|
|
Loading…
Reference in a new issue