Build fcn8 model
(nb_in_channels, input_var,
path_weights='/Tmp/romerosa/itinf/models/' +
'camvid/new_fcn8_model_best.npz',
n_classes=21, load_weights=True,
void_labels=[], trainable=False,
layer=['probs_dimshuffle'], pascal=False,
temperature=1.0, dropout=0.5)
| 38 | |
| 39 | # start-snippet-1 |
| 40 | def buildFCN8(nb_in_channels, input_var, |
| 41 | path_weights='/Tmp/romerosa/itinf/models/' + |
| 42 | 'camvid/new_fcn8_model_best.npz', |
| 43 | n_classes=21, load_weights=True, |
| 44 | void_labels=[], trainable=False, |
| 45 | layer=['probs_dimshuffle'], pascal=False, |
| 46 | temperature=1.0, dropout=0.5): |
| 47 | ''' |
| 48 | Build fcn8 model |
| 49 | ''' |
| 50 | |
| 51 | net = {} |
| 52 | |
| 53 | # Contracting path |
| 54 | net['input'] = InputLayer((None, nb_in_channels, None, None),input_var) |
| 55 | |
| 56 | # pool 1 |
| 57 | net['conv1_1'] = ConvLayer(net['input'], 64, 3, pad=100, flip_filters=False) |
| 58 | net['conv1_2'] = ConvLayer(net['conv1_1'], 64, 3, pad='same', flip_filters=False) |
| 59 | net['pool1'] = PoolLayer(net['conv1_2'], 2) |
| 60 | |
| 61 | # pool 2 |
| 62 | net['conv2_1'] = ConvLayer(net['pool1'], 128, 3, pad='same', flip_filters=False) |
| 63 | net['conv2_2'] = ConvLayer(net['conv2_1'], 128, 3, pad='same', flip_filters=False) |
| 64 | net['pool2'] = PoolLayer(net['conv2_2'], 2) |
| 65 | |
| 66 | # pool 3 |
| 67 | net['conv3_1'] = ConvLayer(net['pool2'], 256, 3, pad='same', flip_filters=False) |
| 68 | net['conv3_2'] = ConvLayer(net['conv3_1'], 256, 3, pad='same', flip_filters=False) |
| 69 | net['conv3_3'] = ConvLayer(net['conv3_2'], 256, 3, pad='same', flip_filters=False) |
| 70 | net['pool3'] = PoolLayer(net['conv3_3'], 2) |
| 71 | |
| 72 | # pool 4 |
| 73 | net['conv4_1'] = ConvLayer(net['pool3'], 512, 3, pad='same', flip_filters=False) |
| 74 | net['conv4_2'] = ConvLayer(net['conv4_1'], 512, 3, pad='same', flip_filters=False) |
| 75 | net['conv4_3'] = ConvLayer(net['conv4_2'], 512, 3, pad='same', flip_filters=False) |
| 76 | net['pool4'] = PoolLayer(net['conv4_3'], 2) |
| 77 | |
| 78 | # pool 5 |
| 79 | net['conv5_1'] = ConvLayer(net['pool4'], 512, 3, pad='same', flip_filters=False) |
| 80 | net['conv5_2'] = ConvLayer(net['conv5_1'], 512, 3, pad='same', flip_filters=False) |
| 81 | net['conv5_3'] = ConvLayer(net['conv5_2'], 512, 3, pad='same', flip_filters=False) |
| 82 | net['pool5'] = PoolLayer(net['conv5_3'], 2) |
| 83 | |
| 84 | # fc6 |
| 85 | net['fc6'] = ConvLayer(net['pool5'], 4096, 7, pad='valid', flip_filters=False) |
| 86 | net['fc6_dropout'] = DropoutLayer(net['fc6'], p=dropout) |
| 87 | |
| 88 | # fc7 |
| 89 | net['fc7'] = ConvLayer(net['fc6_dropout'], 4096, 1, pad='valid', flip_filters=False) |
| 90 | net['fc7_dropout'] = DropoutLayer(net['fc7'], p=dropout) |
| 91 | |
| 92 | net['score_fr'] = ConvLayer(net['fc7_dropout'], n_classes, 1, pad='valid', flip_filters=False) |
| 93 | |
| 94 | # Upsampling path |
| 95 | |
| 96 | # Unpool |
| 97 | net['score2'] = DeconvLayer(net['score_fr'], n_classes, 4, |
no test coverage detected