Processing data with Workflows

inference workflows command provides a way to process images and videos with Workflows. It is possible to process:

  • Individual images
  • Directories of images
  • Video files
Note

To check detail of the command, run inference workflows --help. Help is also available for each sub-command: inference workflows process-image --help.

Process individual image

Basic usage:

inference workflows process-image \
    --image_path {your-input-image} \
    --output_dir {your-output-dir} \
    --workspace_name {your-roboflow-workspace-url} \
    --workflow_id {your-workflow-id} \
    --api-key {your_roboflow_api_key}

This takes your input image, runs it against your Workflow and saves results in the output directory. By default, the Workflow will be processed using Roboflow Hosted API. You can tweak behaviour:

  • To process the image locally using inference Python package, use --processing_target inference_package option (requires inference to be installed).
  • Any option that starts from -- which is not listed in --help will be treated as input parameter to the workflow execution with automatic type conversion applied. Additionally --workflow_params option may specify a path to a *.json file providing workflow parameters.
  • If your Workflow defines an image parameter placeholder under a name different from image, you can point the proper image input by --image_input_name.
  • --allow_override flag must be used if the output directory is not empty.

Process directory of images

inference workflows process-images-directory \
    -i {your_input_directory} \
    -o {your_output_directory} \
    --workspace_name {your-roboflow-workspace-url} \
    --workflow_id {your-workflow-id} \
    --api-key {your_roboflow_api_key}

Additional options:

  • --processing_target inference_package to process locally.
  • --threads option can specify number of threads used to run the requests when processing target is API.
  • --allow_override flag must be used if output directory is not empty.

Process video file

Note

This command requires inference to be installed.

inference workflows process-video \
    --video_path {video_to_be_processed} \
    --output_dir {empty_directory} \
    --workspace_name {your-roboflow-workspace-url} \
    --workflow_id {your-workflow-id} \
    --api-key {your_roboflow_api_key}

Additional options:

  • --max_fps option can be used to subsample video frames while processing.
  • --allow_override flag must be used if output directory is not empty.