当前位置: 首页>>代码示例>>Python>>正文


Python DenseDesignMatrix.X方法代码示例

本文整理汇总了Python中pylearn2.datasets.dense_design_matrix.DenseDesignMatrix.X方法的典型用法代码示例。如果您正苦于以下问题:Python DenseDesignMatrix.X方法的具体用法?Python DenseDesignMatrix.X怎么用?Python DenseDesignMatrix.X使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pylearn2.datasets.dense_design_matrix.DenseDesignMatrix的用法示例。


在下文中一共展示了DenseDesignMatrix.X方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: enumerate

# 需要导入模块: from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix [as 别名]
# 或者: from pylearn2.datasets.dense_design_matrix.DenseDesignMatrix import X [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)


开发者ID:cc13ny,项目名称:galatea,代码行数:29,代码来源:extract_patches.py


注:本文中的pylearn2.datasets.dense_design_matrix.DenseDesignMatrix.X方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。