當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。