當前位置: 首頁>>代碼示例>>Python>>正文


Python core.multi_apply方法代碼示例

本文整理匯總了Python中mmdet.core.multi_apply方法的典型用法代碼示例。如果您正苦於以下問題:Python core.multi_apply方法的具體用法?Python core.multi_apply怎麽用?Python core.multi_apply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mmdet.core的用法示例。


在下文中一共展示了core.multi_apply方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_targets

# 需要導入模塊: from mmdet import core [as 別名]
# 或者: from mmdet.core import multi_apply [as 別名]
def get_targets(self, gt_bbox_list, gt_label_list, featmap_sizes, points):
        label_list, bbox_target_list = multi_apply(
            self._get_target_single,
            gt_bbox_list,
            gt_label_list,
            featmap_size_list=featmap_sizes,
            point_list=points)
        flatten_labels = [
            torch.cat([
                labels_level_img.flatten() for labels_level_img in labels_level
            ]) for labels_level in zip(*label_list)
        ]
        flatten_bbox_targets = [
            torch.cat([
                bbox_targets_level_img.reshape(-1, 4)
                for bbox_targets_level_img in bbox_targets_level
            ]) for bbox_targets_level in zip(*bbox_target_list)
        ]
        flatten_labels = torch.cat(flatten_labels)
        flatten_bbox_targets = torch.cat(flatten_bbox_targets)
        return flatten_labels, flatten_bbox_targets 
開發者ID:open-mmlab,項目名稱:mmdetection,代碼行數:23,代碼來源:fovea_head.py

示例2: forward

# 需要導入模塊: from mmdet import core [as 別名]
# 或者: from mmdet.core import multi_apply [as 別名]
def forward(self, feats):
        """Forward features from the upstream network.

        Args:
            feats (tuple[Tensor]): Features from the upstream network, each is
                a 4D-tensor.

        Returns:
            tuple: Usually contain classification scores and bbox predictions.
                cls_scores (list[Tensor]): Box scores for each scale level,
                    each is a 4D-tensor, the channel number is
                    num_points * num_classes.
                bbox_preds (list[Tensor]): Box energies / deltas for each scale
                    level, each is a 4D-tensor, the channel number is
                    num_points * 4.
        """
        return multi_apply(self.forward_single, feats)[:2] 
開發者ID:open-mmlab,項目名稱:mmdetection,代碼行數:19,代碼來源:anchor_free_head.py

示例3: forward

# 需要導入模塊: from mmdet import core [as 別名]
# 或者: from mmdet.core import multi_apply [as 別名]
def forward(self, feats):
        """Forward features from the upstream network.

        Args:
            feats (tuple[Tensor]): Features from the upstream network, each is
                a 4D-tensor.

        Returns:
            tuple:
                cls_scores (list[Tensor]): Box scores for each scale level,
                    each is a 4D-tensor, the channel number is
                    num_points * num_classes.
                bbox_preds (list[Tensor]): Box energies / deltas for each scale
                    level, each is a 4D-tensor, the channel number is
                    num_points * 4.
                centernesses (list[Tensor]): Centerss for each scale level,
                    each is a 4D-tensor, the channel number is num_points * 1.
        """
        return multi_apply(self.forward_single, feats, self.scales,
                           self.strides) 
開發者ID:open-mmlab,項目名稱:mmdetection,代碼行數:22,代碼來源:fcos_head.py

示例4: fovea_target

# 需要導入模塊: from mmdet import core [as 別名]
# 或者: from mmdet.core import multi_apply [as 別名]
def fovea_target(self, gt_bbox_list, gt_label_list, featmap_sizes, points):
        label_list, bbox_target_list = multi_apply(
            self.fovea_target_single,
            gt_bbox_list,
            gt_label_list,
            featmap_size_list=featmap_sizes,
            point_list=points)
        flatten_labels = [
            torch.cat([
                labels_level_img.flatten() for labels_level_img in labels_level
            ]) for labels_level in zip(*label_list)
        ]
        flatten_bbox_targets = [
            torch.cat([
                bbox_targets_level_img.reshape(-1, 4)
                for bbox_targets_level_img in bbox_targets_level
            ]) for bbox_targets_level in zip(*bbox_target_list)
        ]
        flatten_labels = torch.cat(flatten_labels)
        flatten_bbox_targets = torch.cat(flatten_bbox_targets)
        return flatten_labels, flatten_bbox_targets 
開發者ID:tascj,項目名稱:kaggle-kuzushiji-recognition,代碼行數:23,代碼來源:fovea_head.py

示例5: forward

# 需要導入模塊: from mmdet import core [as 別名]
# 或者: from mmdet.core import multi_apply [as 別名]
def forward(self, feats):
        return multi_apply(self.forward_single, feats, self.scales) 
開發者ID:xvjiarui,項目名稱:GCNet,代碼行數:4,代碼來源:fcos_head.py

示例6: fcos_target

# 需要導入模塊: from mmdet import core [as 別名]
# 或者: from mmdet.core import multi_apply [as 別名]
def fcos_target(self, points, gt_bboxes_list, gt_labels_list):
        assert len(points) == len(self.regress_ranges)
        num_levels = len(points)
        # expand regress ranges to align with points
        expanded_regress_ranges = [
            points[i].new_tensor(self.regress_ranges[i])[None].expand_as(
                points[i]) for i in range(num_levels)
        ]
        # concat all levels points and regress ranges
        concat_regress_ranges = torch.cat(expanded_regress_ranges, dim=0)
        concat_points = torch.cat(points, dim=0)
        # get labels and bbox_targets of each image
        labels_list, bbox_targets_list = multi_apply(
            self.fcos_target_single,
            gt_bboxes_list,
            gt_labels_list,
            points=concat_points,
            regress_ranges=concat_regress_ranges)

        # split to per img, per level
        num_points = [center.size(0) for center in points]
        labels_list = [labels.split(num_points, 0) for labels in labels_list]
        bbox_targets_list = [
            bbox_targets.split(num_points, 0)
            for bbox_targets in bbox_targets_list
        ]

        # concat per level image
        concat_lvl_labels = []
        concat_lvl_bbox_targets = []
        for i in range(num_levels):
            concat_lvl_labels.append(
                torch.cat([labels[i] for labels in labels_list]))
            concat_lvl_bbox_targets.append(
                torch.cat(
                    [bbox_targets[i] for bbox_targets in bbox_targets_list]))
        return concat_lvl_labels, concat_lvl_bbox_targets 
開發者ID:xvjiarui,項目名稱:GCNet,代碼行數:39,代碼來源:fcos_head.py

示例7: forward

# 需要導入模塊: from mmdet import core [as 別名]
# 或者: from mmdet.core import multi_apply [as 別名]
def forward(self, feats):
        return multi_apply(self.forward_single, feats, self.scales_bbox, self.scales_mask) 
開發者ID:xieenze,項目名稱:PolarMask,代碼行數:4,代碼來源:polarmask_head.py

示例8: forward

# 需要導入模塊: from mmdet import core [as 別名]
# 或者: from mmdet.core import multi_apply [as 別名]
def forward(self, feats):
        return multi_apply(self.forward_single, feats) 
開發者ID:tascj,項目名稱:kaggle-kuzushiji-recognition,代碼行數:4,代碼來源:fovea_head.py


注:本文中的mmdet.core.multi_apply方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。