Open zhangyu2ustc opened 5 years ago
New models: HCP_task_fmri_cnn_tensorpack_changesize_bk.py
Convert the model from multi-gpu to only CPU version:
###put the model on CPU only
with tf.device("/cpu:0"):
if Flag_CNN_Model == '2d':
print('\nTraining the model using 2d-CNN with learning-rate: %s \n' % str(learning_rate))
model_test = build_cnn_model_test(img_shape, nb_class)
elif Flag_CNN_Model == '3d':
print('\nTraining the model using 3d-CNN with learning-rate: %s \n' % str(learning_rate))
model_test = build_cnn3d_model_test(img_shape, nb_class)
In Keras, it is simple to using multi-gpu instead of one.
as instructed in the following website: https://www.pyimagesearch.com/2017/10/30/how-to-multi-gpu-training-with-keras-python-and-deep-learning/