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


Python cfg.PIXEL_MEANS属性代码示例

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


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

示例1: _get_image_blob

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _get_image_blob(roidb, scale_inds):
    """Builds an input blob from the images in the roidb at the specified
    scales.
    """
    num_images = len(roidb)
    processed_ims = []
    im_scales = []
    im_shapes = np.zeros((0, 2), dtype=np.float32)
    for i in xrange(num_images):
        im = cv2.imread(roidb[i]['image'])
        if roidb[i]['flipped']:
            im = im[:, ::-1, :]
        target_size = cfg.TRAIN.SCALES[scale_inds[i]]
        im, im_scale, im_shape = prep_im_for_blob(im, cfg.PIXEL_MEANS, target_size)
        im_scales.append(im_scale)
        processed_ims.append(im)
        im_shapes = np.vstack((im_shapes, im_shape))

    # Create a blob to hold the input images
    blob = im_list_to_blob(processed_ims)

    return blob, im_scales, im_shapes 
开发者ID:ppengtang,项目名称:dpl,代码行数:24,代码来源:minibatch.py

示例2: setup

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def setup(self, bottom, top):
        # (1, 3, 1, 1) shaped arrays
        self.PIXEL_MEANS = \
            np.array([[[[0.48462227599918]],
                       [[0.45624044862054]],
                       [[0.40588363755159]]]])
        self.PIXEL_STDS = \
            np.array([[[[0.22889466674951]],
                       [[0.22446679341259]],
                       [[0.22495548344775]]]])
        # The default ("old") pixel means that were already subtracted
        channel_swap = (0, 3, 1, 2)
        self.OLD_PIXEL_MEANS = \
            cfg.PIXEL_MEANS[np.newaxis, :, :, :].transpose(channel_swap)

        top[0].reshape(*(bottom[0].shape)) 
开发者ID:playerkk,项目名称:face-py-faster-rcnn,代码行数:18,代码来源:torch_image_transform_layer.py

示例3: _get_image_blob

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _get_image_blob(roidb, scale_inds):
    """Builds an input blob from the images in the roidb at the specified
    scales.
    """
    num_images = len(roidb)
    processed_ims = []
    im_scales = []
    for i in xrange(num_images):
        im = cv2.imread(roidb[i]['image'])
        if roidb[i]['flipped']:
            im = im[:, ::-1, :]
        target_size = cfg.TRAIN.SCALES[scale_inds[i]]
        im, im_scale = prep_im_for_blob(im, cfg.PIXEL_MEANS, target_size,
                                        cfg.TRAIN.MAX_SIZE)
        im_scales.append(im_scale)
        processed_ims.append(im)

    # Create a blob to hold the input images
    blob = im_list_to_blob(processed_ims)

    return blob, im_scales 
开发者ID:playerkk,项目名称:face-py-faster-rcnn,代码行数:23,代码来源:minibatch.py

示例4: _vis_minibatch

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _vis_minibatch(im_blob, rois_blob, labels_blob, overlaps):
    """Visualize a mini-batch for debugging."""
    import matplotlib.pyplot as plt
    for i in xrange(rois_blob.shape[0]):
        rois = rois_blob[i, :]
        im_ind = rois[0]
        roi = rois[1:]
        im = im_blob[im_ind, :, :, :].transpose((1, 2, 0)).copy()
        im += cfg.PIXEL_MEANS
        im = im[:, :, (2, 1, 0)]
        im = im.astype(np.uint8)
        cls = labels_blob[i]
        plt.imshow(im)
        print 'class: ', cls, ' overlap: ', overlaps[i]
        plt.gca().add_patch(
            plt.Rectangle((roi[0], roi[1]), roi[2] - roi[0],
                          roi[3] - roi[1], fill=False,
                          edgecolor='r', linewidth=3)
            )
        plt.show() 
开发者ID:playerkk,项目名称:face-py-faster-rcnn,代码行数:22,代码来源:minibatch.py

示例5: _get_image_blob

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _get_image_blob(roidb, scale_inds):
    """Builds an input blob from the images in the roidb at the specified
    scales.
    """
    num_images = len(roidb)
    processed_ims = []
    im_scales = []
    for i in xrange(num_images):
        im = roidb[i]['image']() # use image getter

        if roidb[i]['flipped']:
            im = im[:, ::-1, :]
        target_size = cfg.TRAIN.SCALES[scale_inds[i]]
        im, im_scale = prep_im_for_blob(im, cfg.PIXEL_MEANS, target_size,
                                        cfg.TRAIN.MAX_SIZE)
        im_scales.append(im_scale)
        processed_ims.append(im)

    # Create a blob to hold the input images
    blob = im_list_to_blob(processed_ims)

    return blob, im_scales 
开发者ID:danfeiX,项目名称:scene-graph-TF-release,代码行数:24,代码来源:minibatch.py

示例6: _get_image_blob

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _get_image_blob(roidb, scale_inds):
    """Builds an input blob from the images in the roidb at the specified
    scales.
    """
    num_images = len(roidb)
    processed_ims = []
    im_scales = []
    for i in xrange(num_images):
        im = cv2.imread(roidb[i]['image'])
        if roidb[i]['flipped']:
            im = im[:, ::-1, :]

        im_orig = im.astype(np.float32, copy=True)
        im_orig -= cfg.PIXEL_MEANS

        im_scale = cfg.TRAIN.SCALES_BASE[scale_inds[i]]
        im = cv2.resize(im_orig, None, None, fx=im_scale, fy=im_scale, interpolation=cv2.INTER_LINEAR)

        im_scales.append(im_scale)
        processed_ims.append(im)

    # Create a blob to hold the input images
    blob = im_list_to_blob(processed_ims)

    return blob, im_scales 
开发者ID:smallcorgi,项目名称:Faster-RCNN_TF,代码行数:27,代码来源:minibatch2.py

示例7: _get_image_blob_multiscale

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _get_image_blob_multiscale(roidb):
    """Builds an input blob from the images in the roidb at multiscales.
    """
    num_images = len(roidb)
    processed_ims = []
    im_scales = []
    scales = cfg.TRAIN.SCALES_BASE
    for i in xrange(num_images):
        im = cv2.imread(roidb[i]['image'])
        if roidb[i]['flipped']:
            im = im[:, ::-1, :]

        im_orig = im.astype(np.float32, copy=True)
        im_orig -= cfg.PIXEL_MEANS

        for im_scale in scales:
            im = cv2.resize(im_orig, None, None, fx=im_scale, fy=im_scale, interpolation=cv2.INTER_LINEAR)
            im_scales.append(im_scale)
            processed_ims.append(im)

    # Create a blob to hold the input images
    blob = im_list_to_blob(processed_ims)

    return blob, im_scales 
开发者ID:smallcorgi,项目名称:Faster-RCNN_TF,代码行数:26,代码来源:minibatch2.py

示例8: _vis_minibatch

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _vis_minibatch(im_blob, rois_blob, labels_blob, sublabels_blob):
    """Visualize a mini-batch for debugging."""
    import matplotlib.pyplot as plt
    for i in xrange(rois_blob.shape[0]):
        rois = rois_blob[i, :]
        im_ind = rois[0]
        roi = rois[2:]
        im = im_blob[im_ind, :, :, :].transpose((1, 2, 0)).copy()
        im += cfg.PIXEL_MEANS
        im = im[:, :, (2, 1, 0)]
        im = im.astype(np.uint8)
        cls = labels_blob[i]
        subcls = sublabels_blob[i]
        plt.imshow(im)
        print 'class: ', cls, ' subclass: ', subcls
        plt.gca().add_patch(
            plt.Rectangle((roi[0], roi[1]), roi[2] - roi[0],
                          roi[3] - roi[1], fill=False,
                          edgecolor='r', linewidth=3)
            )
        plt.show() 
开发者ID:smallcorgi,项目名称:Faster-RCNN_TF,代码行数:23,代码来源:minibatch.py

示例9: _vis_minibatch

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _vis_minibatch(im_blob, rois_blob, labels_blob, overlaps):
    """Visualize a mini-batch for debugging."""
    import matplotlib.pyplot as plt
    for i in xrange(rois_blob.shape[0]):
        rois = rois_blob[i, :]
        im_ind = rois[0]
        roi = rois[1:]
        im = im_blob[im_ind, :, :, :].transpose((1, 2, 0)).copy()
        im += cfg.PIXEL_MEANS
        im = im[:, :, (2, 1, 0)]
        im = im.astype(np.uint8)
        cls = labels_blob[i]
        plt.imshow(im)
        print 'class: ', cls, ' overlap: ', overlaps[i]
        plt.gca().add_patch(
            plt.Rectangle((roi[0], roi[1]), roi[2] - roi[0],
                          roi[3] - roi[1], fill=False,
                          edgecolor='r', linewidth=3)
        )
        plt.show() 
开发者ID:po0ya,项目名称:face-magnet,代码行数:22,代码来源:minibatch.py

示例10: _process_images

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _process_images(roidb):
    """Builds an input blob from the images in the roidb
    """
    num_images = len(roidb)
    processed_ims = []
    for i in xrange(num_images):
        im = cv2.imread(roidb[i]['image'])
        if roidb[i]['flipped']:
            im = im[:, ::-1, :]

        im_orig = im.astype(np.float32, copy=True)
        im_orig -= cfg.PIXEL_MEANS

        processed_ims.append(im_orig)

    return processed_ims 
开发者ID:tanshen,项目名称:SubCNN,代码行数:18,代码来源:minibatch.py

示例11: _get_image_blob

# 需要导入模块: from fast_rcnn.config import cfg [as 别名]
# 或者: from fast_rcnn.config.cfg import PIXEL_MEANS [as 别名]
def _get_image_blob(roidb, scale_inds):
    """Builds an input blob from the images in the roidb at the specified
    scales.
    """
    num_images = len(roidb)
    processed_ims = []
    im_scales = []
    im_shapes = np.zeros((0, 2), dtype=np.float32)
    for i in xrange(num_images):
        im = cv2.imread(roidb[i]['image'])
        if roidb[i]['flipped']:
            im = im[:, ::-1, :]
        target_size = cfg.TRAIN.SCALES[scale_inds[i]]
        im, im_scale, im_shape = prep_im_for_blob(im, cfg.PIXEL_MEANS, 
                                                  target_size, 
                                                  cfg.TRAIN.MAX_SIZE)
        im_scales.append(im_scale)
        processed_ims.append(im)
        im_shapes = np.vstack((im_shapes, im_shape))

    # Create a blob to hold the input images
    blob = im_list_to_blob(processed_ims)

    return blob, im_scales, im_shapes 
开发者ID:ppengtang,项目名称:oicr,代码行数:26,代码来源:minibatch.py


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