From 034652338fef7b307a10a03fefbbd8e200af0e76 Mon Sep 17 00:00:00 2001 From: yuyuyzl Date: Sun, 8 Feb 2026 23:29:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B8=A7=E7=8E=87?= =?UTF-8?q?=E9=99=90=E5=88=B6=E5=AE=9E=E7=8E=B0=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ezvtuber-rt | 2 +- src/args.py | 1 + src/main.py | 4 ++++ src/model_infer_client.py | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ezvtuber-rt b/ezvtuber-rt index 64a3975..1118b7d 160000 --- a/ezvtuber-rt +++ b/ezvtuber-rt @@ -1 +1 @@ -Subproject commit 64a397543998d26af80c4364e7129c9a9d33505a +Subproject commit 1118b7d4856830a25f31ba5f491b535305c6b3a7 diff --git a/src/args.py b/src/args.py index 6800e06..4b2d98f 100644 --- a/src/args.py +++ b/src/args.py @@ -51,6 +51,7 @@ parser.add_argument('--eyebrow', action='store_true') parser.add_argument('--use_interpolation', action='store_true') parser.add_argument('--interpolation_scale', type=int, default=1) parser.add_argument('--interpolation_half', action='store_true') +parser.add_argument('--mark_interpolated', action='store_true', help='在插值帧左上角打红点便于确认补帧输出') parser.add_argument('--use_sr', action='store_true') parser.add_argument('--sr_x4', action='store_true') diff --git a/src/main.py b/src/main.py index fa09a59..77c800e 100644 --- a/src/main.py +++ b/src/main.py @@ -111,9 +111,13 @@ def main(): else: cv2.imshow("EasyVtuber Debug Frame", np_ret_shms[i]) cv2.waitKey(1) + # 限速:若 last_time 落后于当前时间则对齐到 now,避免开局成坨送帧 wait_until(last_time + interval) last_time += interval + now = time.perf_counter() + if last_time < now: + last_time = now ret_batch_shm_channels[i].release() print("Infer Process FPS: {:.2f}, Input FPS: {:.2f}, Model Avg Interval: {:.2f} ms, Cache Hit Ratio: {:.2f}%, GPU Cache Hit Ratio: {:.2f}%, Output Pipeline FPS {:.5f}".format( infer_process.pipeline_fps_number.value, diff --git a/src/model_infer_client.py b/src/model_infer_client.py index 4f57e88..8407a92 100644 --- a/src/model_infer_client.py +++ b/src/model_infer_client.py @@ -1,4 +1,5 @@ import math +import os from multiprocessing import Process, Value, shared_memory, Event import cv2 import numpy as np @@ -32,6 +33,9 @@ class ModelClientProcess(Process): self.finish_event = Event() def run(self): + # 插值帧红点标记:由 --mark_interpolated 控制,供 ezvtb_rt 读取 + if getattr(args, 'mark_interpolated', False): + os.environ['EZVTB_MARK_INTERPOLATED'] = '1' pose_position_shm_guard = SharedMemoryGuard(self.pose_position_shm, ctrl_name="pose_position_shm_ctrl") np_pose_shm = np.ndarray((45,), dtype=np.float32, buffer=self.pose_position_shm.buf[:45 * 4]) np_position_shm = np.ndarray((4,), dtype=np.float32, buffer=self.pose_position_shm.buf[45 * 4:45 * 4 + 4 * 4])