Source code for tensorlayer.layers.object_detection

#! /usr/bin/python
# -*- coding: utf-8 -*-

from tensorlayer.layers.core import Layer

from tensorlayer import logging

from tensorlayer.decorators import deprecated_alias

from tensorlayer.lazy_imports import LazyImport

    roi_pooling = LazyImport("tensorlayer.third_party.roi_pooling.roi_pooling.roi_pooling_ops")
except Exception as e:
    logging.error("HINT: 1.  2. tensorlayer/third_party/roi_pooling")

__all__ = [

[docs]class ROIPoolingLayer(Layer): """ The region of interest pooling layer. Parameters ----------- prev_layer : :class:`Layer` The previous layer. rois : tuple of int Regions of interest in the format of (feature map index, upper left, bottom right). pool_width : int The size of the pooling sections. pool_width : int The size of the pooling sections. name : str A unique layer name. Notes ----------- - This implementation is imported from `Deepsense-AI <>`__ . - Please install it by the instruction `HERE <>`__. """ @deprecated_alias(layer='prev_layer', end_support_version=1.9) # TODO remove this line for the 1.9 release def __init__( self, prev_layer, rois, pool_height=2, pool_width=2, name='roipooling_layer', ): super(ROIPoolingLayer, self).__init__(prev_layer=prev_layer, name=name)"ROIPoolingLayer %s: (%d, %d)" % (, pool_height, pool_width)) self.outputs = roi_pooling(self.inputs, rois, pool_height, pool_width) self._add_layers(self.outputs)