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


Python blob.deserialize方法代码示例

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


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

示例1: forward

# 需要导入模块: from utils import blob [as 别名]
# 或者: from utils.blob import deserialize [as 别名]
def forward(self, inputs, outputs):
        """See modeling.detector.GenerateProposalLabels for inputs/outputs
        documentation.
        """
        # During training we reuse the data loader code. We populate roidb
        # entries on the fly using the rois generated by RPN.
        # im_info: [[im_height, im_width, im_scale], ...]
        rois = inputs[0].data
        roidb = blob_utils.deserialize(inputs[1].data)
        im_info = inputs[2].data
        im_scales = im_info[:, 2]
        output_blob_names = roi_data.fast_rcnn.get_fast_rcnn_blob_names()
        # For historical consistency with the original Faster R-CNN
        # implementation we are *not* filtering crowd proposals.
        # This choice should be investigated in the future (it likely does
        # not matter).
        json_dataset.add_proposals(roidb, rois, im_scales, crowd_thresh=0)
        blobs = {k: [] for k in output_blob_names}
        roi_data.fast_rcnn.add_fast_rcnn_blobs(blobs, im_scales, roidb)
        for i, k in enumerate(output_blob_names):
            blob_utils.py_op_copy_blob(blobs[k], outputs[i]) 
开发者ID:ronghanghu,项目名称:seg_every_thing,代码行数:23,代码来源:generate_proposal_labels.py

示例2: forward

# 需要导入模块: from utils import blob [as 别名]
# 或者: from utils.blob import deserialize [as 别名]
def forward(self, inputs, outputs):
        # inputs is
        # [rpn_rois_fpn2, ..., rpn_rois_fpn6,
        #  rpn_roi_probs_fpn2, ..., rpn_roi_probs_fpn6]
        # If training with Faster R-CNN, then inputs will additionally include
        #  + [roidb, im_info]
        rois = collect(inputs, self._train)
        if self._train:
            # During training we reuse the data loader code. We populate roidb
            # entries on the fly using the rois generated by RPN.
            # im_info: [[im_height, im_width, im_scale], ...]
            im_info = inputs[-1].data
            im_scales = im_info[:, 2]
            roidb = blob_utils.deserialize(inputs[-2].data)
            output_blob_names = roi_data.fast_rcnn.get_fast_rcnn_blob_names()
            json_dataset.add_proposals(roidb, rois, im_scales)
            blobs = {k: [] for k in output_blob_names}
            roi_data.fast_rcnn.add_fast_rcnn_blobs(blobs, im_scales, roidb)
            for i, k in enumerate(output_blob_names):
                blob_utils.py_op_copy_blob(blobs[k], outputs[i])
        else:
            # For inference we have a special code path that avoids some data
            # loader overhead
            distribute(rois, None, outputs, self._train) 
开发者ID:facebookresearch,项目名称:DetectAndTrack,代码行数:26,代码来源:collect_and_distribute_fpn_rpn_proposals.py

示例3: forward

# 需要导入模块: from utils import blob [as 别名]
# 或者: from utils.blob import deserialize [as 别名]
def forward(self, inputs, outputs):
        """See modeling.detector.CollectAndDistributeFpnRpnProposals for
        inputs/outputs documentation.
        """
        # inputs is
        # [rpn_rois_fpn2, ..., rpn_rois_fpn6,
        #  rpn_roi_probs_fpn2, ..., rpn_roi_probs_fpn6]
        # If training with Faster R-CNN, then inputs will additionally include
        #  + [roidb, im_info]
        rois = collect(inputs, self._train)
        if self._train:
            # During training we reuse the data loader code. We populate roidb
            # entries on the fly using the rois generated by RPN.
            # im_info: [[im_height, im_width, im_scale], ...]
            im_info = inputs[-1].data
            im_scales = im_info[:, 2]
            roidb = blob_utils.deserialize(inputs[-2].data)
            # For historical consistency with the original Faster R-CNN
            # implementation we are *not* filtering crowd proposals.
            # This choice should be investigated in the future (it likely does
            # not matter).
            json_dataset.add_proposals(roidb, rois, im_scales, crowd_thresh=0)
            # Compute training labels for the RPN proposals; also handles
            # distributing the proposals over FPN levels
            output_blob_names = roi_data.fast_rcnn.get_fast_rcnn_blob_names()
            blobs = {k: [] for k in output_blob_names}
            roi_data.fast_rcnn.add_fast_rcnn_blobs(blobs, im_scales, roidb)
            for i, k in enumerate(output_blob_names):
                blob_utils.py_op_copy_blob(blobs[k], outputs[i])
        else:
            # For inference we have a special code path that avoids some data
            # loader overhead
            distribute(rois, None, outputs, self._train) 
开发者ID:ronghanghu,项目名称:seg_every_thing,代码行数:35,代码来源:collect_and_distribute_fpn_rpn_proposals.py

示例4: forward

# 需要导入模块: from utils import blob [as 别名]
# 或者: from utils.blob import deserialize [as 别名]
def forward(self, inputs, outputs):
        """See modeling.detector.CollectAndDistributeFpnRpnProposalsRec for
        inputs/outputs documentation.
        """
        # inputs is
        # [rpn_rois_fpn2, ..., rpn_rois_fpn6,
        #  rpn_roi_probs_fpn2, ..., rpn_roi_probs_fpn6]
        # If training with Faster R-CNN, then inputs will additionally include
        #  + [roidb, im_info]
        rois = collect(inputs, self._train)
        if self._train:
            # During training we reuse the data loader code. We populate roidb
            # entries on the fly using the rois generated by RPN.
            # im_info: [[im_height, im_width, im_scale], ...]
            im_info = inputs[-1].data
            im_scales = im_info[:, 2]
            roidb = blob_utils.deserialize(inputs[-2].data)
            # For historical consistency with the original Faster R-CNN
            # implementation we are *not* filtering crowd proposals.
            # This choice should be investigated in the future (it likely does
            # not matter).
            json_dataset.add_proposals(roidb, rois, im_scales, crowd_thresh=0)
            # Compute training labels for the RPN proposals; also handles
            # distributing the proposals over FPN levels
            output_blob_names = roi_data.fast_rcnn.get_fast_rcnn_blob_names()
            blobs = {k: [] for k in output_blob_names}
            roi_data.fast_rcnn.add_fast_rcnn_blobs_rec(blobs, im_scales, roidb)
            for i, k in enumerate(output_blob_names):
                blob_utils.py_op_copy_blob(blobs[k], outputs[i])
        else:
            # For inference we have a special code path that avoids some data
            # loader overhead
            distribute(rois, None, outputs, self._train) 
开发者ID:lvpengyuan,项目名称:masktextspotter.caffe2,代码行数:35,代码来源:collect_and_distribute_fpn_rpn_proposals_rec.py

示例5: save_im_masks

# 需要导入模块: from utils import blob [as 别名]
# 或者: from utils.blob import deserialize [as 别名]
def save_im_masks(self, blobs):
        import os, uuid
        from datasets.dataset_catalog import _DATA_DIR
        import utils.blob as blob_utils

        channel_swap = (0, 2, 3, 1)
        data = blobs['data'].copy()

        im = data.transpose(channel_swap)[0]
        im = self.rescale_0_1(im)

        roidb_temp = blob_utils.deserialize(blobs['roidb'])[0]

        im_name = str(self._counter) + '_' + os.path.splitext(os.path.basename(roidb_temp['image']))[0]

        with self._lock:
            self._counter += 1

        out_dir = os.path.join(_DATA_DIR, 'vis', roidb_temp['nuclei_class'])
        im_name += '_' + str(uuid.uuid4().get_hex().upper()[0:6])

        try:
            os.makedirs(out_dir)
        except:
            pass

        aug_rles = roidb_temp['segms']

        boxes = roidb_temp['boxes']
        boxes = np.append(boxes, np.ones((len(boxes), 2)), 1)
        im_scale = blobs['im_info'][0, 2]

        from utils.vis import vis_one_image
        vis_one_image(im, im_name, out_dir, boxes, segms=aug_rles, keypoints=None, thresh=0.7,
                      box_alpha=0.8, show_class=False, scale=im_scale) 
开发者ID:gangadhar-p,项目名称:NucleiDetectron,代码行数:37,代码来源:loader.py

示例6: forward

# 需要导入模块: from utils import blob [as 别名]
# 或者: from utils.blob import deserialize [as 别名]
def forward(self, inputs, outputs):
        # During training we reuse the data loader code. We populate roidb
        # entries on the fly using the rois generated by RPN.
        # im_info: [[im_height, im_width, im_scale], ...]
        rois = inputs[0].data
        roidb = blob_utils.deserialize(inputs[1].data)
        im_info = inputs[2].data
        im_scales = im_info[:, 2]
        output_blob_names = roi_data.fast_rcnn.get_fast_rcnn_blob_names()
        json_dataset.add_proposals(roidb, rois, im_scales)
        blobs = {k: [] for k in output_blob_names}
        roi_data.fast_rcnn.add_fast_rcnn_blobs(blobs, im_scales, roidb)
        for i, k in enumerate(output_blob_names):
            blob_utils.py_op_copy_blob(blobs[k], outputs[i]) 
开发者ID:facebookresearch,项目名称:DetectAndTrack,代码行数:16,代码来源:generate_proposal_labels.py


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