Skip to content

Commit

Permalink
Merge pull request #1003 from roboflow/feature/improve_video_processi…
Browse files Browse the repository at this point in the history
…ng_progress_reporting

Add possibility to inject sink function to batch video processing
  • Loading branch information
PawelPeczek-Roboflow authored Feb 6, 2025
2 parents 78a5424 + c73a57e commit 4d410f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inference/core/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.36.2"
__version__ = "0.37.0rc1"


if __name__ == "__main__":
Expand Down
5 changes: 4 additions & 1 deletion inference_cli/lib/workflows/video_adapter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os.path
from collections import defaultdict
from functools import partial
from glob import glob
from typing import Any, Dict, List, Optional, Union

import cv2
Expand All @@ -12,6 +11,7 @@

from inference import InferencePipeline
from inference.core.interfaces.camera.entities import VideoFrame
from inference.core.interfaces.stream.entities import SinkHandler
from inference.core.interfaces.stream.sinks import multi_sink
from inference.core.utils.image_utils import load_image_bgr
from inference_cli.lib.utils import dump_jsonl
Expand All @@ -31,6 +31,7 @@ def process_video_with_workflow(
max_fps: Optional[float] = None,
save_image_outputs_as_video: bool = True,
api_key: Optional[str] = None,
on_prediction: Optional[SinkHandler] = None,
) -> VideoProcessingDetails:
structured_sink = WorkflowsStructuredDataSink(
output_directory=output_directory,
Expand All @@ -39,6 +40,8 @@ def process_video_with_workflow(
)
progress_sink = ProgressSink.init(input_video_path=input_video_path)
sinks = [structured_sink.on_prediction, progress_sink.on_prediction]
if on_prediction:
sinks.append(on_prediction)
video_sink: Optional[WorkflowsVideoSink] = None
if save_image_outputs_as_video:
video_sink = WorkflowsVideoSink.init(
Expand Down

0 comments on commit 4d410f7

Please sign in to comment.