I am using mac m2 and python3.9.
code;
Import the InferencePipeline object
from inference import InferencePipeline
import cv2
def my_sink(result, video_frame):
if result.get(“output_image”): # Display an image from the workflow response
cv2.imshow(“Workflow Image”, result[“output_image”].numpy_image)
cv2.waitKey(1)
print(result) # do something with the predictions of each frame
initialize a pipeline object
pipeline = InferencePipeline.init_with_workflow(
api_key=“****“,
workspace_name=””,
workflow_id=“detect-count-and-visualize”,
video_reference=0, # Path to video, device id (int, usually 0 for built in webcams), or RTSP stream url
max_fps=30,
on_prediction=my_sink
)
pipeline.start() #start the pipeline
pipeline.join() #wait for the pipeline thread to finish
error;
(new_chilli_env) souravranjanmohapatra@MacBook-Pro machine-vision-chilli % python test_inf.py
InferenceExperimentalFeatureWarning: init_with_workflow is experimental: Usage of workflows with InferencePipeline
is an experimental feature. Please report any issues here: Issues · roboflow/inference · GitHub
UserWarning: Field name “schema” in “WorkflowsBlocksSchemaDescription” shadows an attribute in parent “BaseModel”
[01/06/25 16:37:35] ERROR Execution of step $steps.model encountered error. core.py:136
Traceback (most recent call last):
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/workflows
/execution_engine/v1/executor/core.py”, line 124, in safe_execute_step
run_step(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/workflows
/execution_engine/v1/executor/core.py”, line 151, in run_step
return run_simd_step(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/workflows
/execution_engine/v1/executor/core.py”, line 175, in run_simd_step
return run_simd_step_in_batch_mode(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/workflows
/execution_engine/v1/executor/core.py”, line 215, in run_simd_step_in_batch_mode
outputs = step_instance.run(**step_input.parameters)
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/workflows
/core_steps/models/roboflow/object_detection/v1.py”, line 184, in run
return self.run_locally(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/workflows
/core_steps/models/roboflow/object_detection/v1.py”, line 242, in run_locally
self._model_manager.add_model(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/managers/
decorators/fixed_size_cache.py”, line 61, in add_model
raise error
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/managers/
decorators/fixed_size_cache.py”, line 55, in add_model
return super().add_model(model_id, api_key, model_id_alias=model_id_alias)
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/managers/
decorators/base.py”, line 62, in add_model
self.model_manager.add_model(model_id, api_key, model_id_alias=model_id_alias)
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/managers/
base.py”, line 61, in add_model
model = self.model_registry.get_model(resolved_identifier, api_key)(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/registrie
s/roboflow.py”, line 65, in get_model
model_type = get_model_type(model_id, api_key)
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/core/registrie
s/roboflow.py”, line 125, in get_model_type
raise ModelArtefactError(“Error loading model artifacts from Roboflow API.”)
inference.core.exceptions.ModelArtefactError: Error loading model artifacts from Roboflow API.
ERROR Encountered inference error: Error during execution of step: $steps.model. Details: Error loading inference_pipeline.py:902
model artifacts from Roboflow API.
Traceback (most recent call last):
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/executor/core.py”, line 124, in safe_execute_step
run_step(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/executor/core.py”, line 151, in run_step
return run_simd_step(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/executor/core.py”, line 175, in run_simd_step
return run_simd_step_in_batch_mode(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/executor/core.py”, line 215, in run_simd_step_in_batch_mode
outputs = step_instance.run(**step_input.parameters)
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/core_steps/models/roboflow/object_detection/v1.py”, line 184, in run
return self.run_locally(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/core_steps/models/roboflow/object_detection/v1.py”, line 242, in run_locally
self._model_manager.add_model(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/managers/decorators/fixed_size_cache.py”, line 61, in add_model
raise error
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/managers/decorators/fixed_size_cache.py”, line 55, in add_model
return super().add_model(model_id, api_key, model_id_alias=model_id_alias)
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/managers/decorators/base.py”, line 62, in add_model
self.model_manager.add_model(model_id, api_key, model_id_alias=model_id_alias)
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/managers/base.py”, line 61, in add_model
model = self.model_registry.get_model(resolved_identifier, api_key)(
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/registries/roboflow.py”, line 65, in get_model
model_type = get_model_type(model_id, api_key)
File
“/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/registries/roboflow.py”, line 125, in get_model_type
raise ModelArtefactError(“Error loading model artifacts from Roboflow API.”)
inference.core.exceptions.ModelArtefactError: Error loading model artifacts from Roboflow API.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/interfaces/stream/inference_pipeline.py", line 874, in _execute_inference
predictions = self._on_video_frame(video_frames)
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/interfaces/stream/model_handlers/workflows.py", line 54, in run_workflow
return execution_engine.run(
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/core.py", line 70, in run
return self._engine.run(
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/core.py", line 91, in run
result = run_workflow(
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
usage_tracking/collector.py", line 661, in sync_wrapper
return func(*args, **kwargs)
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/profiling/core.py", line 264, in wrapper
return func(*args, **kwargs)
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/executor/core.py", line 60, in run_workflow
execute_steps(
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/profiling/core.py", line 264, in wrapper
return func(*args, **kwargs)
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/executor/core.py", line 104, in execute_steps
_ = run_steps_in_parallel(steps=steps_functions, max_workers=max_concurrent_steps)
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/executor/utils.py", line 12, in run_steps_in_parallel
return list(executor.map(_run, steps))
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/concurrent/futures/_base
.py", line 609, in result_iterator
yield fs.pop().result()
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/concurrent/futures/_base
.py", line 446, in result
return self.__get_result()
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/concurrent/futures/_base
.py", line 391, in __get_result
raise self._exception
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/concurrent/futures/threa
d.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/executor/utils.py", line 16, in _run
return fun()
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/profiling/core.py", line 264, in wrapper
return func(*args, **kwargs)
File
"/opt/homebrew/Caskroom/miniforge/base/envs/new_chilli_env/lib/python3.9/site-packages/inference/
core/workflows/execution_engine/v1/executor/core.py", line 137, in safe_execute_step
raise StepExecutionError(
inference.core.workflows.errors.StepExecutionError: Error during execution of step: $steps.model.
Details: Error loading model artifacts from Roboflow API.