In [1]:
import sys
sys.path.insert(0, '../models')
In [2]:
from UFCNN_functional import ufcnn_model_concat, ufcnn_model_deconv
Using TensorFlow backend.
In [3]:
from keras.optimizers import RMSprop
In [4]:
rmsprop = RMSprop (lr=0.000005, rho=0.9, epsilon=1e-06)
In [5]:
model_c = ufcnn_model_concat(regression = False, output_dim=3, features=4,
loss="categorical_crossentropy", sequence_length=500, optimizer=rmsprop )
____________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
====================================================================================================
input (InputLayer) (None, None, 4) 0
____________________________________________________________________________________________________
zeropadding1d_1 (ZeroPadding1D) (None, None, 4) 0 input[0][0]
____________________________________________________________________________________________________
convolution1d_1 (Convolution1D) (None, None, 150) 3150 zeropadding1d_1[0][0]
____________________________________________________________________________________________________
activation_1 (Activation) (None, None, 150) 0 convolution1d_1[0][0]
____________________________________________________________________________________________________
convolution1d_2 (Convolution1D) (None, None, 150) 112650 activation_1[0][0]
____________________________________________________________________________________________________
activation_2 (Activation) (None, None, 150) 0 convolution1d_2[0][0]
____________________________________________________________________________________________________
convolution1d_3 (Convolution1D) (None, None, 150) 112650 activation_2[0][0]
____________________________________________________________________________________________________
activation_3 (Activation) (None, None, 150) 0 convolution1d_3[0][0]
____________________________________________________________________________________________________
convolution1d_4 (Convolution1D) (None, None, 150) 112650 activation_3[0][0]
____________________________________________________________________________________________________
activation_4 (Activation) (None, None, 150) 0 convolution1d_4[0][0]
____________________________________________________________________________________________________
convolution1d_5 (Convolution1D) (None, None, 150) 112650 activation_4[0][0]
____________________________________________________________________________________________________
activation_5 (Activation) (None, None, 150) 0 convolution1d_5[0][0]
____________________________________________________________________________________________________
merge_1 (Merge) (None, None, 150) 0 activation_3[0][0]
activation_5[0][0]
____________________________________________________________________________________________________
convolution1d_6 (Convolution1D) (None, None, 150) 112650 merge_1[0][0]
____________________________________________________________________________________________________
activation_6 (Activation) (None, None, 150) 0 convolution1d_6[0][0]
____________________________________________________________________________________________________
merge_2 (Merge) (None, None, 150) 0 activation_2[0][0]
activation_6[0][0]
____________________________________________________________________________________________________
convolution1d_7 (Convolution1D) (None, None, 150) 112650 merge_2[0][0]
____________________________________________________________________________________________________
activation_7 (Activation) (None, None, 150) 0 convolution1d_7[0][0]
____________________________________________________________________________________________________
merge_3 (Merge) (None, None, 150) 0 activation_1[0][0]
activation_7[0][0]
____________________________________________________________________________________________________
convolution1d_8 (Convolution1D) (None, None, 150) 112650 merge_3[0][0]
____________________________________________________________________________________________________
activation_8 (Activation) (None, None, 150) 0 convolution1d_8[0][0]
____________________________________________________________________________________________________
convolution1d_9 (Convolution1D) (None, None, 3) 225003 activation_8[0][0]
____________________________________________________________________________________________________
activation_9 (Activation) (None, None, 3) 0 convolution1d_9[0][0]
====================================================================================================
Total params: 1016703
____________________________________________________________________________________________________
None
In [6]:
model_d = ufcnn_model_deconv(regression = False, output_dim=3, features=4,
loss="categorical_crossentropy", sequence_length=500, optimizer=rmsprop )
Weights shape (filter_height, filter_width, nb_filter, input_dim): (1, 5, 150, 4)
input_lenght: Tensor("Squeeze_35:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_11:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_66:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_67:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_68:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_8:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_69:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_70:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_71:0", shape=(3,), dtype=int32)
input_lenght: 500, filter_size: 5, border_mode: same, stride: 2
Output length: 1000
Weights shape (filter_height, filter_width, nb_filter, input_dim): (1, 5, 150, 150)
input_lenght: Tensor("Squeeze_38:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_12:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_74:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_75:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_76:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_9:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_77:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_78:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_79:0", shape=(3,), dtype=int32)
input_lenght: 1000, filter_size: 5, border_mode: same, stride: 2
Output length: 2000
Weights shape (filter_height, filter_width, nb_filter, input_dim): (1, 5, 150, 150)
input_lenght: Tensor("Squeeze_41:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_13:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_82:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_83:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_84:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_10:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_85:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_86:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_87:0", shape=(3,), dtype=int32)
input_lenght: 2000, filter_size: 5, border_mode: same, stride: 2
Output length: 4000
Weights shape (filter_height, filter_width, nb_filter, input_dim): (1, 5, 150, 150)
input_lenght: Tensor("Squeeze_44:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_14:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_90:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_91:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_92:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_11:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_93:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_94:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_95:0", shape=(3,), dtype=int32)
input_lenght: 4000, filter_size: 5, border_mode: same, stride: 2
Output length: 8000
input_lenght: Tensor("Squeeze_52:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_15:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_98:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_99:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_100:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_12:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_101:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_102:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_103:0", shape=(3,), dtype=int32)
input_lenght: 500, filter_size: 5, border_mode: same, stride: 2
Output length: 1000
input_lenght: Tensor("Squeeze_55:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_16:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_106:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_107:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_108:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_13:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_109:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_110:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_111:0", shape=(3,), dtype=int32)
input_lenght: 1000, filter_size: 5, border_mode: same, stride: 2
Output length: 2000
input_lenght: Tensor("Squeeze_58:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_17:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_114:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_115:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_116:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_14:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_117:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_118:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_119:0", shape=(3,), dtype=int32)
input_lenght: 2000, filter_size: 5, border_mode: same, stride: 2
Output length: 4000
input_lenght: Tensor("Squeeze_61:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_18:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_122:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_123:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_124:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_15:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_125:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_126:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_127:0", shape=(3,), dtype=int32)
input_lenght: 4000, filter_size: 5, border_mode: same, stride: 2
Output length: 8000
____________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
====================================================================================================
input (InputLayer) (None, 500, 4) 0
____________________________________________________________________________________________________
conv1 (Convolution1D_Transpose_Arbi(None, 1000, 150) 3150 input[0][0]
____________________________________________________________________________________________________
relu1 (Activation) (None, 1000, 150) 0 conv1[0][0]
____________________________________________________________________________________________________
conv2 (Convolution1D_Transpose_Arbi(None, 2000, 150) 112650 relu1[0][0]
____________________________________________________________________________________________________
relu2 (Activation) (None, 2000, 150) 0 conv2[0][0]
____________________________________________________________________________________________________
conv3 (Convolution1D_Transpose_Arbi(None, 4000, 150) 112650 relu2[0][0]
____________________________________________________________________________________________________
relu3 (Activation) (None, 4000, 150) 0 conv3[0][0]
____________________________________________________________________________________________________
conv4 (Convolution1D_Transpose_Arbi(None, 8000, 150) 112650 relu3[0][0]
____________________________________________________________________________________________________
relu4 (Activation) (None, 8000, 150) 0 conv4[0][0]
____________________________________________________________________________________________________
conv5 (Convolution1D) (None, 4000, 150) 112650 relu4[0][0]
____________________________________________________________________________________________________
relu5 (Activation) (None, 4000, 150) 0 conv5[0][0]
____________________________________________________________________________________________________
merge6 (Merge) (None, 4000, 300) 0 relu3[0][0]
relu5[0][0]
____________________________________________________________________________________________________
conv6 (Convolution1D) (None, 2000, 150) 225150 merge6[0][0]
____________________________________________________________________________________________________
relu6 (Activation) (None, 2000, 150) 0 conv6[0][0]
____________________________________________________________________________________________________
merge7 (Merge) (None, 2000, 300) 0 relu2[0][0]
relu6[0][0]
____________________________________________________________________________________________________
conv7 (Convolution1D) (None, 1000, 150) 225150 merge7[0][0]
____________________________________________________________________________________________________
relu7 (Activation) (None, 1000, 150) 0 conv7[0][0]
____________________________________________________________________________________________________
merge8 (Merge) (None, 1000, 300) 0 relu1[0][0]
relu7[0][0]
____________________________________________________________________________________________________
conv8 (Convolution1D) (None, 500, 150) 225150 merge8[0][0]
____________________________________________________________________________________________________
relu8 (Activation) (None, 500, 150) 0 conv8[0][0]
____________________________________________________________________________________________________
conv9 (Convolution1D) (None, 500, 3) 225003 relu8[0][0]
____________________________________________________________________________________________________
activation (Activation) (None, 500, 3) 0 conv9[0][0]
====================================================================================================
Total params: 1354203
____________________________________________________________________________________________________
None
In [6]:
model_d = ufcnn_model_deconv(regression = False, output_dim=3, features=4,
loss="categorical_crossentropy", sequence_length=500, optimizer=rmsprop )
Weights shape (filter_height, filter_width, nb_filter, input_dim): (1, 5, 150, 4)
input_lenght: Tensor("Squeeze_19:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_3:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_2:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_3:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_4:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_5:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_6:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_7:0", shape=(3,), dtype=int32)
input_lenght: None, filter_size: 5, border_mode: same, stride: 2
Output length: None
Weights shape (filter_height, filter_width, nb_filter, input_dim): (1, 5, 150, 150)
input_lenght: Tensor("Squeeze_22:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_4:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_10:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_11:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_12:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_1:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_13:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_14:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_15:0", shape=(3,), dtype=int32)
input_lenght: None, filter_size: 5, border_mode: same, stride: 2
Output length: None
Weights shape (filter_height, filter_width, nb_filter, input_dim): (1, 5, 150, 150)
input_lenght: Tensor("Squeeze_25:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_5:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_18:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_19:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_20:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_2:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_21:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_22:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_23:0", shape=(3,), dtype=int32)
input_lenght: None, filter_size: 5, border_mode: same, stride: 2
Output length: None
Weights shape (filter_height, filter_width, nb_filter, input_dim): (1, 5, 150, 150)
input_lenght: Tensor("Squeeze_28:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_6:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_26:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_27:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_28:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_3:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_29:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_30:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_31:0", shape=(3,), dtype=int32)
input_lenght: None, filter_size: 5, border_mode: same, stride: 2
Output length: None
input_lenght: Tensor("Squeeze_36:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_7:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_34:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_35:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_36:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_4:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_37:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_38:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_39:0", shape=(3,), dtype=int32)
input_lenght: None, filter_size: 5, border_mode: same, stride: 2
Output length: None
input_lenght: Tensor("Squeeze_39:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_8:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_42:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_43:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_44:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_5:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_45:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_46:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_47:0", shape=(3,), dtype=int32)
input_lenght: None, filter_size: 5, border_mode: same, stride: 2
Output length: None
input_lenght: Tensor("Squeeze_42:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_9:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_50:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_51:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_52:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_6:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_53:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_54:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_55:0", shape=(3,), dtype=int32)
input_lenght: None, filter_size: 5, border_mode: same, stride: 2
Output length: None
input_lenght: Tensor("Squeeze_45:0", shape=(), dtype=int32), filter_size: 5, border_mode: same, stride: 2
Output width: Tensor("mul_10:0", shape=(), dtype=int32)
Input shape: Tensor("Shape_58:0", shape=(3,), dtype=int32)
Input shape after expand: Tensor("Shape_59:0", shape=(4,), dtype=int32)
Input shape after permute: Tensor("Shape_60:0", shape=(4,), dtype=int32)
Deconv shape: Tensor("pack_7:0", shape=(4,), dtype=int32)
Output shape: Tensor("Shape_61:0", shape=(4,), dtype=int32)
Output shape after permute: Tensor("Shape_62:0", shape=(4,), dtype=int32)
Output shape after squeeze: Tensor("Shape_63:0", shape=(3,), dtype=int32)
input_lenght: None, filter_size: 5, border_mode: same, stride: 2
Output length: None
____________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
====================================================================================================
input (InputLayer) (None, None, 4) 0
____________________________________________________________________________________________________
conv1 (Convolution1D_Transpose_Arbi(None, None, 150) 3150 input[0][0]
____________________________________________________________________________________________________
relu1 (Activation) (None, None, 150) 0 conv1[0][0]
____________________________________________________________________________________________________
conv2 (Convolution1D_Transpose_Arbi(None, None, 150) 112650 relu1[0][0]
____________________________________________________________________________________________________
relu2 (Activation) (None, None, 150) 0 conv2[0][0]
____________________________________________________________________________________________________
conv3 (Convolution1D_Transpose_Arbi(None, None, 150) 112650 relu2[0][0]
____________________________________________________________________________________________________
relu3 (Activation) (None, None, 150) 0 conv3[0][0]
____________________________________________________________________________________________________
conv4 (Convolution1D_Transpose_Arbi(None, None, 150) 112650 relu3[0][0]
____________________________________________________________________________________________________
relu4 (Activation) (None, None, 150) 0 conv4[0][0]
____________________________________________________________________________________________________
conv5 (Convolution1D) (None, None, 150) 112650 relu4[0][0]
____________________________________________________________________________________________________
relu5 (Activation) (None, None, 150) 0 conv5[0][0]
____________________________________________________________________________________________________
merge6 (Merge) (None, None, 300) 0 relu3[0][0]
relu5[0][0]
____________________________________________________________________________________________________
conv6 (Convolution1D) (None, None, 150) 225150 merge6[0][0]
____________________________________________________________________________________________________
relu6 (Activation) (None, None, 150) 0 conv6[0][0]
____________________________________________________________________________________________________
merge7 (Merge) (None, None, 300) 0 relu2[0][0]
relu6[0][0]
____________________________________________________________________________________________________
conv7 (Convolution1D) (None, None, 150) 225150 merge7[0][0]
____________________________________________________________________________________________________
relu7 (Activation) (None, None, 150) 0 conv7[0][0]
____________________________________________________________________________________________________
merge8 (Merge) (None, None, 300) 0 relu1[0][0]
relu7[0][0]
____________________________________________________________________________________________________
conv8 (Convolution1D) (None, None, 150) 225150 merge8[0][0]
____________________________________________________________________________________________________
relu8 (Activation) (None, None, 150) 0 conv8[0][0]
____________________________________________________________________________________________________
conv9 (Convolution1D) (None, None, 3) 225003 relu8[0][0]
____________________________________________________________________________________________________
activation (Activation) (None, None, 3) 0 conv9[0][0]
====================================================================================================
Total params: 1354203
____________________________________________________________________________________________________
None
In [ ]:
Content source: lukovkin/ufcnn-keras
Similar notebooks: