我无法在我的 GPU 上使用迁移学习 (VGG16) 训练我的模型
I cannot train my model using transfer learning (VGG16) on my GPU
我正在尝试使用迁移学习来训练我的模型,以根据植物图像检测水稻中的疾病。我尝试使用 VGG16,但无法使用我的 GPU 对其进行训练。我有 NVIDIA GeForce MX150。
下面是我用来拟合模型的代码:
import tensorflow as tf
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
with tf.device('/device:GPU:1'):
# fit the model
r = model.fit(
training_set,
validation_data=test_set,
epochs=20,
steps_per_epoch=len(training_set),
validation_steps=len(test_set)
)
Tensorflow GPU 支持需要一些依赖项。请参阅 https://www.tensorflow.org/install/gpu
然后,尝试 tf.test.is_gpu_available()
- 如果这是 True
,那么您的 GPU 正在用于训练。
在单个 GPU 上,您应该不需要使用 with
在 GPU 上进行训练。为了我能提供更多帮助,请提供任何日志或错误。
我正在尝试使用迁移学习来训练我的模型,以根据植物图像检测水稻中的疾病。我尝试使用 VGG16,但无法使用我的 GPU 对其进行训练。我有 NVIDIA GeForce MX150。
下面是我用来拟合模型的代码:
import tensorflow as tf
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
with tf.device('/device:GPU:1'):
# fit the model
r = model.fit(
training_set,
validation_data=test_set,
epochs=20,
steps_per_epoch=len(training_set),
validation_steps=len(test_set)
)
Tensorflow GPU 支持需要一些依赖项。请参阅 https://www.tensorflow.org/install/gpu
然后,尝试 tf.test.is_gpu_available()
- 如果这是 True
,那么您的 GPU 正在用于训练。
在单个 GPU 上,您应该不需要使用 with
在 GPU 上进行训练。为了我能提供更多帮助,请提供任何日志或错误。