Installations for running keras-theano on GPU
- Upgrade pip and install opencv2
cd ~
pip install --upgrade pip
pip install opencv-python
- Upgrade keras and set theano background
pip uninstall keras
pip install keras
vi ~/.keras/keras.json
{
"backend": "theano",
"image_data_format": "channels_first",
"floatx": "float32",
"epsilon": 1e-07
}
- Upgrade theano
pip uninstall theano
pip install theano==1.0.1
- Install pygpu which is necessary to run theano on GPU
git clone https://github.com/Theano/libgpuarray.git
cd libgpuarray
mkdir Build
cd Build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
make install
cd ..
python3 setup.py build_ext -L /root/libgpuarray/lib -I /root/libgpuarray/include
python3 setup.py install
sudo ldconfig
- Run python on a specific GPU
THEANO_FLAGS=device=cuda0 python3
How to run the project
-
Download challenging text line dataset
-
Preprocess
python3 preprocess.py
- Train
THEANO_FLAGS=device=cuda0 python3
- Predict
python3 SlidingPredictor.py
- Postprocess
python3 directional_morphing.py