本文整理汇总了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
示例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
示例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
示例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
示例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