Hi, I'm trying to load my custom computer vision TensorFlow model on OAK-D lite. However, I keep encountering the error "Communication exception - possible device error/misconfiguration. Original message 'Couldn't read data from stream: 'preview' (X LINK ERROR)'. I have already tried changing the USB cable from 2.0 to 3.1, but the error persists. Can you help me troubleshoot this issue?
`with depthai.Device(pipeline) as device:
pose_nn_output = None
prediction_nn_output = None
preview = device.getOutputQueue("preview", 1, True)
nn_output = device.getOutputQueue("nn", 1, True)
while True:
in_preview = preview.get() # <-- This generates that error[URL=https://i.imgur.com/cKSw7Pv.png][IMG]https://i.imgur.com/cKSw7Pvh.png[/IMG][/URL]
in_nn = nn_output.get()
if pose_nn_output is None:
pose_nn_output = device.getOutputQueue(pose_output_name, 1, False)
pose_nn_output_tmp = pose_nn_output.tryGet()
if pose_nn_output_tmp is not None:
pose_nn_output = pose_nn_output_tmp
if prediction_nn_output is None:
prediction_nn_output = device.getOutputQueue(prediction_output_name, 1, False)
prediction_nn_output_tmp = prediction_nn_output.tryGet()
if prediction_nn_output_tmp is not None:
prediction_nn_output = prediction_nn_output_tmp
poses = None
if pose_nn_output is not None:
poses = np.array(pose_nn_output.getFirstLayerFp16())
predictions = None
if prediction_nn_output is not None:
predictions = np.array(prediction_nn_output.getFirstLayerFp16())
if poses is not None:
for pose in poses:
if pose[-1] >= pose_threshold:
x, y, w, h = int(pose[1]), int(pose[2]), int(pose[3]), int(pose[4])
cv2.rectangle(in_preview.getCvFrame(), (x, y), (x + w, y + h), (0, 255, 0), 2)
if predictions is not None:
max_index = np.argmax(predictions)
if predictions[max_index] >= prediction_threshold:
cv2.putText(in_preview.getCvFrame(), labels[max_index], (20, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)
cv2.imshow("preview", in_preview.getCvFrame())
if cv2.waitKey(1) == ord('q'):
break
cv2.destroyAllWindows()
`