Custom Services
The example employs DepthAI to construct a pipeline that performs YOLOv6-Nano object detection, generates custom image annotations with bounding boxes and static text labels, and streams 640x480 NV12 camera frames along with detection and annotation data over a remote connection for visualization.Setup
This example requires the DepthAI v3 API, see installation instructions.Pipeline
Source code
Python
C++
Python
PythonGitHub
1#!/usr/bin/env python3
2import depthai as dai
3import signal
4import sys
5import time
6
7isRunning = True
8def stop():
9 global isRunning
10 isRunning = False
11
12def signal_handler(sig, frame):
13 print('You pressed Ctrl+C!')
14 stop()
15 sys.exit(0)
16
17signal.signal(signal.SIGINT, signal_handler)
18
19remoteConnection = dai.RemoteConnection()
20
21def testService(input):
22 print("Test service called with input:", input)
23 return {"result": "testService result"}
24
25remoteConnection.registerService("myService", testService)
26while isRunning:
27 time.sleep(1)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.