Hi @ody777, welcome to the world of edge AI! We’re glad to hear you’re finding our tools are easy to work with.
To thoroughly help you, could you please share the code you used with DeGirum PySDK? That will help us pinpoint what the issue is.
In the meantime, here are some quick tips:
1. Control Image Resolution and Quality
In DeGirum PySDK, the quality of the input video frame depends primarily on how the video frames are captured or preprocessed. If you’re using OpenCV or PiCamera2 to read frames, you can increase the resolution by setting it explicitly:
Example for OpenCV:
stream = cv2.VideoCapture(0)
stream.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
stream.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
You can also perform transformations (e.g., resize, rotate) using a custom frame generator before passing frames to predict_batch
:
def high_res_frame_generator(video_source):
stream = cv2.VideoCapture(video_source)
stream.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
stream.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
while True:
ret, frame = stream.read()
if not ret:
break
yield frame
stream.release()
Pass this to:
for result in model.predict_batch(high_res_frame_generator(0)):
cv2.imshow("Overlay", result.image_overlay)
2. Enhance Overlay Appearance
You can improve the visual appearance of the overlay using model options:
model = dg.load_model(
model_name="your_model",
inference_host_address="@local",
zoo_url="degirum/hailo",
device_type="HAILORT/HAILO8L",
overlay_show_labels=True,
overlay_show_probabilities=True,
overlay_font_scale=1.5,
overlay_line_width=3,
overlay_color=[(0, 255, 0)],
overlay_alpha=1.0
)
3. Increase FPS
To maximize FPS:
- Use
predict_batch()
to process frames as a stream, reducing latency.
- Minimize display or post-processing overhead in your Python code.
- Benchmark raw device speed using
hailortcli
(raw FPS) and pysdkProfile.py
(actual app FPS).
- Ensure the input source (e.g., webcam or RTSP) can actually deliver high FPS—camera limitations often cap effective throughput.