From c13e231bec4ea55841596e9a7fd12ddfe223d474 Mon Sep 17 00:00:00 2001 From: s_kiani Date: Thu, 20 Feb 2025 10:48:46 +0330 Subject: [PATCH] added torch.cuda.empty_cache() --- core.py | 2 ++ tracker/pytracking/tracker/dimp/dimp.py | 1 + 2 files changed, 3 insertions(+) diff --git a/core.py b/core.py index 3191da0..5845c46 100755 --- a/core.py +++ b/core.py @@ -5,6 +5,7 @@ from threading import Event, Thread from typing import List import numpy as np +import torch from PyQt5.QtCore import QThread, pyqtSlot, pyqtSignal, QUrl, QDir, pyqtProperty #from icecream import ic @@ -60,6 +61,7 @@ class Core(QThread): def __detection(self): while self.__is_detecting: try: + torch.cuda.empty_cache() source = self.__processing_source roi = self.__detection_roi frame = source.get_frame() diff --git a/tracker/pytracking/tracker/dimp/dimp.py b/tracker/pytracking/tracker/dimp/dimp.py index 6747c79..b72b82f 100755 --- a/tracker/pytracking/tracker/dimp/dimp.py +++ b/tracker/pytracking/tracker/dimp/dimp.py @@ -65,6 +65,7 @@ class DiMP(): def track(self, image) -> dict: + torch.cuda.empty_cache() # Convert image im = numpy_to_torch(image)