Hi all,
I’ve trained an object detection model for measuring if the dirt is overflowing or not in a truck’s bucket at a construction site. However, it shows empty predictions all the time when running this model on my oak-d s2/oak-d lite device. I double-checked many times, packages are all installed, but still not sure what’s going on.
This is me code block, which is just like how it recommends to do:
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="dirt-overflowing", confidence=0.05, overlap=0.5,
version="2", api_key="*******", rgb=True,
depth=False, 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
Not sure if it is caused by a simple factor, or I encounter some critical technical problem as I am just a newbie about this. Appreciate it if you could have any ideas
Many thanks,
Austin