本文整理汇总了Python中pylearn2.datasets.dense_design_matrix.DenseDesignMatrix.use_design_loc方法的典型用法代码示例。如果您正苦于以下问题:Python DenseDesignMatrix.use_design_loc方法的具体用法?Python DenseDesignMatrix.use_design_loc怎么用?Python DenseDesignMatrix.use_design_loc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylearn2.datasets.dense_design_matrix.DenseDesignMatrix
的用法示例。
在下文中一共展示了DenseDesignMatrix.use_design_loc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enumerate
# 需要导入模块: from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix [as 别名]
# 或者: from pylearn2.datasets.dense_design_matrix.DenseDesignMatrix import use_design_loc [as 别名]
rng = np.random.RandomState([1,2,3])
for i, img_path in enumerate(ImageIterator(path, suffix=".npy")):
img = np.load(img_path)
if img.shape[2] == 1:
img = np.concatenate((img,img,img),axis=2)
img = img.reshape(1,img.shape[0],img.shape[1],img.shape[2])
d = DenseDesignMatrix( topo_view = img, view_converter = DefaultViewConverter(img.shape[1:]) )
random_rng = np.random.RandomState([ rng.randint(0,256), rng.randint(0,256), rng.randint(0,256)])
p = ExtractPatches( patch_shape = patch_shape, num_patches = k , rng = random_rng)
d.apply_preprocessor(p)
X[i*3:(i+1)*3,:] = d.X
d.X = X
base = '/data/lisatmp/goodfeli/darpa_imagenet_patch_%dx%d_train.' % (patch_shape[0], patch_shape[1])
d.use_design_loc(base+'npy')
serial.save(base+'pkl',d)