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


Python core.tensor2imgs方法代码示例

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


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

示例1: forward_train

# 需要导入模块: from mmdet import core [as 别名]
# 或者: from mmdet.core import tensor2imgs [as 别名]
def forward_train(self,
                      img,
                      img_metas,
                      gt_bboxes=None,
                      gt_bboxes_ignore=None):
        """
        Args:
            img (Tensor): Input images of shape (N, C, H, W).
                Typically these should be mean centered and std scaled.
            img_metas (list[dict]): A List of image info dict where each dict
                has: 'img_shape', 'scale_factor', 'flip', and may also contain
                'filename', 'ori_shape', 'pad_shape', and 'img_norm_cfg'.
                For details on the values of these keys see
                :class:`mmdet.datasets.pipelines.Collect`.
            gt_bboxes (list[Tensor]): Each item are the truth boxes for each
                image in [tl_x, tl_y, br_x, br_y] format.
            gt_bboxes_ignore (None | list[Tensor]): Specify which bounding
                boxes can be ignored when computing the loss.

        Returns:
            dict[str, Tensor]: A dictionary of loss components.
        """
        if self.train_cfg.rpn.get('debug', False):
            self.rpn_head.debug_imgs = tensor2imgs(img)

        x = self.extract_feat(img)
        losses = self.rpn_head.forward_train(x, img_metas, gt_bboxes, None,
                                             gt_bboxes_ignore)
        return losses 
开发者ID:open-mmlab,项目名称:mmdetection,代码行数:31,代码来源:rpn.py

示例2: show_result

# 需要导入模块: from mmdet import core [as 别名]
# 或者: from mmdet.core import tensor2imgs [as 别名]
def show_result(self, data, result, dataset=None, top_k=20):
        """Show RPN proposals on the image.

        Although we assume batch size is 1, this method supports arbitrary
        batch size.
        """
        img_tensor = data['img'][0]
        img_metas = data['img_metas'][0].data[0]
        imgs = tensor2imgs(img_tensor, **img_metas[0]['img_norm_cfg'])
        assert len(imgs) == len(img_metas)
        for img, img_meta in zip(imgs, img_metas):
            h, w, _ = img_meta['img_shape']
            img_show = img[:h, :w, :]
            mmcv.imshow_bboxes(img_show, result, top_k=top_k) 
开发者ID:open-mmlab,项目名称:mmdetection,代码行数:16,代码来源:rpn.py

示例3: forward_train

# 需要导入模块: from mmdet import core [as 别名]
# 或者: from mmdet.core import tensor2imgs [as 别名]
def forward_train(self,
                      img,
                      img_meta,
                      gt_bboxes=None,
                      gt_bboxes_ignore=None):
        if self.train_cfg.rpn.get('debug', False):
            self.rpn_head.debug_imgs = tensor2imgs(img)

        x = self.extract_feat(img)
        rpn_outs = self.rpn_head(x)

        rpn_loss_inputs = rpn_outs + (gt_bboxes, img_meta, self.train_cfg.rpn)
        losses = self.rpn_head.loss(
            *rpn_loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore)
        return losses 
开发者ID:dingjiansw101,项目名称:AerialDetection,代码行数:17,代码来源:rpn.py

示例4: show_result

# 需要导入模块: from mmdet import core [as 别名]
# 或者: from mmdet.core import tensor2imgs [as 别名]
def show_result(self, data, result, img_norm_cfg, dataset=None, top_k=20):
        """Show RPN proposals on the image.

        Although we assume batch size is 1, this method supports arbitrary
        batch size.
        """
        img_tensor = data['img'][0]
        img_metas = data['img_meta'][0].data[0]
        imgs = tensor2imgs(img_tensor, **img_norm_cfg)
        assert len(imgs) == len(img_metas)
        for img, img_meta in zip(imgs, img_metas):
            h, w, _ = img_meta['img_shape']
            img_show = img[:h, :w, :]
            mmcv.imshow_bboxes(img_show, result, top_k=top_k) 
开发者ID:dingjiansw101,项目名称:AerialDetection,代码行数:16,代码来源:rpn.py

示例5: show_result

# 需要导入模块: from mmdet import core [as 别名]
# 或者: from mmdet.core import tensor2imgs [as 别名]
def show_result(self, data, result, dataset=None, top_k=20):
        """Show RPN proposals on the image.

        Although we assume batch size is 1, this method supports arbitrary
        batch size.
        """
        img_tensor = data['img'][0]
        img_metas = data['img_meta'][0].data[0]
        imgs = tensor2imgs(img_tensor, **img_metas[0]['img_norm_cfg'])
        assert len(imgs) == len(img_metas)
        for img, img_meta in zip(imgs, img_metas):
            h, w, _ = img_meta['img_shape']
            img_show = img[:h, :w, :]
            mmcv.imshow_bboxes(img_show, result, top_k=top_k) 
开发者ID:tascj,项目名称:kaggle-kuzushiji-recognition,代码行数:16,代码来源:rpn.py

示例6: forward_train

# 需要导入模块: from mmdet import core [as 别名]
# 或者: from mmdet.core import tensor2imgs [as 别名]
def forward_train(self, img, img_meta, gt_bboxes=None):
        if self.train_cfg.rpn.get('debug', False):
            self.rpn_head.debug_imgs = tensor2imgs(img)

        x = self.extract_feat(img)
        rpn_outs = self.rpn_head(x)

        rpn_loss_inputs = rpn_outs + (gt_bboxes, img_meta, self.train_cfg.rpn)
        losses = self.rpn_head.loss(*rpn_loss_inputs)
        return losses 
开发者ID:chanyn,项目名称:Reasoning-RCNN,代码行数:12,代码来源:rpn.py

示例7: show_result

# 需要导入模块: from mmdet import core [as 别名]
# 或者: from mmdet.core import tensor2imgs [as 别名]
def show_result(self, data, result, img_norm_cfg):
        """Show RPN proposals on the image.

        Although we assume batch size is 1, this method supports arbitrary
        batch size.
        """
        img_tensor = data['img'][0]
        img_metas = data['img_meta'][0].data[0]
        imgs = tensor2imgs(img_tensor, **img_norm_cfg)
        assert len(imgs) == len(img_metas)
        for img, img_meta in zip(imgs, img_metas):
            h, w, _ = img_meta['img_shape']
            img_show = img[:h, :w, :]
            mmcv.imshow_bboxes(img_show, result, top_k=20) 
开发者ID:chanyn,项目名称:Reasoning-RCNN,代码行数:16,代码来源:rpn.py


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