Run Workflows

Process single images, directories of images, and video files with a Roboflow Workflow from the command line.

The inference workflows command provides a way to process images and videos with a Workflow. It can process:

  • individual images
  • directories of images
  • video files

To see the details of the command, run:

inference workflows --help

A help guide is also available for each sub-command:

inference workflows process-image --help

Process an individual image

Basic usage of the command:

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 the results in the output directory. By default, the Workflow is processed using the Roboflow hosted API. You can tweak the behaviour of the command:

  • if you want to process the image locally using the inference Python package, use the --processing_target inference_package option (requires inference to be installed)
  • to see all options, use inference workflows process-image --help
  • any option starting with -- that is not listed in the --help output is treated as an input parameter to the Workflow execution, with automatic type conversion applied. Additionally, the --workflow_params option may specify a path to a *.json file providing Workflow parameters (explicit parameters override parameters defined in the file).
  • if your Workflow defines an image parameter placeholder under a name different from image, you can point to the proper image input with --image_input_name
  • the --allow_override flag must be used if the output directory is not empty

Process a directory of images

Basic usage of the command:

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}

You can tweak the behaviour of the command:

  • if you want to process the images locally using the inference Python package, use the --processing_target inference_package option (requires inference to be installed)
  • to see all options, use inference workflows process-images-directory --help
  • any option starting with -- that is not listed in the --help output is treated as an input parameter to the Workflow execution, with automatic type conversion applied. Additionally, the --workflow_params option may specify a path to a *.json file providing Workflow parameters (explicit parameters override parameters defined in the file).
  • if your Workflow defines an image parameter placeholder under a name different from image, you can point to the proper image input with --image_input_name
  • the --allow_override flag must be used if the output directory is not empty
  • the --threads option can specify the number of threads used to run the requests when the processing target is the API

Process a video file

This command requires the inference package to be installed.

Basic usage of the command:

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}

You can tweak the behaviour of the command:

  • the --max_fps option can be used to subsample video frames while processing
  • to see all options, use inference workflows process-video --help
  • any option starting with -- that is not listed in the --help output is treated as an input parameter to the Workflow execution, with automatic type conversion applied. Additionally, the --workflow_params option may specify a path to a *.json file providing Workflow parameters (explicit parameters override parameters defined in the file).
  • if your Workflow defines an image parameter placeholder under a name different from image, you can point to the proper image input with --image_input_name
  • the --allow_override flag must be used if the output directory is not empty