Open Nervol opened 2 years ago
Also if you interested how i call the thread:
self.videoThread = QtCore.QThread()
print(self.videoThread.isRunning())
self.video = videoThread(
self.deviceList, self.comboBoxOfDevices.currentIndex(), self.stopFlag == False)
self.video.moveToThread(self.videoThread)
self.videoThread.started.connect(self.video.runStream)
self.video.signalPixmap.connect(self.showImage)
self.videoThread.start()
Same issue
When try making my own inference code, I found the gpu leakage problem. I found that the problem disappeared when I comment out the non max suppression function
pred = non_max_suppression(pred, self.conf_threshold)
So, I try this and it worked on my case
with torch.no_grad():
pred = non_max_suppression(torch.tensor(pred), conf_thres=self.conf, iou_thres=0.6)
Have a look at this: https://github.com/WongKinYiu/yolov7/pull/900
Thanks, seems to be gradient problem.
When try making my own inference code, I found the gpu leakage problem. I found that the problem disappeared when I comment out the non max suppression function
pred = non_max_suppression(pred, self.conf_threshold)
So, I try this and it worked on my case
with torch.no_grad(): pred = non_max_suppression(torch.tensor(pred), conf_thres=self.conf, iou_thres=0.6)
Hi there. I am trying to understand the memory leak issue in my multithreaded QT application. In general, QThread class has the following structure:
The detect() method is called from the run Stream() method, which is started when QThread starts. With each execution of pred = self.model(img, self.augment)[0], I perform a memory check. When starting recognition, I get an overflow error of the type "RuntimeError: CODE out of memory. Tried to allocate...", since the amount of available memory decreases with EACH tensor detection with information about detected objects. If nothing is detected, the memory does not decrease. As console output example on 3070Ti with 8 Gb RAM:
I want to note that such code based on YOLOv5 does not cause any problems with memory leaks - the problem is in YOLOv7. Also, there are no errors when using standard Thread instead of QThread.