本文整理匯總了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