def __init__(self, params): super(MaskrcnnModel, self).__init__(params) self._anchor_params = params.anchor self._include_mask = params.architecture.include_mask # Architecture generators. self._backbone_fn = factory.backbone_generator(params) self._fpn_fn = factory.multilevel_features_generator(params) self._rpn_head_fn = factory.rpn_head_generator(params.rpn_head) self._generate_rois_fn = roi_ops.ROIGenerator(params.roi_proposal) self._sample_rois_fn = sampling_ops.ROISampler(params.roi_sampling) self._sample_masks_fn = sampling_ops.MaskSampler(params.mask_sampling) self._frcnn_head_fn = factory.fast_rcnn_head_generator( params.frcnn_head) if self._include_mask: self._mrcnn_head_fn = factory.mask_rcnn_head_generator( params.mrcnn_head) # Loss function. self._rpn_score_loss_fn = losses.RpnScoreLoss(params.rpn_score_loss) self._rpn_box_loss_fn = losses.RpnBoxLoss(params.rpn_box_loss) self._frcnn_class_loss_fn = losses.FastrcnnClassLoss() self._frcnn_box_loss_fn = losses.FastrcnnBoxLoss(params.frcnn_box_loss) if self._include_mask: self._mask_loss_fn = losses.MaskrcnnLoss() self._generate_detections_fn = postprocess_ops.GenericDetectionGenerator( params.postprocess) self._transpose_input = params.train.transpose_input
def __init__(self, params): super(MaskrcnnModel, self).__init__(params) self._params = params self._include_mask = params.architecture.include_mask self._include_attributes = params.architecture.num_attributes is not None # Architecture generators. self._backbone_fn = factory.backbone_generator(params) self._fpn_fn = factory.multilevel_features_generator(params) self._rpn_head_fn = factory.rpn_head_generator(params) self._generate_rois_fn = roi_ops.ROIGenerator(params.roi_proposal) self._sample_rois_fn = sampling_ops.ROISampler(params.roi_sampling) self._sample_masks_fn = sampling_ops.MaskSampler( params.architecture.mask_target_size, params.mask_sampling.num_mask_samples_per_image, ) self._frcnn_head_fn = factory.fast_rcnn_head_generator(params) if self._include_mask: self._mrcnn_head_fn = factory.mask_rcnn_head_generator(params) if self._include_attributes: self._attributes_head_fn = factory.attributes_head_generator( params) # Loss function. self._rpn_score_loss_fn = losses.RpnScoreLoss(params.rpn_score_loss) self._rpn_box_loss_fn = losses.RpnBoxLoss(params.rpn_box_loss) self._frcnn_class_loss_fn = losses.FastrcnnClassLoss() self._frcnn_box_loss_fn = losses.FastrcnnBoxLoss(params.frcnn_box_loss) if self._include_mask: self._mask_loss_fn = losses.MaskrcnnLoss() if self._include_attributes: self._attributes_loss_fn = losses.AttributesLoss( params.attributes_loss) self._generate_detections_fn = postprocess_ops.GenericDetectionGenerator( params.postprocess)