当前位置: 首页>>代码示例>>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;未经允许,请勿转载。