I have trained a model using Roboflow work space. The model works fine with web cam web interface.
When I try running the inference on OAK-D-Lite from below code. I can see the stream but no predictions found. I would appreciate any inputs regarding this.
from roboflowoak import RoboflowOak
import cv2
import time
import numpy as np
if name == ‘main’:
# instantiating an object (rf) with the RoboflowOak module
rf = RoboflowOak(model=“airport-checked-bags”, confidence=0.05, overlap=0.5,
version=“1”, api_key=“gO1Aqw06dd77Uq46Jzre”, rgb=True,
depth=True, device=None, blocking=True)
# Running our model and displaying the video output with detections
while True:
t0 = time.time()
# The rf.detect() function runs the model inference
result, frame, raw_frame, depth = rf.detect()
predictions = result[“predictions”]
#{
# predictions:
# [ {
# x: (middle),
# y:(middle),
# width:
# height:
# depth: ###->
# confidence:
# class:
# mask: {
# ]
#} #frame - frame after preprocs, with predictions #raw_frame - original frame from your OAK #depth - depth map for raw_frame, center-rectified to the center camera
# timing: for benchmarking purposes
t = time.time()-t0
print("INFERENCE TIME IN MS ", 1/t)
print("PREDICTIONS ", [p.json() for p in predictions])
# setting parameters for depth calculation
max_depth = np.amax(depth)
cv2.imshow("depth", depth/max_depth)
# displaying the video feed as successive frames
cv2.imshow("frame", frame)
# how to close the OAK inference window / stop inference: CTRL+q or CTRL+c
if cv2.waitKey(1) == ord('q'):
break
Sorry to hear you’re having issues. I’ve filed a bug report with the team and hopefully, it’ll be fixed soon. In the meantime, you could consider some alternative deployment options.
@sandeep406: We noticed you posted your private API key in your post. We’ve revoked the use of that key. You can generate a new one in your workspace settings.
Your API key can be used to run inference, upload images, get info, and almost anything regarding your account and should never be posted publicly. We don’t want your accounts getting accessed by unauthorized people, so please be careful in the future!
Hi @leo
Thank you for the update, but it still failed this time, with a different feedback:
Traceback (most recent call last):
File "roboflow_deployment.py", line 25, in <module>
rf = RoboflowOak(model="dirt-overflowing", confidence=0.05, overlap=0.5,
File "/Users/cloudscapespare/anaconda3/envs/csl-load-count-ml/lib/python3.8/site-packages/roboflowoak/__init__.py", line 59, in __init__
self.cache_path = self.find_weights()
File "/Users/cloudscapespare/anaconda3/envs/csl-load-count-ml/lib/python3.8/site-packages/roboflowoak/__init__.py", line 135, in find_weights
return download_blob(
File "/Users/cloudscapespare/anaconda3/envs/csl-load-count-ml/lib/python3.8/site-packages/roboflowoak/api.py", line 25, in download_blob
raise Exception(str(api_data.json()))
Exception: {'error': {'message': 'This model endpoint is over your the device limit of your workspace.', 'type': 'QuotaException', 'hint': 'If have reached this in error, please let us know.'}}
I tried both using a OAK-D Lite and a OAK-D S2, not sure if other users have had the same problem. Any thoughts please?