def LRF3DCNN(nClasses, H, W, Samples): _input = Input(shape=(Samples, H, W, 16), name='LRF_Input') lrf = Conv3D(32, (5, 2, 2), strides=(4, 2, 2), padding='same')(_input) lrf = BatchNormalization(axis=-1)(lrf) lrf = Activation('elu')(lrf) # lrf = SpatialDropout3D(0.5)(lrf) lrf = Conv3D(64, (5, 2, 2), strides=(4, 2, 2), padding='same')(lrf) lrf = BatchNormalization(axis=-1)(lrf) lrf = Activation('elu')(lrf) # lrf = SpatialDropout3D(0.5)(lrf) flatten = Flatten()(lrf) dense = Dense(32)(flatten) dense = BatchNormalization()(dense) dense = Activation('relu')(dense) dense = Dense(32)(dense) dense = BatchNormalization()(dense) dense = Activation('relu')(dense) dense = Dense(nClasses)(dense) _output = Activation('softmax', name='LRF_Output')(dense) return Model(inputs=_input, outputs=_output, name='LRF')
def MB3DCNN(nClasses, H, W, Samples): _input = Input(shape=(Samples, H, W, 1), name='MB_Input') mb = Conv3D(16, (5, 3, 3), strides=(4, 2, 2), padding='same')(_input) mb = BatchNormalization(axis=-1)(mb) mb = Activation('elu')(mb) # mb = SpatialDropout3D(0.5)(mb) _srf_output = SRF3DCNN(nClasses, mb.shape[2], mb.shape[3], mb.shape[1])(mb) _mrf_output = MRF3DCNN(nClasses, mb.shape[2], mb.shape[3], mb.shape[1])(mb) _lrf_output = LRF3DCNN(nClasses, mb.shape[2], mb.shape[3], mb.shape[1])(mb) _add = Add()([_srf_output, _mrf_output, _lrf_output]) # _output = Activation('softmax', name='MB_Output')(_add) _output = Dense(nClasses, activation='softmax', name='MB_Output')(_add) return Model(inputs=_input, outputs=[_output], name='MB3DCNN')