Tencent / FaceDetection-DSFD

腾讯优图高精度双分支人脸检测器
Other
2.91k stars 728 forks source link

RuntimeError: CUDA out of memory. #60

Open StetchPlane opened 4 years ago

StetchPlane commented 4 years ago

pytorch=1.10 cuda=9.0 This error is displaying while running "python widerface_val.py" Can you tell me where the problem is?

Testing image 1/3226 0_Parade_marchingband_1_465.jpg.... Traceback (most recent call last): File "widerface_val.py", line 306, in test_widerface() File "widerface_val.py", line 293, in test_widerface [det2, det3] = multi_scale_test(image, max_im_shrink)#min(2,1400/min(image.shape[0],image.shape[1]))) #multi-scale test File "widerface_val.py", line 104, in multi_scale_test det_b = detect_face(image, bt) File "widerface_val.py", line 60, in detect_face y = net(x) File "/home/cqupt/.conda/envs/w_py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, kwargs) File "/home/cqupt/.conda/envs/w_py36/FaceDetection-DSFD/face_ssd.py", line 238, in forward conv5_3_x = self.layer3(conv4_3_x) File "/home/cqupt/.conda/envs/w_py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/cqupt/.conda/envs/w_py36/lib/python3.6/site-packages/torch/nn/modules/container.py", line 92, in forward input = module(input) File "/home/cqupt/.conda/envs/w_py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, kwargs) File "/home/cqupt/.conda/envs/w_py36/lib/python3.6/site-packages/torch/nn/modules/container.py", line 92, in forward input = module(input) File "/home/cqupt/.conda/envs/w_py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/cqupt/.conda/envs/w_py36/lib/python3.6/site-packages/torchvision/models/resnet.py", line 98, in forward out = self.conv2(out) File "/home/cqupt/.conda/envs/w_py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, **kwargs) File "/home/cqupt/.conda/envs/w_py36/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 338, in forward self.padding, self.dilation, self.groups) RuntimeError: CUDA out of memory. Tried to allocate 12.00 MiB (GPU 0; 10.76 GiB total capacity; 9.63 GiB already allocated; 7.06 MiB free; 358.29 MiB cached)

swordlidev commented 4 years ago

Your pytorch is 1.10, our pytorch is 0.3. If you just want to do evaluation, add torch.set_grad_enabled(False) inside test_oneimage() function (at the beginning of the function).

StetchPlane commented 4 years ago

Can you tell me the specific version of Python you use?