Thank you very much, it worked for me !!
But I have an other issue, I want to train my model, I have a 6Go RAM GPU, and I have image with sizes [3, 1080, 1920]. I have a CUDA out of memory because my batch size is 2. And sometime I also have the same error with a batch size = 1. And now, I trained my model with my GPU, I saved it, and when I reboot my computer and downloaded the model, I just tried to apply a model.eval on one image and i have the same error :
and then i found something very similar
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-20-78cfb42ac7f0> in <module>
----> 1 list_images, list_predictions = inference_gpu([25000], path_to_video = path_to_video_lab7, draw_bbox = True, threshold = 0.5)

<ipython-input-18-ff953f2b711e> in inference_gpu(list_path_inf, path_to_video, draw_bbox, threshold)
     17             data_transform = transforms.Compose([transforms.Resize((img_array.shape[0],img_array.shape[1] )), transforms.ToTensor()])
     18 
---> 19             image = data_transform(image).cuda() # donne une shape torch.Size([3, 905, 662])
     20             model.cuda()
     21             model.eval()

RuntimeError: CUDA out of memory. Tried to allocate 48.00 MiB (GPU 0; 5.81 GiB total capacity; 4.44 GiB already allocated; 6.38 MiB free; 4.50 GiB reserved in total by PyTorch)

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-15-0c2804b316ac> in <module>
----> 1 list_images, list_predictions = inference_gpu([25000,18000], path_to_video = path_to_video_lab7, draw_bbox = True, threshold = 0.5)

<ipython-input-14-81c5908686f8> in inference_gpu(list_path_inf, path_to_video, draw_bbox, threshold)
     20             model.cuda()
     21             model.eval()
---> 22             out = model([image])
     23             list_images.append(image)
     24             list_predictions.append(out)

~/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
   1049         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1050                 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051             return forward_call(*input, **kwargs)
   1052         # Do not call functions when jit is used
   1053         full_backward_hooks, non_full_backward_hooks = [], []

~/anaconda3/lib/python3.8/site-packages/torchvision/models/detection/generalized_rcnn.py in forward(self, images, targets)
     94         if isinstance(features, torch.Tensor):
     95             features = OrderedDict([('0', features)])
---> 96         proposals, proposal_losses = self.rpn(images, features, targets)
     97         detections, detector_losses = self.roi_heads(features, proposals, images.image_sizes, targets)
     98         detections = self.transform.postprocess(detections, images.image_sizes, original_image_sizes)

~/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
   1049         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1050                 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051             return forward_call(*input, **kwargs)
   1052         # Do not call functions when jit is used
   1053         full_backward_hooks, non_full_backward_hooks = [], []

~/anaconda3/lib/python3.8/site-packages/torchvision/models/detection/rpn.py in forward(self, images, features, targets)
    341         # RPN uses all feature maps that are available
    342         features = list(features.values())
--> 343         objectness, pred_bbox_deltas = self.head(features)
    344         anchors = self.anchor_generator(images, features)
    345 

~/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
   1049         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1050                 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051             return forward_call(*input, **kwargs)
   1052         # Do not call functions when jit is used
   1053         full_backward_hooks, non_full_backward_hooks = [], []

~/anaconda3/lib/python3.8/site-packages/torchvision/models/detection/rpn.py in forward(self, x)
     55         bbox_reg = []
     56         for feature in x:
---> 57             t = F.relu(self.conv(feature))
     58             logits.append(self.cls_logits(t))
     59             bbox_reg.append(self.bbox_pred(t))

~/anaconda3/lib/python3.8/site-packages/torch/nn/functional.py in relu(input, inplace)
   1296         result = torch.relu_(input)
   1297     else:
-> 1298         result = torch.relu(input)
   1299     return result
   1300 

RuntimeError: CUDA out of memory. Tried to allocate 32.00 MiB (GPU 0; 5.81 GiB total capacity; 4.44 GiB already allocated; 6.38 MiB free; 4.50 GiB reserved in total by PyTorch)

Thanks for your help !  Do you have a linkedin, or a website where you publish some interesting stuff ?