部分小问题的修改
This commit is contained in:
@ -114,7 +114,7 @@ async def run_detect_img(
|
||||
while process.poll() is None:
|
||||
line = process.stdout.readline()
|
||||
process.stdout.flush() # 刷新缓存,防止缓存过多造成卡死
|
||||
if line != '\n':
|
||||
if line != '\n' and 'yolo' not in line:
|
||||
await room_manager.send_to_room(room, line + '\n')
|
||||
# 等待进程结束并获取返回码
|
||||
return_code = process.wait()
|
||||
@ -178,7 +178,14 @@ async def run_detect_rtsp(weights_pt: str, rtsp_url: str, data: str, detect_id:
|
||||
|
||||
time.sleep(3) # 等待3s,等待websocket进入
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
for path, im, im0s, vid_cap, s in dataset:
|
||||
# 检查是否已经超过10分钟(600秒)
|
||||
elapsed_time = time.time() - start_time
|
||||
if elapsed_time > 600: # 600 seconds = 10 minutes
|
||||
print(room, "已达到最大执行时间,结束推理。")
|
||||
break
|
||||
if room_manager.rooms.get(room):
|
||||
im = torch.from_numpy(im).to(model.device)
|
||||
im = im.half() if model.fp16 else im.float() # uint8 to fp16/32
|
||||
|
Reference in New Issue
Block a user