Hello everyone, I’m trying to run SC‑Depth v3 using DeGirum PySDK via the tutorial thread here (linked above), but I’m running into persistent errors and cannot get depth values out.
My Depth.py file:
import os, sys
sys.path.insert(0, "/home/pi/hailo_model_zoo")
os.environ["PYTHONPATH"] = "/home/pi/hailo_model_zoo:" + os.environ.get("PYTHONPATH", "")
import degirum as dg
import cv2
import numpy as np
from picamera2 import Picamera2
# 1. Load your SC-Depth V3 model
model = dg.load_model(
model_name='scdepthv3',
inference_host_address='@local',
zoo_url='/home/pi/my_hailo_zoo'
)
# 2. Initialize the AI camera
picam2 = Picamera2()
cfg = picam2.create_preview_configuration(main={"size": (384, 384), "format": "RGB888"})
picam2.configure(cfg)
picam2.start()
print("Starting depth inference. Press 'q' or 'x' to exit.")
while True:
frame = picam2.capture_array() # RGB image
# 1. Resize to (width=320, height=256)
resized = cv2.resize(frame, (320, 256), interpolation=cv2.INTER_LINEAR)
# Manually apply TensorFlow-like preprocessing:
img = resized.astype(np.uint8)
# e.g. resize with OpenCV or PIL and multiply by 255 as needed
result = model(img)
# 4. Get normalized depth overlay
overlay = result.image_overlay # already visualized by your postprocessor
# 5. Resize for display (optional)
display = cv2.resize(overlay, (640, 480))
# 6. Show result
cv2.imshow("SC-Depth V3 output", display)
if cv2.waitKey(1) & 0xFF in (ord('q'), ord('x')):
break
# Cleanup
cv2.destroyAllWindows()
picam2.stop()
My current JSON configuration:
{
"ConfigVersion": 10,
"DEVICE": [
{
"DeviceType": "HAILO8",
"RuntimeAgent": "HAILORT",
"SupportedDeviceTypes": "HAILORT/HAILO8"
}
],
"PRE_PROCESS": [
{
"InputType": "Tensor",
"InputN": 1,
"InputH": 256,
"InputW": 320,
"InputC": 3,
"InputRawDataType": "DG_UINT8"
}
],
"MODEL_PARAMETERS": [
{ "ModelPath": "scdepthv3.hef" }
],
"POST_PROCESS": [
{
"OutputPostprocessType": "None",
"PythonFile": "depth_estimation_postprocessing.py",
"MetaArch": "scdepthv3"
}
]
}
Post-processor used
I’ve referenced and copied this post‑processing code from the official Hailo Model Zoo GitHub:
sample snippet from depth_estimation_postprocessing.py
Errors I encounter
- Many of the errors previously shared include:
AttributeError: module 'depth_estimation_postprocessing' has no attribute 'PostProcessor'- Other runtime exceptions in Python worker threads
My goals
- Successfully infer using SC‑Depth v3 on Hailo‑8 with DeGirum PySDK on Raspberry Pi.
- Retrieve numeric per-pixel depth values (not just overlays), especially at the center or arbitrary pixel coordinates.
Questions
- Did I set
"OutputPostprocessType": "Python"and"MetaArch": "scdepthv3"correctly? - Do I need to register or implement a custom
PostProcessorclass instead of a standalone function? - Should I instead set
"OutputPostprocessType": "None"and manually extract results usingmodel.predict()orpredict_batch()?
If anyone could share a minimal working JSON configuration or Python postprocessor that successfully returns depth map data (rather than raising module or attribute errors), I’d be very grateful.
Thanks in advance!