我努力训练受VGG-16模型启发的卷积神经网络:
Input image: 70x70 pixels cropped face
2 x cov-3 (1, 64), (64, 64)
max_pooling
dropout (keep_rate = 0.75)
2 x conv-3 (64, 128), (128, 128)
max_pooling
dropout (keep_rate = 0.75)
2 X conv-3 (128, 256), (256, 256)
1 X conv-3 (256, 256)
max_pooling
dropout (keep_rate = 0.75)
2 X conv-3 (256, 512), (512, 512)
1 X conv-3 (512, 512)
max_pooling
dropout (keep_rate = 0.75)
fully_connected 3*3*512 - output 2048
dropout (keep_rate = 0.75)
fully_connected 2048 - output 128
问题是我无法使用更多40张图片/小批量,因为它们不适合内存。 我使用tensorflow作为框架。 这是我得到的错误:
ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[70,18,18,256]
[[Node: siamese/Conv2D_32 = Conv2D[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/gpu:0"](siamese/Relu_33, siamese/w_conv3_3/read)]]
[[Node: siamese/l2_normalize_2/_27 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_3157_siamese/l2_normalize_2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
我有什么方法可以使用更大的小批量?也许以某种方式累积渐变然后传播它?
我的RAM详细信息:
free -m
total used free shared buff/cache available
Mem: 7911 1786 1963 79 4161 5705
Swap: 8119 0 8119