当前位置: 首页>>代码示例>>Python>>正文


Python faster_rcnn_meta_arch.FasterRCNNMetaArch方法代码示例

本文整理汇总了Python中object_detection.meta_architectures.faster_rcnn_meta_arch.FasterRCNNMetaArch方法的典型用法代码示例。如果您正苦于以下问题:Python faster_rcnn_meta_arch.FasterRCNNMetaArch方法的具体用法?Python faster_rcnn_meta_arch.FasterRCNNMetaArch怎么用?Python faster_rcnn_meta_arch.FasterRCNNMetaArch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object_detection.meta_architectures.faster_rcnn_meta_arch的用法示例。


在下文中一共展示了faster_rcnn_meta_arch.FasterRCNNMetaArch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_create_faster_rcnn_models_from_config

# 需要导入模块: from object_detection.meta_architectures import faster_rcnn_meta_arch [as 别名]
# 或者: from object_detection.meta_architectures.faster_rcnn_meta_arch import FasterRCNNMetaArch [as 别名]
def test_create_faster_rcnn_models_from_config(
      self, use_matmul_crop_and_resize, enable_mask_prediction):
    model_proto = self.create_default_faster_rcnn_model_proto()
    faster_rcnn_config = model_proto.faster_rcnn
    faster_rcnn_config.use_matmul_crop_and_resize = use_matmul_crop_and_resize
    if enable_mask_prediction:
      faster_rcnn_config.second_stage_mask_prediction_loss_weight = 3.0
      mask_predictor_config = (
          faster_rcnn_config.second_stage_box_predictor.mask_rcnn_box_predictor)
      mask_predictor_config.predict_instance_masks = True

    for extractor_type, extractor_class in (
        model_builder.FASTER_RCNN_FEATURE_EXTRACTOR_CLASS_MAP.items()):
      faster_rcnn_config.feature_extractor.type = extractor_type
      model = model_builder.build(model_proto, is_training=True)
      self.assertIsInstance(model, faster_rcnn_meta_arch.FasterRCNNMetaArch)
      self.assertIsInstance(model._feature_extractor, extractor_class)
      if enable_mask_prediction:
        self.assertAlmostEqual(model._second_stage_mask_loss_weight, 3.0) 
开发者ID:ShivangShekhar,项目名称:Live-feed-object-device-identification-using-Tensorflow-and-OpenCV,代码行数:21,代码来源:model_builder_test.py

示例2: test_create_faster_rcnn_models_from_config

# 需要导入模块: from object_detection.meta_architectures import faster_rcnn_meta_arch [as 别名]
# 或者: from object_detection.meta_architectures.faster_rcnn_meta_arch import FasterRCNNMetaArch [as 别名]
def test_create_faster_rcnn_models_from_config(self,
                                                 use_matmul_crop_and_resize,
                                                 enable_mask_prediction):
    model_proto = self.create_default_faster_rcnn_model_proto()
    faster_rcnn_config = model_proto.faster_rcnn
    faster_rcnn_config.use_matmul_crop_and_resize = use_matmul_crop_and_resize
    if enable_mask_prediction:
      faster_rcnn_config.second_stage_mask_prediction_loss_weight = 3.0
      mask_predictor_config = (
          faster_rcnn_config.second_stage_box_predictor.mask_rcnn_box_predictor)
      mask_predictor_config.predict_instance_masks = True

    for extractor_type, extractor_class in (
        self.faster_rcnn_feature_extractors().items()):
      faster_rcnn_config.feature_extractor.type = extractor_type
      model = model_builder.build(model_proto, is_training=True)
      self.assertIsInstance(model, faster_rcnn_meta_arch.FasterRCNNMetaArch)
      self.assertIsInstance(model._feature_extractor, extractor_class)
      if enable_mask_prediction:
        self.assertAlmostEqual(model._second_stage_mask_loss_weight, 3.0) 
开发者ID:tensorflow,项目名称:models,代码行数:22,代码来源:model_builder_test.py

示例3: _get_model

# 需要导入模块: from object_detection.meta_architectures import faster_rcnn_meta_arch [as 别名]
# 或者: from object_detection.meta_architectures.faster_rcnn_meta_arch import FasterRCNNMetaArch [as 别名]
def _get_model(self, box_predictor, **common_kwargs):
    return faster_rcnn_meta_arch.FasterRCNNMetaArch(
        initial_crop_size=3,
        maxpool_kernel_size=1,
        maxpool_stride=1,
        second_stage_mask_rcnn_box_predictor=box_predictor,
        **common_kwargs) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:9,代码来源:faster_rcnn_meta_arch_test_lib.py

示例4: _compute_second_stage_input_feature_maps

# 需要导入模块: from object_detection.meta_architectures import faster_rcnn_meta_arch [as 别名]
# 或者: from object_detection.meta_architectures.faster_rcnn_meta_arch import FasterRCNNMetaArch [as 别名]
def _compute_second_stage_input_feature_maps(self, features_to_crop,
                                               proposal_boxes_normalized,
                                               context_features,
                                               valid_context_size):
    """Crops to a set of proposals from the feature map for a batch of images.

    This function overrides the one in the FasterRCNNMetaArch. Aside from
    cropping and resizing the feature maps, which is done in the parent class,
    it adds context attention features to the box features.

    Args:
      features_to_crop: A float32 Tensor with shape [batch_size, height, width,
        depth]
      proposal_boxes_normalized: A float32 Tensor with shape [batch_size,
        num_proposals, box_code_size] containing proposal boxes in normalized
        coordinates.
      context_features: A float Tensor of shape [batch_size, context_size,
        num_context_features].
      valid_context_size: A int32 Tensor of shape [batch_size].

    Returns:
      A float32 Tensor with shape [K, new_height, new_width, depth].
    """
    box_features = self._crop_and_resize_fn(
        features_to_crop, proposal_boxes_normalized,
        [self._initial_crop_size, self._initial_crop_size])

    attention_features = self._context_feature_extract_fn(
        box_features=box_features,
        context_features=context_features,
        valid_context_size=valid_context_size)

    # Adds box features with attention features.
    box_features += attention_features

    flattened_feature_maps = self._flatten_first_two_dimensions(box_features)

    return self._maxpool_layer(flattened_feature_maps) 
开发者ID:tensorflow,项目名称:models,代码行数:40,代码来源:context_rcnn_meta_arch.py

示例5: _get_model

# 需要导入模块: from object_detection.meta_architectures import faster_rcnn_meta_arch [as 别名]
# 或者: from object_detection.meta_architectures.faster_rcnn_meta_arch import FasterRCNNMetaArch [as 别名]
def _get_model(self, box_predictor, keras_model=False, **common_kwargs):
    return faster_rcnn_meta_arch.FasterRCNNMetaArch(
        initial_crop_size=3,
        maxpool_kernel_size=1,
        maxpool_stride=1,
        second_stage_mask_rcnn_box_predictor=box_predictor,
        **common_kwargs) 
开发者ID:tensorflow,项目名称:models,代码行数:9,代码来源:faster_rcnn_meta_arch_test_lib.py


注:本文中的object_detection.meta_architectures.faster_rcnn_meta_arch.FasterRCNNMetaArch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。