我想了解如何用卷积神经网络生成高分辨率的低分辨率图像。
是否有必要在网络上有一个较小的输入映像,并且输出是图像的两倍大?
我做了以下模型:
w,h,c=x_train[0].shape
input = Input(shape=(w,h,c),name='LR')
x = UpSampling2D(size=(2,2), name='UP')(input)
h = Dense(720, activation='relu', name ='hide')(x)
h2= Dense(1280, activation='relu', name ='hide2')(h)
output= Dense(3, activation='relu', name ='output')(h2)
model = Model(inputs=input, outputs=output)
model.compile(loss='mse', optimizer='adam', metrics=['accuracy'])
model.fit(x_train,y_train, epochs=50, verbose=0)Y_train的大小是x_train的两倍。
但我得到以下错误消息:
ResourceExhaustedError: OOM when allocating tensor with shape[4608000,720] and type float on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu
[[{{node hide/MatMul}}]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info我做错了什么?
发布于 2019-03-05 12:44:47
这类内存不足(OOM)错误是典型的大批处理大小,无法满足您的内存。
我做了
model.fit(x_train,y_train,batch_size=1024, epochs=50, verbose=0),结果超过了系统内存的10%。
1024听起来太大了-那么。起步较小(例如~ 64),然后逐渐增加2的功率(例如128,256.)直到你得到一个足够大的批次大小,仍然适合你的记忆。
How to calculate optimal batch size中的一般性讨论也可能会有所帮助.
https://stackoverflow.com/questions/55002690
复制相似问题