Exemple #1
0
    def NN(self, x):
        assert x.get_shape().as_list()[:3] == [None, 101, 101]
        summary_images(x, "layer0")
        x = nn.convolution(x, 16, w=4)  # 98
        x = nn.convolution(x)  # 96
        summary_images(x, "layer2")
        x = nn.max_pool(x)
        x = nn.batch_normalization(x, self.tfacc)

        ########################################################################
        assert x.get_shape().as_list() == [None, 48, 48, 16]
        x = nn.convolution(x, 32)  # 46
        x = nn.convolution(x)  # 44
        summary_images(x, "layer4")
        x = nn.max_pool(x)
        x = nn.batch_normalization(x, self.tfacc)

        ########################################################################
        assert x.get_shape().as_list() == [None, 22, 22, 32]
        x = nn.convolution(x, 64)  # 20
        x = nn.convolution(x)  # 18
        summary_images(x, "layer6")
        x = nn.max_pool(x)
        x = nn.batch_normalization(x, self.tfacc)
        x = tf.nn.dropout(x, self.tfkp)

        ########################################################################
        assert x.get_shape().as_list() == [None, 9, 9, 64]
        x = nn.convolution(x, 128)  # 7
        summary_images(x, "layer7")
        x = tf.nn.dropout(x, self.tfkp)

        x = nn.convolution(x)  # 5
        x = nn.batch_normalization(x, self.tfacc)
        x = tf.nn.dropout(x, self.tfkp)

        ########################################################################
        assert x.get_shape().as_list() == [None, 5, 5, 128]
        x = nn.convolution(x, 1024, w=5)

        ########################################################################
        assert x.get_shape().as_list() == [None, 1, 1, 1024]
        x = tf.reshape(x, [-1, x.get_shape().as_list()[-1]])
        self.embedding_input = x

        x = tf.nn.dropout(x, self.tfkp)

        x = nn.fullyconnected(x, 1024)
        x = tf.nn.dropout(x, self.tfkp)

        x = nn.fullyconnected(x, 1024)
        x = nn.batch_normalization(x, self.tfacc)
        self.test = x

        x = nn.fullyconnected(x, 1, activation=None)
        return x
Exemple #2
0
    def NN1(self, x):
        assert x.get_shape().as_list()[:3] == [None, 101, 101]
        x = nn.convolution(x, 16, w=4) # 98
        x = nn.convolution(x) # 96
        x = nn.max_pool(x)
        x = nn.batch_normalization(x, self.tfacc)

        ########################################################################
        assert x.get_shape().as_list() == [None, 48, 48, 16]
        x = nn.convolution(x, 32) # 46
        x = nn.convolution(x) # 44
        x = nn.max_pool(x)
        x = nn.batch_normalization(x, self.tfacc)

        ########################################################################
        assert x.get_shape().as_list() == [None, 22, 22, 32]
        x = nn.convolution(x, 64) # 20
        x = nn.convolution(x) # 18
        x = nn.max_pool(x)
        x = nn.batch_normalization(x, self.tfacc)
        x = tf.nn.dropout(x, self.tfkp)

        ########################################################################
        assert x.get_shape().as_list() == [None, 9, 9, 64]
        x = nn.convolution(x, 128) # 7
        x = tf.nn.dropout(x, self.tfkp)

        x = nn.convolution(x) # 5
        summary_images(x, "nn1")
        x = nn.batch_normalization(x, self.tfacc)
        x = tf.nn.dropout(x, self.tfkp)

        ########################################################################
        assert x.get_shape().as_list() == [None, 5, 5, 128]
        x = nn.convolution(x, 1024, w=5)

        ########################################################################
        assert x.get_shape().as_list() == [None, 1, 1, 1024]
        x = tf.reshape(x, [-1, x.get_shape().as_list()[-1]])

        x = tf.nn.dropout(x, self.tfkp)

        x = nn.fullyconnected(x, 1024)
        x = tf.nn.dropout(x, self.tfkp)

        x = nn.fullyconnected(x, 1024)
        x = nn.batch_normalization(x, self.tfacc)
        self.test = x

        x = nn.fullyconnected(x, 2, activation=None)
        return x
Exemple #3
0
    def NN2(self, x):
        assert x.get_shape().as_list()[:3] == [None, 101, 101]

        x = x[:, 28:73, 28:73, :]

        ############################################################
        assert x.get_shape().as_list()[:3] == [None, 45, 45]
        x = nn.convolution(x, 16, w=5) # 41
        x = nn.convolution(x, 19, w=5) # 37
        x = nn.convolution(x, 23, w=5) # 33
        x = nn.batch_normalization(x, self.tfacc)
        x = nn.convolution(x, 27, w=5) # 29
        x = nn.convolution(x, 33, w=5) # 25
        x = nn.convolution(x, 39, w=5) # 21
        x = nn.batch_normalization(x, self.tfacc)
        x = nn.convolution(x, 47, w=5) # 17
        x = nn.convolution(x, 57, w=5) # 13
        x = nn.convolution(x, 68, w=5) # 9
        x = nn.batch_normalization(x, self.tfacc)
        x = nn.convolution(x, 82, w=5) # 5
        summary_images(x, "nn2")

        ############################################################
        assert x.get_shape().as_list() == [None, 5, 5, 82]
        x = tf.nn.dropout(x, self.tfkp)
        x = nn.convolution(x, 256, w=5) # 1

        ############################################################
        assert x.get_shape().as_list() == [None, 1, 1, 256]
        x = tf.reshape(x, [-1, 256])

        x = tf.nn.dropout(x, self.tfkp)
        x = nn.fullyconnected(x, 512)

        x = tf.nn.dropout(x, self.tfkp)
        x = nn.fullyconnected(x, 512)
        x = nn.batch_normalization(x, self.tfacc)

        x = nn.fullyconnected(x, 2, activation=None)
        return x
Exemple #4
0
    def NN(self, x):
        assert x.get_shape().as_list()[:3] == [None, 101, 101]
        summary_images(x, "layer0")
        x = nn.convolution(x, 16, w=2)  # 100
        summary_images(x, "layer1")

        ########################################################################
        assert x.get_shape().as_list() == [None, 100, 100, 16]
        x = nn.batch_normalization(x, self.tfacc)
        x = res_layer(x, n=2)  # 96
        x = nn.batch_normalization(x, self.tfacc)
        x = res_layer(x, n=2)  # 92
        summary_images(x, "layer5")
        x = nn.max_pool(x)

        ########################################################################
        assert x.get_shape().as_list() == [None, 46, 46, 16]
        x = nn.batch_normalization(x, self.tfacc)
        x = res_layer(x, 32, n=3)  # 40
        summary_images(x, "layer8")
        x = nn.batch_normalization(x, self.tfacc)
        x = res_layer(x, n=2)  # 36
        summary_images(x, "layer10")
        x = nn.max_pool(x)
        x = nn.batch_normalization(x, self.tfacc)
        x = tf.nn.dropout(x, self.tfkp)

        ########################################################################
        assert x.get_shape().as_list() == [None, 18, 18, 32]
        x = res_layer(x, 64, n=2)  # 14
        summary_images(x, "layer12")
        x = nn.batch_normalization(x, self.tfacc)
        x = res_layer(x, 92, n=2)  # 10
        x = nn.batch_normalization(x, self.tfacc)
        x = tf.nn.dropout(x, self.tfkp)
        x = res_layer(x, 128, n=3)  # 4
        x = nn.batch_normalization(x, self.tfacc)
        x = tf.nn.dropout(x, self.tfkp)

        ########################################################################
        assert x.get_shape().as_list() == [None, 4, 4, 128]
        x = nn.convolution(x, 1024, w=4)

        ########################################################################
        assert x.get_shape().as_list() == [None, 1, 1, 1024]
        x = tf.reshape(x, [-1, x.get_shape().as_list()[-1]])
        self.embedding_input = x

        x = nn.batch_normalization(x, self.tfacc)
        x = tf.nn.dropout(x, self.tfkp)

        x = nn.fullyconnected(x, 1024)
        x = nn.batch_normalization(x, self.tfacc)
        x = tf.nn.dropout(x, self.tfkp)

        x = nn.fullyconnected(x, 1024)
        x = nn.batch_normalization(x, self.tfacc)
        self.test = x

        x = nn.fullyconnected(x, 1, activation=None)
        return x