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


Python image.imread方法代碼示例

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


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

示例1: __getitem__

# 需要導入模塊: from mxnet import image [as 別名]
# 或者: from mxnet.image import imread [as 別名]
def __getitem__(self, index):
        path = self.paths[index]
        img = image.imread(path)

        hr_img = self.crop_transform(img)
        lr_img = self.downsample_transform(hr_img)
        hr_img = self.last_transform(hr_img)
        lr_img = self.last_transform(lr_img)
        return hr_img,lr_img 
開發者ID:dmlc,項目名稱:gluon-cv,代碼行數:11,代碼來源:train_srgan.py

示例2: __getitem__

# 需要導入模塊: from mxnet import image [as 別名]
# 或者: from mxnet.image import imread [as 別名]
def __getitem__(self, index):
        A_path = self.A_paths[index % self.A_size]
        B_path = self.B_paths[index % self.B_size]
        # print('(A, B) = (%d, %d)' % (index_A, index_B))
        A_img = image.imread(A_path)
        B_img = image.imread(B_path)

        A = self.transform(A_img)
        B = self.transform(B_img)
        return A, B 
開發者ID:dmlc,項目名稱:gluon-cv,代碼行數:12,代碼來源:train_cgan.py

示例3: __getitem__

# 需要導入模塊: from mxnet import image [as 別名]
# 或者: from mxnet.image import imread [as 別名]
def __getitem__(self, idx):
        fpath = self.items[idx][0]
        img = image.imread(fpath, self._flag)
        label = self.items[idx][1]
        if self._transform is not None:
            img = self._transform(img)
        return img, label 
開發者ID:dmlc,項目名稱:gluon-cv,代碼行數:9,代碼來源:data_read.py

示例4: __getitem__

# 需要導入模塊: from mxnet import image [as 別名]
# 或者: from mxnet.image import imread [as 別名]
def __getitem__(self, idx):
        if self.use_src and self.use_tgt:
            ims = image.imread(self.items[idx][0], self._flag)
            ls = self.items[idx][1]
            if self.tforms is not None:
                ims = self.tforms(ims)

            imt = image.imread(self.items[idx][2], self._flag)
            lt = self.items[idx][3]
            if self.tformt is not None:
                imt = self.tformt(imt)
            lc = self.items[idx][4]
            return ims, ls, imt, lt, lc
        elif self.use_src and not self.use_tgt:
            im = image.imread(self.items[idx][0], self._flag)
            l = self.items[idx][1]
            if self.tforms is not None:
                im = self.tforms(im)

            return im, l

        elif self.use_tgt and not self.use_src:
            im = image.imread(self.items[idx][0], self._flag)
            l = self.items[idx][1]
            if self.tformt is not None:
                im = self.tformt(im)

            return im, l

        else:
            raise NotImplementedError 
開發者ID:aws-samples,項目名稱:d-SNE,代碼行數:33,代碼來源:datasets_su.py

示例5: read_voc_images

# 需要導入模塊: from mxnet import image [as 別名]
# 或者: from mxnet.image import imread [as 別名]
def read_voc_images(root='../data/VOCdevkit/VOC2012', is_train=True):
    """Read VOC images."""
    txt_fname = '%s/ImageSets/Segmentation/%s' % (
        root, 'train.txt' if is_train else 'val.txt')
    with open(txt_fname, 'r') as f:
        images = f.read().split()
    features, labels = [None] * len(images), [None] * len(images)
    for i, fname in enumerate(images):
        features[i] = image.imread('%s/JPEGImages/%s.jpg' % (root, fname))
        labels[i] = image.imread(
            '%s/SegmentationClass/%s.png' % (root, fname))
    return features, labels 
開發者ID:d2l-ai,項目名稱:d2l-zh,代碼行數:14,代碼來源:utils.py


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