我正在从Udemy上的深度学习课程中运行卷积神经网络,但是当我这样做时,我可以看到我的GPU时钟峰值,但是GPU百分比使用率仍然是5%,甚至超过8000个平均大小的图像一个历元300 * 400需要大约5分钟的时间。
我有Windows 10, 内存-8GB GPU-Nvidia Geforce Gtx 1060 6GB
完整代码在这里:
# Convolutional neural network
from keras.models import Sequential
from keras.layers import Conv2D,MaxPooling2D,Flatten,Dense
# Initializing CNN
cl = Sequential()
# Convolution
cl.add(Conv2D(32,3,3, input_shape=(64,64,3),activation='relu'))
# Polling
cl.add(MaxPooling2D(pool_size=(2,2)))
# Flattening
cl.add(Flatten())
# Full Connection
cl.add(Dense(128,activation='relu'))
cl.add(Dense(1,activation='sigmoid'))
# Compiling the CNN
cl.compile(optimizer='adam',loss='binary_crossentropy',metrics=['accuracy'])
# Fitting the CNN
from keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(rescale = 1./255,
shear_range = 0.2,
zoom_range = 0.2,
horizontal_flip = True)
test_datagen = ImageDataGenerator(rescale = 1./255)
training_set = train_datagen.flow_from_directory('dataset/training_set',
target_size = (64, 64),
batch_size = 100,
class_mode = 'binary')
test_set = test_datagen.flow_from_directory('dataset/test_set',
target_size = (64, 64),
batch_size = 100,
class_mode = 'binary')
cl.fit_generator(training_set,
steps_per_epoch = 8000,
epochs = 25,
validation_data = test_set,
validation_steps = 2000)
答案 0 :(得分:0)
我也发生了同样的事情。如果下载gpu-z,您会发现GPU负载实际上比任务管理器上显示的要高。