zhoubolei / TRN-pytorch

Temporal Relation Networks
http://relation.csail.mit.edu/
Other
786 stars 191 forks source link

RuntimeError: CUDA out of memory. #39

Open KAIIUK opened 5 years ago

KAIIUK commented 5 years ago

Hi. Does anyone know how to solve this problem?

CUDA_VISIBLE_DEVICES=0 python test_video.py --arch InceptionV3 --dataset moments --weight pretrain/TRN_moments_RGB_InceptionV3_TRNmultiscale_segment8_best_v0.4.pth.tar --frame_folder sample_data/bolei_juggling /home/kaiiuk/actionrecognition/TRN-pytorch/models.py:87: UserWarning: nn.init.normal is now deprecated in favor of nn.init.normal. normal(self.new_fc.weight, 0, std) /home/kaiiuk/actionrecognition/TRN-pytorch/models.py:88: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant. constant(self.new_fc.bias, 0) Multi-Scale Temporal Relation Network Module in use ['8-frame relation', '7-frame relation', '6-frame relation', '5-frame relation', '4-frame relation', '3-frame relation', '2-frame relation'] Freezing BatchNorm2D except the first one. /home/kaiiuk/anaconda3/envs/deep-person-reid/lib/python3.7/site-packages/torchvision/transforms/transforms.py:187: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. warnings.warn("The use of the transforms.Scale transform is deprecated, " + Loading frames in sample_data/bolei_juggling Traceback (most recent call last): File "test_video.py", line 140, in logits = net(input_var) File "/home/kaiiuk/anaconda3/envs/deep-person-reid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, kwargs) File "/home/kaiiuk/action_recognition/TRN-pytorch/models.py", line 220, in forward base_out = self.base_model(input.view((-1, sample_len) + input.size()[-2:])) File "/home/kaiiuk/anaconda3/envs/deep-person-reid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, *kwargs) File "/home/kaiiuk/action_recognition/TRN-pytorch/model_zoo/bninception/pytorch_load.py", line 49, in forward data_dict[op[2]] = getattr(self, op[0])(data_dict[op[-1]]) File "/home/kaiiuk/anaconda3/envs/deep-person-reid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(input, kwargs) File "/home/kaiiuk/anaconda3/envs/deep-person-reid/lib/python3.7/site-packages/torch/nn/modules/pooling.py", line 148, in forward self.return_indices) File "/home/kaiiuk/anaconda3/envs/deep-person-reid/lib/python3.7/site-packages/torch/_jit_internal.py", line 132, in fn return if_false(*args, **kwargs) File "/home/kaiiuk/anaconda3/envs/deep-person-reid/lib/python3.7/site-packages/torch/nn/functional.py", line 425, in _max_pool2d input, kernel_size, stride, padding, dilation, ceil_mode)[0] File "/home/kaiiuk/anaconda3/envs/deep-person-reid/lib/python3.7/site-packages/torch/nn/functional.py", line 417, in max_pool2d_with_indices return torch._C._nn.max_pool2d_with_indices(input, kernel_size, _stride, padding, dilation, ceil_mode) RuntimeError: CUDA out of memory. Tried to allocate 143.62 MiB (GPU 0; 7.92 GiB total capacity; 2.93 GiB already allocated; 94.38 MiB free; 14.45 MiB cached)

dukebrah commented 5 years ago

change:

transforms.GroupOverSample(net.input_size, net.scale_size),

to

transforms.GroupScale(net.scale_size), transforms.GroupCenterCrop(net.input_size),