Fix dense depth loss and model, fix metric naming
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import tensorflow.keras as keras
|
||||
import tensorflow_datasets as tfds
|
||||
|
||||
import fast_depth_functional as fd
|
||||
|
||||
@@ -12,12 +11,23 @@ def dense_upsample_block(input, out_channels, skip_connection):
|
||||
x = keras.layers.Concatenate()([x, skip_connection])
|
||||
x = keras.layers.Conv2D(filters=out_channels,
|
||||
kernel_size=3, strides=1, padding='same')(x)
|
||||
x = keras.layers.LeakyReLU(alpha=0.2)(x)
|
||||
x = keras.layers.Conv2D(filters=out_channels,
|
||||
kernel_size=3, strides=1, padding='same')(x)
|
||||
return keras.layers.LeakyReLU(alpha=0.2)(x)
|
||||
|
||||
|
||||
def dense_depth(size, weights=None, shape=(224, 224, 3)):
|
||||
"""
|
||||
Make the dense depth network graph using keras functional api.
|
||||
|
||||
Note that you should use the dense depth loss function, and use Adam as the optimiser with a learning rate of 0.0001
|
||||
(default learning rate of Adam is 0.001).
|
||||
:param size:
|
||||
:param weights:
|
||||
:param shape:
|
||||
:return:
|
||||
"""
|
||||
input = keras.layers.Input(shape=shape)
|
||||
densenet = dense_net(input, size, weights, shape)
|
||||
|
||||
@@ -37,6 +47,8 @@ def dense_depth(size, weights=None, shape=(224, 224, 3)):
|
||||
decoder = dense_upsample_block(
|
||||
decoder, densenet_output_channels // 16, densenet.get_layer('conv1/relu').output)
|
||||
|
||||
decoder = dense_upsample_block(decoder, int(densenet_output_channels / 32), input)
|
||||
|
||||
conv3 = keras.layers.Conv2D(
|
||||
filters=1, kernel_size=3, strides=1, padding='same', name='conv3')(decoder)
|
||||
return keras.Model(inputs=input, outputs=conv3, name='dense_depth')
|
||||
|
||||
Reference in New Issue
Block a user