import sonnet as snt
import tensorflow as tf

from luminoth.models.fasterrcnn.rcnn_proposal import RCNNProposal
from luminoth.models.fasterrcnn.rcnn_target import RCNNTarget
from luminoth.models.fasterrcnn.roi_pool import ROIPoolingLayer
from luminoth.utils.losses import smooth_l1_loss
from luminoth.utils.vars import (
    get_initializer, layer_summaries, variable_summaries,
    get_activation_function
)


class RCNN(snt.AbstractModule):
    """RCNN: Region-based Convolutional Neural Network.

    Given region proposals (bounding boxes on an image) and a feature map of
    that image, RCNN adjusts the bounding boxes and classifies each region as
    either background or a specific object class.

    Steps:
        1. Region of Interest Pooling. Extract features from the feature map
           (based on the proposals) and convert into fixed size tensors