mirror of
https://github.com/sbrl/research-rainfallradar
synced 2024-11-25 10:32:59 +00:00
ai dataset: centre crop the water data to 75% original size
this should both help the model and reduce memory usage
This commit is contained in:
parent
efe41b96ec
commit
ad156a9a00
1 changed files with 2 additions and 1 deletions
|
@ -28,9 +28,10 @@ def parse_item(metadata):
|
||||||
water = tf.reshape(water, tf.constant(metadata["waterdepth"], dtype=tf.int32))
|
water = tf.reshape(water, tf.constant(metadata["waterdepth"], dtype=tf.int32))
|
||||||
|
|
||||||
rainfall = tf.transpose(rainfall, [1, 2, 0])
|
rainfall = tf.transpose(rainfall, [1, 2, 0])
|
||||||
|
rainfall = tf.image.resize(rainfall, tf.cast(tf.constant(metadata["waterdepth"]) / 2, dtype=tf.int32))
|
||||||
# [width, height] → [width, height, channels]
|
# [width, height] → [width, height, channels]
|
||||||
water = tf.expand_dims(water, axis=-1)
|
water = tf.expand_dims(water, axis=-1)
|
||||||
rainfall = tf.image.resize(rainfall, tf.cast(tf.constant(metadata["waterdepth"]) / 2, dtype=tf.int32))
|
water = tf.image.central_crop(water, 0.75) # Predict for only the centre 75% of the water data
|
||||||
|
|
||||||
# TODO: The shape of the resulting tensor can't be statically determined, so we need to reshape here
|
# 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)
|
print("DEBUG:dataset ITEM rainfall:shape", rainfall.shape, "water:shape", water.shape)
|
||||||
|
|
Loading…
Reference in a new issue