- Keras 2.x Projects
- Giuseppe Ciaburro
- 372字
- 2021-07-02 14:36:13
Keras installation and configuration
At this point, the environment is ready for Keras installation. If all the dependencies and the backend engine have been correctly installed, we can proceed. Actually, the work that remains to be done is very simple and immediate.
There are two ways to install Keras as follows:
The first step involves the use of the Python Package Index (PyPI).
This is a repository of software for the Python programming language. PyPI helps you find and install software developed and shared by the Python community. This is the recommended option.
After installing the PyPI package, simply type the following command:
$ sudo pip install keras
If you are using a virtualenv, you may want to avoid using sudo:
$ pip install keras
Alternatively, we can install Keras from the GitHub source. To do this, we first need to clone Keras using git:
$ git clone https://github.com/keras-team/keras.git
Then, add cd to the keras folder and run the install command:
cd keras
sudo python setup.py install
We have the Keras environment available to implement our deep learning models. Let us look at some more information about the configuration. As we have already mentioned, Keras uses TensorFlow as the default backend. If we want to use the other two options, Theano and CNTK, we must modify the Keras configuration file. This is a file with the .json extension, and is named keras.json..
The file's position depends on the operating system that is in use in our PC:
$ HOME/.keras/keras.json
We can use the following command for Unix-like OSes:
%USERPROFILE%/.Keras/keras.json
And, for Windows OS, the contents of the configuration file are of the following type:
{
"image_data_format": "channels_last",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
The parameters have the following meaning:
- image_data_format: String, either channels_last or channels_first. It specifies which data format convention Keras will follow.
- epsilon: Float, a numeric fuzzing constant used to avoid dividing by zero in some operations.
- floatx: String, float16, float32, or float64. Default float precision.
- backend: String, tensorflow, theano, or cntk.
Switching from one backend to another is very fast. Simply change the field backend to theano, tensorflow, or cntk, and Keras will use the new configuration the next time you run any Keras code.
- Div+CSS 3.0網頁布局案例精粹
- Python Artificial Intelligence Projects for Beginners
- R Machine Learning By Example
- 西門子S7-200 SMART PLC從入門到精通
- 計算機網絡應用基礎
- 機器學習流水線實戰
- ESP8266 Home Automation Projects
- MCGS嵌入版組態軟件應用教程
- Salesforce Advanced Administrator Certification Guide
- 數字多媒體技術基礎
- 手把手教你學Flash CS3
- 筆記本電腦維修之電路分析基礎
- Mastering Machine Learning with R
- R Statistics Cookbook
- 創客機器人實戰:基于Arduino和樹莓派