Skip to content

Commit

Permalink
Minor changes to train_acd.py & processing.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mjevans26 committed Jan 4, 2021
1 parent 5012dd5 commit db6af9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions azure/train_acd.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

LR = args.learning_rate
WEIGHT = args.weight
BANDS = ['B2', 'B3', 'B3', 'B8', 'B2_1', 'B3_1', 'B4_1', 'B8_1']
BANDS = ['B2', 'B3', 'B4', 'B8', 'B2_1', 'B3_1', 'B4_1', 'B8_1']
RESPONSE = args.response
OPTIMIZER = tf.keras.optimizers.Adam(learning_rate=LR, beta_1=0.9, beta_2=0.999)
LOSS = model.weighted_bce(WEIGHT)
Expand Down Expand Up @@ -66,8 +66,8 @@
)

# create special folders './outputs' and './logs' which automatically get saved
os.makedirs('outputs', exists_OK = True)
os.makedirs('logs', exists_OK = True)
os.makedirs('outputs', exist_ok = True)
os.makedirs('logs', exist_ok = True)
out_dir = './outputs'
log_dir = './logs'

Expand All @@ -86,12 +86,14 @@
)

# define a tensorboard callback to write training logs
tensorboard = tf.keras.callbacks.Tensorboard(log_dir = log_dir)
tensorboard = tf.keras.callbacks.TensorBoard(log_dir = log_dir)

# train the model
m.train(
m.fit(
x = training,
epochs = args.epochs,
#TODO: make command line argument for size
steps_per_epoch = int(63*16),
validation_data = evaluation,
callbacks = [checkpoint, tensorboard]
)
Expand Down
2 changes: 1 addition & 1 deletion utils/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def augImg(img):
outDims = tf.shape(img)[0:1]
x = tf.image.random_flip_left_right(img)
x = tf.image.random_flip_up_down(x)
x = tf.image.rot90(x, tf.random_uniform(shape=[], minval=0, maxval=4, dtype=tf.int32))
x = tf.image.rot90(x, tf.random.uniform(shape=[], minval=0, maxval=4, dtype=tf.int32))
#x = zoom(x, outDims)
#since were gonna map_fn this on a 4d image, output must be 3d, so squeeze the artificial 'sample' dimension
return tf.squeeze(x)
Expand Down

0 comments on commit db6af9c

Please sign in to comment.