properly handle water dimensions; add log files to .gitignore

TODO: add heightmap
This commit is contained in:
Starbeamrainbowlabs 2022-08-31 18:03:39 +01:00
parent 5846828f9e
commit 654eefd9ca
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 13 additions and 4 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
*.err
*.out
*.log
output output
# Created by https://www.toptal.com/developers/gitignore/api/python,node,git,visualstudiocode # Created by https://www.toptal.com/developers/gitignore/api/python,node,git,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=python,node,git,visualstudiocode # Edit at https://www.toptal.com/developers/gitignore?templates=python,node,git,visualstudiocode

View file

@ -3,8 +3,8 @@
#SBATCH -N 1 #SBATCH -N 1
#SBATCH -n 4 #SBATCH -n 4
#SBATCH --gres=gpu:1 #SBATCH --gres=gpu:1
#SBATCH -o %j.%N.%a.out #SBATCH -o %j.%N.%a.out.log
#SBATCH -e %j.%N.%a.err #SBATCH -e %j.%N.%a.err.log
#SBATCH -p gpu05 #SBATCH -p gpu05
#SBATCH --time=5-00:00:00 #SBATCH --time=5-00:00:00
#SBATCH --exclusive #SBATCH --exclusive

View file

@ -9,8 +9,11 @@ from .components.LossContrastive import LossContrastive
def model_rainfallwater_contrastive(shape_rainfall, shape_water, feature_dim=200): def model_rainfallwater_contrastive(shape_rainfall, shape_water, feature_dim=200):
logger.info(shape_rainfall) logger.info(shape_rainfall)
logger.info(shape_water) logger.info(shape_water)
rainfall_width, rainfall_height, rainfall_channels = shape_rainfall
water_width, water_height, water_channels = shape_water # Shapes come from what rainfallwrangler sees them as, but we add an extra dimension when reading the .tfrecord file
rainfall_width, rainfall_height, rainfall_channels = shape_rainfall # shape = [width, height, channels]
water_width, water_height = shape_water # shape = [width, height]
water_channels = 1 # added in dataset → make_dataset → parse_item
input_rainfall = tf.keras.layers.Input( input_rainfall = tf.keras.layers.Input(
shape=shape_rainfall shape=shape_rainfall

View file

@ -20,6 +20,9 @@ def parse_item(item):
rainfall = tf.io.parse_tensor(parsed["rainfallradar"], out_type=tf.float32) rainfall = tf.io.parse_tensor(parsed["rainfallradar"], out_type=tf.float32)
water = tf.io.parse_tensor(parsed["waterdepth"], out_type=tf.float32) water = tf.io.parse_tensor(parsed["waterdepth"], out_type=tf.float32)
# [width, height] → [width, height, channels]
water = tf.expand_dims(water, axis=-1)
# 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
# TODO: Any other additional parsing here, since multiple .map() calls are not optimal # TODO: Any other additional parsing here, since multiple .map() calls are not optimal