sainatarajan / U-Net

A simple U-Net implementation for custom dataset. Just create required folders and place the images and then start training.
20 stars 6 forks source link

How to run on GPU #11

Closed mfaramarzi closed 4 years ago

mfaramarzi commented 4 years ago

@sainatarajan

Can I run it on GPU? If positive, what is the packages configuration needed and what extra command should be used? Thanks!

sainatarajan commented 4 years ago

@mfaramarzi If you have tensorflow-gpu and keras-gpu installed, your code will automatically be run on the GPU.

mfaramarzi commented 4 years ago

@sainatarajan Dear friend, after installing Keras-gpu, It is still running on the CPU. I have been successful in running on the GPU for my other projects e.g YOLO. My current env has the following packages: keras 2.2.4 keras-gpu 2.3.1 tensorflow 1.13.1 tensorflow-gpu 1.13.1

sainatarajan commented 4 years ago

Try adding the following lines in unet.py

import tensorflow as tf

config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
tf.compat.v1.keras.backend.set_session(tf.compat.v1.Session(config=config))
mfaramarzi commented 4 years ago

Try adding the following lines in unet.py

import tensorflow as tf

config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
tf.compat.v1.keras.backend.set_session(tf.compat.v1.Session(config=config))

Still running on the CPU python 3.7.7

sainatarajan commented 4 years ago

@mfaramarzi I see. This might sound funny, do you use any brightness controller app on your ubuntu machine? If yes, try running the model without running the brightness controller software. I found an issue with TensorFlow not able to use the GPU when the brightness controller was being used.

I will download the repo and try with my data and let you know whether it works or not.

sainatarajan commented 4 years ago

Update: It runs on GPU for me

image