track video processing total job count

This commit is contained in:
Vladimir Mandic
2024-06-30 14:09:48 -04:00
parent f1a872cb85
commit 5af36d2182
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -388,6 +388,7 @@ def control_run(units: List[unit.Unit] = [], inputs: List[Image.Image] = [], ini
codec = util.decode_fourcc(video.get(cv2.CAP_PROP_FOURCC))
status, frame = video.read()
if status:
shared.state.frame_count = 1 + frames // (video_skip_frames + 1)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
shared.log.debug(f'Control: input video: path={inputs} frames={frames} fps={fps} size={w}x{h} codec={codec}')
except Exception as e:
+1 -1
View File
@@ -62,7 +62,7 @@ def progressapi(req: ProgressRequest):
paused = shared.state.paused
if not active:
return InternalProgressResponse(job=shared.state.job, active=active, queued=queued, paused=paused, completed=completed, id_live_preview=-1, textinfo="Queued..." if queued else "Waiting...")
shared.state.job_count = max(shared.state.job_count, shared.state.job_no)
shared.state.job_count = max(shared.state.frame_count, shared.state.job_count, shared.state.job_no)
batch_x = max(shared.state.job_no, 0)
batch_y = max(shared.state.job_count, 1)
step_x = max(shared.state.sampling_step, 0)
+3
View File
@@ -12,6 +12,7 @@ class State:
job = ""
job_no = 0
job_count = 0
frame_count = 0
total_jobs = 0
job_timestamp = '0'
sampling_step = 0
@@ -71,6 +72,7 @@ class State:
self.interrupted = False
self.job = title
self.job_count = -1
self.frame_count = -1
self.job_no = 0
self.job_timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
self.paused = False
@@ -93,6 +95,7 @@ class State:
self.job = ""
self.job_count = 0
self.job_no = 0
self.frame_count = 0
self.paused = False
self.interrupted = False
self.skipped = False