abstract_models.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:vessel-classification 作者: GlobalFishingWatch 项目源码 文件源码
def misconception_with_fishing_ranges(self, input, mmsis, is_training):
        """ A misconception tower with additional fishing range classification.

        Args:
            input: a tensor of size [batch_size, 1, width, depth].
            window_size: the width of the conv and pooling filters to apply.
            stride: the downsampling to apply when filtering.
            depth: the depth of the output tensor.
            levels: The height of the tower in misconception layers.

        Returns:
            a tensor of size [batch_size, num_classes].
        """
        with slim.arg_scope([slim.fully_connected], activation_fn=tf.nn.elu):
            net = input

            # Then a tower for classification.
            multiscale_layers = []
            for i in range(self.levels):
                with tf.variable_scope("layer_%d" % i):
                    multiscale_layers.append(utility.repeat_tensor(net, 2**i))

                    net = layers.misconception_with_bypass(
                        net, self.window_size, self.stride, self.feature_depth,
                        is_training)

            # TODO: We currently don't use the last year for fishing classification
            # Since we don't use this for vessel classification currently, perhaps
            # we should rememdy that...

            net = slim.flatten(net)
            net = slim.dropout(net, 0.5, is_training=is_training)
            net = slim.fully_connected(net, 100)
            net = slim.dropout(net, 0.5, is_training=is_training)

            concatenated_multiscale_embedding = tf.concat(3, multiscale_layers)

            fishing_outputs = tf.squeeze(
                slim.conv2d(
                    concatenated_multiscale_embedding,
                    1, [1, 1],
                    activation_fn=None),
                squeeze_dims=[1, 3])

            for of in self.classification_training_objectives:
                of.build(net)

            self.fishing_localisation_objective.build(fishing_outputs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号