Windows 10 Keras+theano Installation Tutorial (speed)

Source: Internet
Author: User
Tags theano keras

Win10 under Keras+theano installation Tutorial (speed)

1 Keras Introduction:

(1) Keras is a high level neural network Api,keras written by Pure Python and based on TensorFlow or Theano. Keras is born to support fast experimentation and can quickly turn your idea into a result, if you have the following requirements, please select Keras:

• Simple and fast prototyping (Keras with highly modular, minimalist, and extensible features)

• Support for CNN and RNN, or the combination of both

• Seamless CPU and GPU switching

(2) The Python version that Keras applies to is: Python 2.7-3.5

(3) Keras based on TensorFlow or Theano: as shown in the following illustration:


(4) Keras is the TensorFlow or Theano of the second encapsulation, that is, TensorFlow or Theano for the back end, the default backend is TensorFlow, if you want to use Theano for the backend, you can change to Theano. As to how to modify, will be introduced later.

2 Installation Steps 2.1 Anaconda Installation

(1) Download Anaconda forwindows 64-bit + Python2.7 version, download address: https://www.continuum.io/downloads#_windows


(2) Installation can be completed after downloading. Note: During the installation, you will be shown whether to select the configuration environment variable, tick. The other direct next step can be. 2.2 Keras Installation

Keras installation is relatively simple, directly in the cmd input pipinstall Keras can be. (Don't know Pip's, go to the web search yourself) 2.3 MinGW Installation

(1) Download: In the cmd input Conda Installmingw Libpython, encountered needs to enter (y/n) when input y and click Enter.

(2) Configuration environment: Add two line values in environment variable path after installation: (Note: The path here depends on your previous Anaconda installation path)

· F:\ProgramData\Anaconda2\MinGW\bin

· F:\ProgramData\Anaconda2\MinGW\x86_64-w64-mingw32\lib

(3) Locate the directory C:\Users\rt (your username), and create a new text file in this directory. Theanorc.txt (Note that there are two points). Enter the following in this file and save it.

[Global]

Openmp=false

[Blas]

ldflags=

[GCC]

Cxxflags=-if:\programdata\anaconda2\mingw

Note: The blue callout should enter your Anaconda installation path, otherwise can not find MinGW. 2.4 Theano Installation

Because Keras relies on the Theano library, you need to manually download the Theano Library's compressed package.

(1) Download:

On the github can download to the Theano source. Click the cloneor download button--> Click download zip to start downloading, as shown. GitHub address: Https://github.com/Theano/Theano, after downloading file for Theano-master.zip

(2) Delete Theano folder

Because the default will get a Theano library, and we need to use the download of the Theano, so first the original Theano library to delete Keras. Delete the Theano folder in the F:\ProgramData\Anaconda2\Lib\site-packages.

(3) Copy Theano folder

Unzip the file downloaded above theano-master.zip. Copy the Theano folder under the Theano-master file and copy it to F:\ProgramData\Anaconda2\Lib\site-packages in the Anaconda installation directory.

(4) Configure environment variables

Add a system variable to the environment variable named Pythonpath with a value of F:\ProgramData\Anaconda2\Lib\site-packages\theano

Note: This time enter the cmd input python, press ENTER, continue to import import Theano, enter, no problem. However, enter import Keras at this time, prompting an error. This is because the Keras default backend mentioned above is caused by the tensorflow. You need to modify the back end for Theano. 2.5 Modify the default backend (this step must be done.) Otherwise it will be an error. )

Open C:\Users\rt (current username) \.keras, and modify the Keras.json file in the folder as follows:

{

"image_dim_ordering": "th",

"Epsilon": 1e-07,

"Floatx": "Float32",

"Backend": "Theano"

}

At this point, the import Keras is entered in the Cmd,python, and a using Theano backend is present. Indicates a successful installation.

Installation End ***************************


Note: During this installation,

If G++.exejing\appdata\local\theano\compiledir_windows-10-10.0.14393intel64_family_6_model_42_stepping_7_ appears The reason for the Genuineintel-2.7.13-64\lazylinker_ext\mod.cpp file location is that there are spaces in the "Your Username" folder (C:\Users\rt (your username)). To change the user name can be (direct changes can not, find experience on the Internet)

For example, my first directory is C:\Users\ruantuan, there are spaces in the middle, after modification into the C:\USERS\RT problem solved ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.