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 --helpA help guide is also available for each sub-command:
inference workflows process-image --helpProcess 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
inferencePython package, use the--processing_target inference_packageoption (requiresinferenceto be installed) - to see all options, use
inference workflows process-image --help - any option starting with
--that is not listed in the--helpoutput is treated as an input parameter to the Workflow execution, with automatic type conversion applied. Additionally, the--workflow_paramsoption may specify a path to a*.jsonfile 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_overrideflag 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
inferencePython package, use the--processing_target inference_packageoption (requiresinferenceto be installed) - to see all options, use
inference workflows process-images-directory --help - any option starting with
--that is not listed in the--helpoutput is treated as an input parameter to the Workflow execution, with automatic type conversion applied. Additionally, the--workflow_paramsoption may specify a path to a*.jsonfile 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_overrideflag must be used if the output directory is not empty - the
--threadsoption 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_fpsoption 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--helpoutput is treated as an input parameter to the Workflow execution, with automatic type conversion applied. Additionally, the--workflow_paramsoption may specify a path to a*.jsonfile 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_overrideflag must be used if the output directory is not empty