Open stephanschulz opened 2 years ago
I don't have any POE device to test and I am realizing that my scripts don't work on POE devices without modification of the scripts. What error message do you get when doing
device_info = dai.DeviceInfo("10.100.0.21")
self.device = dai.Device(device_info)
? Can you try with an empty pipeline ?
device_info = dai.DeviceInfo("10.100.0.21")
self.device = dai.Device(dai.Pipeline(), device_info)
If you don't any get error with empty pipeline, can you in addition replace:
usb_speed = self.device.getUsbSpeed()
self.device.startPipeline(self.create_pipeline())
by:
self.device.startPipeline(self.create_pipeline(), device_info)
?
for reference here is my current project which runs fine on the OAK-D pro POE and sends out the landmark data over OSC.
https://github.com/stephanschulz/depthai_blazepose/tree/main/depthai_osc
adding
device_info = dai.DeviceInfo("10.100.0.21")
self.device = dai.Device(dai.Pipeline(), device_info)
produces this error
Traceback (most recent call last):
File "demo_osc.py", line 56, in <module>
tracker = BlazeposeDepthai(input_src=args.input,
File "/Users/stephanschulz/Documents/depthai-python-2/depthai_blazepose/depthai_osc/BlazeposeDepthaiEdge_osc.py", line 198, in __init__
self.device.startPipeline(self.create_pipeline())
RuntimeError: Pipeline is already running
adding:
# usb_speed = self.device.getUsbSpeed()
# self.device.startPipeline(self.create_pipeline())
# print(f"Pipeline started - USB speed: {str(usb_speed).split('.')[-1]}")
device_info = dai.DeviceInfo("10.100.0.21")
self.device.startPipeline(self.create_pipeline(), device_info)
causes this error message
stephanschulz@Komputer depthai_osc % python3.8 demo_osc.py -e -v --oscIP 10.100.0.101 --oscPort 12345
Pose detection blob file : /Users/stephanschulz/Documents/depthai-python-2/depthai_blazepose/depthai_osc/models/pose_detection_sh4.blob
Landmarks using blob file : /Users/stephanschulz/Documents/depthai-python-2/depthai_blazepose/depthai_osc/models/pose_landmark_full_sh4.blob
amount of getAllAvailableDevices 1
18443010C121C61200 XLinkDeviceState.X_LINK_BOOTLOADER
Internal camera FPS set to: 20
Internal camera image size: 800 x 450 - pad_h: 175
Creating pipeline...
setIrFloodLightBrightness None
setIrLaserDotProjectorBrightness None
Creating Color Camera...
Creating Pose Detection pre processing image manip...
Creating Pose Detection Neural Network...
Creating Pose Detection post processing Neural Network...
Creating Landmark pre processing image manip...
Creating DiveideBy255 Neural Network...
Creating Landmark Neural Network...
Pipeline created.
Traceback (most recent call last):
File "demo_osc.py", line 56, in <module>
tracker = BlazeposeDepthai(input_src=args.input,
File "/Users/stephanschulz/Documents/depthai-python-2/depthai_blazepose/depthai_osc/BlazeposeDepthaiEdge_osc.py", line 201, in __init__
self.device.startPipeline(self.create_pipeline(), device_info)
TypeError: startPipeline(): incompatible function arguments. The following argument types are supported:
1. (self: depthai.DeviceBase) -> None
2. (self: depthai.DeviceBase, arg0: depthai.Pipeline) -> bool
Invoked with: <depthai.Device object at 0x7ff98e80a130>, <depthai.Pipeline object at 0x7ff98d7d6970>, DeviceInfo(name=10.100.0.21, mxid=, X_LINK_ANY_STATE, X_LINK_ANY_PROTOCOL, X_LINK_ANY_PLATFORM, X_LINK_SUCCESS)
What error message do you get when doing
device_info = dai.DeviceInfo("10.100.0.21")
self.device = dai.Device(device_info)
?
stephanschulz@Komputer depthai_osc % python3.8 demo_osc.py -e -v --oscIP 10.100.0.101 --oscPort 12345
Pose detection blob file : /Users/stephanschulz/Documents/depthai-python-2/depthai_blazepose/depthai_osc/models/pose_detection_sh4.blob
Landmarks using blob file : /Users/stephanschulz/Documents/depthai-python-2/depthai_blazepose/depthai_osc/models/pose_landmark_full_sh4.blob
amount of getAllAvailableDevices 1
18443010C121C61200 XLinkDeviceState.X_LINK_BOOTLOADER
Traceback (most recent call last):
File "demo_osc.py", line 56, in <module>
tracker = BlazeposeDepthai(input_src=args.input,
File "/Users/stephanschulz/Documents/depthai-python-2/depthai_blazepose/depthai_osc/BlazeposeDepthaiEdge_osc.py", line 115, in __init__
self.device = dai.Device(device_info)
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
1. depthai.Device(pipeline: depthai.Pipeline)
2. depthai.Device(pipeline: depthai.Pipeline, usb2Mode: bool)
3. depthai.Device(pipeline: depthai.Pipeline, maxUsbSpeed: depthai.UsbSpeed)
4. depthai.Device(pipeline: depthai.Pipeline, pathToCmd: Path)
5. depthai.Device(pipeline: depthai.Pipeline, devInfo: depthai.DeviceInfo, usb2Mode: bool = False)
6. depthai.Device(pipeline: depthai.Pipeline, deviceInfo: depthai.DeviceInfo, maxUsbSpeed: depthai.UsbSpeed)
7. depthai.Device(pipeline: depthai.Pipeline, devInfo: depthai.DeviceInfo, pathToCmd: Path)
8. depthai.Device(version: depthai.OpenVINO.Version = <Version.???: 6>)
9. depthai.Device(version: depthai.OpenVINO.Version, usb2Mode: bool = False)
10. depthai.Device(version: depthai.OpenVINO.Version, maxUsbSpeed: depthai.UsbSpeed)
11. depthai.Device(version: depthai.OpenVINO.Version, pathToCmd: Path)
12. depthai.Device(version: depthai.OpenVINO.Version, deviceInfo: depthai.DeviceInfo, usb2Mode: bool = False)
13. depthai.Device(version: depthai.OpenVINO.Version, deviceInfo: depthai.DeviceInfo, maxUsbSpeed: depthai.UsbSpeed)
14. depthai.Device(version: depthai.OpenVINO.Version, deviceDesc: depthai.DeviceInfo, pathToCmd: Path)
15. depthai.Device(config: depthai.Device.Config)
16. depthai.Device(config: depthai.Device.Config, deviceInfo: depthai.DeviceInfo)
Invoked with: DeviceInfo(name=10.100.0.21, mxid=, X_LINK_ANY_STATE, X_LINK_ANY_PROTOCOL, X_LINK_ANY_PLATFORM, X_LINK_SUCCESS)
here in this test branch i try to first create a pipleline then start the device with the device_info https://github.com/stephanschulz/depthai_blazepose/blob/test_pipeline/depthai_osc/BlazeposeDepthaiEdge_osc.py#L109
self.pipeline = dai.Pipeline()
device_info = dai.DeviceInfo("10.100.0.21")
self.device = dai.Device(self.pipeline, device_info)
I had to modify the create_pipeline function to not 'create pipeline' but rather set related values. But now i get this error: RuntimeError: Queue for stream name 'cam_out' doesn't exist
Connected cameras: [<CameraBoardSocket.RGB: 0>, <CameraBoardSocket.LEFT: 1>, <CameraBoardSocket.RIGHT: 2>]
Traceback (most recent call last):
File "demo_osc.py", line 56, in <module>
tracker = BlazeposeDepthai(input_src=args.input,
File "/Users/stephanschulz/Documents/depthai-python-2/depthai_blazepose/depthai_osc/BlazeposeDepthaiEdge_osc.py", line 220, in __init__
self.q_video = self.device.getOutputQueue(name="cam_out", maxSize=1, blocking=False)
RuntimeError: Queue for stream name 'cam_out' doesn't exist
Probably 'cam_out' is not seen because it was added too late?
Actually, in my code, I separated the https://github.com/geaxgx/depthai_blazepose/blob/a3ce15a25c82f4663e4d263c99d7f83ece59ab64/BlazeposeDepthaiEdge.py#L104 from the: https://github.com/geaxgx/depthai_blazepose/blob/a3ce15a25c82f4663e4d263c99d7f83ece59ab64/BlazeposeDepthaiEdge.py#L180 because between the 2 lines, I wanted to check if I the device of the user had 2 mono cameras in case he used the '-xyz' argument. it is a bit superfluous test (you can do without it). So I propose in your case to regroup the 2 commands and remove the test. In practice:
self.xyz = True
device_info = dai.DeviceInfo("10.100.0.21")
self.device = dai.Device(self.create_pipeline(), device_info)
Thank you very much.
In addition i also had to comment out these lines inside def create_pipeline(self):
because they references self.device
which at this point does not exists.
calib_data = self.device.readCalibration()
https://gist.github.com/stephanschulz/81d95799ac90484c055136dd70cd55d8#file-blazeposedepthaiedge-py-L240
Since these lines are needed for lens calibration i wonder if they should be added somewhere else ? After that all this the device_info thing works :)
The reason of these lines is that when you want to use aligned color and depth frames, you should keep the focus constant (autofocus disabled) and more precisely set the focus value to the same value used during the camera calibration. This value is stored in eeprom with other calibration data. This value does not change, let's say it is 130. In your case, you can hardcode the value and just keep the line:
cam.initialControl.setManualFocus(130)
I know this might be a question for the depthai github account but their examples do not seem to use your code structure.
I have multiple OAK-D pros connected to the same network, each with their own fixed IP address. I am hoping to define in the code which device to connect to.
But doing this does not work:
https://github.com/geaxgx/depthai_blazepose/blob/main/BlazeposeDepthaiEdge.py#L104
But in their example they are using a structure that does not seem to match the way you write your code: