windows anaconda python 3.7 安装 autokeras

windows anaconda python 3.7 安装 autokeras

注意1:autokeras 需要先安装pytorch,pytorch的安装参考这篇文章:windows anaconda python 3.7 安装 pytorch-gpu

注意2:autokeras 会帮你安装tensorflow的CPU版,如果你想使用tensorflow的GPU版,请参考这篇文章:windows anaconda python 3.7 安装keras-gpu tensorflow-gpu


autokeras 支持pip 安装:

pip install autokeras 

但是pip的包不是最新的,很可能在安装过程中报错,推荐使用GitHub进行安装:

git clone https://github.com/keras-team/autokeras.git
cd autokeras
pip install .

测试代码:

from keras.datasets import mnist
from autokeras import ImageClassifier
from autokeras.constant import Constant

if __name__ == '__main__':
    (x_train, y_train), (x_test, y_test) = mnist.load_data()
    x_train = x_train.reshape(x_train.shape + (1,))
    x_test = x_test.reshape(x_test.shape + (1,))
    clf = ImageClassifier(verbose=True, augment=False)
    clf.fit(x_train, y_train, time_limit=30 * 60)
    clf.final_fit(x_train, y_train, x_test, y_test, retrain=True)
    y = clf.evaluate(x_test, y_test)
    print(y * 100)

注意:推荐使用命令行跑,使用spyder跑程序会报错
运行结果如下:

Using TensorFlow backend.
Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex.
Saving Directory: C:\Users\peter\AppData\Local\Temp\autokeras_PIWS45
Preprocessing the images.
Preprocessing finished.

Initializing search.
Initialization finished.


+-------------------------------------------
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值