This commit is contained in:
Max 2021-09-21 14:08:22 +01:00
parent 5c3106935d
commit 0adf8c0841
4 changed files with 19 additions and 0 deletions

View File

@ -7,6 +7,9 @@ import logging
import platform
import math
import os
import psutil
logging.basicConfig(level='INFO')
@dataclass
@ -51,6 +54,10 @@ class VideoStream:
def update(self):
while self.running:
success, frame = self.stream.read()
if not success:
current_system_pid = os.getpid()
ThisSystem = psutil.Process(current_system_pid)
ThisSystem.terminate()
assert success
self.buffer = frame
self.stream.release()

View File

@ -6,6 +6,8 @@ import sys
import threading
import time
from queue import Queue
import os
import psutil
import flask
from flask import jsonify, request

View File

@ -7,6 +7,9 @@ import platform
import math
from dataclasses import dataclass
import os
import psutil
logging.basicConfig(level='DEBUG')
class CUDA:
@ -54,6 +57,10 @@ class VideoStream:
def update(self):
while self.running:
success, frame = self.stream.read()
if not success:
current_system_pid = os.getpid()
ThisSystem = psutil.Process(current_system_pid)
ThisSystem.terminate()
assert success
self.buffer = frame
self.stream.release()

View File

@ -5,6 +5,9 @@ import platform
import time
from dataclasses import dataclass
import os
import psutil
import cv2
import apriltag_detector