git://www.github.com/IshitaTakeshi/PCANet.git
git clone http://www.github.com/IshitaTakeshi/PCANet
$ svn co --depth empty http://www.github.com/IshitaTakeshi/PCANet
Checked out revision 1.
$ cd repo
$ svn up trunk
基于PCANet的图像分类学习网络。
顾名思义,网络中的权重是用主值来计算的。 由于这种特性,PCANet的训练非常迅速。 此外,PCANet本身训练时不需要类标签。
详细描述在中的原始纸张。
正在运行 python3 setup.py install
。
如果你喜欢 pip,那么 PCANet root 目录中的pip3 install.
。
from pcanet import PCANet# Arguments are basically passed as tuple in the form (height, width) but int is also allowed. # If int is given, the parameter will be converted into (size, size) implicitly.pcanet = PCANet( image_shape=28, # the size of an input image# kernel size, kernel step size, and the number of filters in the first layer, respectivelyfilter_shape_l1=2, step_shape_l1=1, n_l1_output=4, # kernel size, kernel step size, and the number of filters in the second layer, respectivelyfilter_shape_l2=2, step_shape_l2=1, n_l2_output=4, block_shape=2# the size of area to calculate histogram)# Check whether all pixels can be considered. Raise ValueError if the structure is not valid.# Calling this function is optional. PCANet works without this line.pcanet.validate_structure() pcanet.fit(images_train) # Train PCANet# Trained PCANet behaves as a transformer from images into features.# `images` is a 3d array in the form (n_images, height, width), who are transformed into feature vectors.X_train = pcanet.transform(images_train) X_test = pcanet.transform(images_test)# Fit any models you likefrom sklearn.ensemble import RandomForestClassifier model = RandomForestClassifier() model.fit(X_train, y_train) y_pred = model.predict(X_test)
有关详细信息,请参阅 run_mnist.py 。
示例如果为GPU标识指定了负值,则使用 CPU
火车
python3 run_mnist.py --gpu <GPU ID> train --out <output directory (default='result')>
测试
python3 run_mnist.py --gpu <GPU ID> test --pretrained-model <path to dir (default='result')>
文档可以在 docs
目录中运行 make html
来生成文档。
:,:,et,et,et,et 。" 一种简单的图像分类深度学习基线"图像处理 24.12 ( 2015 ) ):? 5017 -5032.