Keras is an open source artificial neural network library written in Python, which can be used as a high-level application program interface for Tensorflow, Microsoft-CNTK and Theano for the design, debugging, evaluation, application and visualization of deep learning models.
The main developer of Keras is Google engineer François Chollet, and its GitHub project page contains 6 main maintainers and more than 800 direct contributors. After the official version of Keras is released, except for some pre-compiled models, the source code is released under the MIT license.
**1. friendly user. **
Keras is an API designed for humans, not for machines.
It puts the user experience first and center. Keras follows best practices for reducing cognitive difficulties: it provides a consistent and simple API, minimizes the number of user actions required for common use cases, and provides clear and actionable feedback when user errors occur.
**2. Modularity. **
A model is understood as a sequence or diagram composed of independent, fully configurable modules.
These modules can be assembled with as few restrictions as possible. In particular, neural network layers, loss functions, optimizers, initialization methods, activation functions, and regularization methods are all modules that can be combined to build new models.
**3. Easy to expand. **
New modules are easy to add (as new classes and functions), and existing modules already provide plenty of examples. Keras is more suitable for advanced research because it can easily create new modules that can improve expressiveness.
**4. Based on Python. **
Keras does not have a separate configuration file in a specific format. The model is defined in Python code, which is compact, easy to debug, and easy to extend.
First install tensorflow
# GPU version
pip install --upgrade tensorflow-gpu
# CPU version
pip install --upgrade tensorflow
Verify that the installation is successful:
import tensorflow as tf
Then install keras
# Keras installation
pip install keras -U --pre
NumPy (Numerical Python) is an extension library of the Python language, which supports a large number of dimensional arrays and matrix operations, and also provides a large number of mathematical function libraries for array operations.
sudo apt-get install python-numpy
scipy is an advanced scientific computing library, the common ones are interpolation operations, optimization algorithms, image processing and mathematical statistics.
sudo apt-get install python-scipy
Matplotlib is a plotting library for Python. It can be used with NumPy and provides an effective open source alternative to MatLab. It can also be used with graphics toolkits such as PyQt and wxPython.
sudo apt-get install python-matplotlib
BLAS (Basic Linear Algebra Subprograms) is the basic linear algebra subprogram library, which contains a large number of programs about linear algebra operations that have been written.
sudo apt-get install build-essential cmake git unzip \
pkg-config libopenblas-dev liblapack-dev
It was originally developed by NASA (National Aeronautics and Space Administration) to save large files of numerical data in an efficient binary format. It allows you to save Keras models to disk quickly and efficiently.
sudo apt-get install libhdf5-serial-dev python-h5py
Used to visualize Keras models.
sudo apt-get install graphviz
sudo pip install pydot-ng
OpenCV is a cross-platform computer vision library released under the BSD license (open source), which can run on Linux, Windows, Android and Mac OS operating systems. It is lightweight and efficient—consisting of a series of C functions and a small number of C++ classes, it also provides interfaces to languages such as Python, Ruby, and MATLAB, and implements many common algorithms in image processing and computer vision.
sudo apt-get install python-opencv
Because I don’t have a GPU here, the following reference
GPU is not absolutely necessary, but books generally recommend using GPU.
Sometimes it may take several hours to run the trained model on the CPU, but only a few minutes on a good GPU.
If you want to use NVIDIA GPU for deep learning, you need to install CUDA and cuDNN at the same time.
CUDA™ is a general-purpose parallel computing architecture launched by NVIDIA, which enables GPUs to solve complex computing problems.
download
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/
x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
installation
sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/
cuda/repos/ubuntu1604/ x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda-8-0
NVIDIA cuDNN is a GPU accelerated library for deep neural networks. It emphasizes performance, ease of use and low memory overhead. NVIDIA cuDNN can be integrated into higher-level machine learning frameworks, such as Google's Tensorflow and the popular caffe software of the University of California, Berkeley.
When using cuDNN and running on the GPU, the training speed of the model can usually be increased by 50% to 100%
installation
sudo dpkg -i dpkg -i libcudnn6*.deb
Ok, even if some basic tools are installed here. O(∩_∩)O
Keras Baidu EncyclopediaKeras official document NumPy TutorialNumPy Matplotlib
Recommended Posts