I’ve been trying to do costum image recognition for a long time but always hit’s some weird dead ends. For the last week I’ve tried to train and use my own Yolov8 model through roboflow and the creation of the model and using the model online in the browser works great! However when trying to use it on my Raspberry pi (offline in the end) I get a lot of trouble. I followed the guide: Roboflow - blog and first got the inference server working (I can see it start and also run when using the following code:
from roboflow import Roboflow
rf = Roboflow(api_key=“My_private_API_KEY”)
project = rf.workspace().project(“t_intersection-z2eih”)
model = project.version(1, local=“http://localhost:9001/”).model
prediction = model.predict(“image.jpg”, confidence=40, overlap=30)
print(prediction.json())
but I get the output:
loading roboflow workspace…
loading roboflow project…
and then this error att line 7:
host, port = _HOST_PORT_RE.match(host_port).groups() # type: ignore[union-attr]
AttributeError: ‘NoneType’ object has no attribute ‘groups’
This error occurs when I use roboflow 1.1.44, if I instead try roboflow 0.2.23 or really any lower model than 1.1.44 I get this error instead:
Traceback (most recent call last):
File “/home/malte/readImage.py”, line 7, in
prediction = model.predict(“T_intersection-1/test/images/pic1.jpg”, confidence=40, overlap=30)
File “/home/malte/imgRec/lib/python3.11/site-packages/roboflow/models/object_detection.py”, line 189, in predict
return PredictionGroup.create_prediction_group(
File “/home/malte/imgRec/lib/python3.11/site-packages/roboflow/util/prediction.py”, line 490, in create_prediction_group
for prediction in json_response[“predictions”]:
KeyError: ‘predictions’
and if I go into the prediction.py file and tell it to print(json_response) I get this printed:
{Error’: “This execution contains the node ‘StatefulPartitionedCall/assert_equal_1/Assert/AssertGuard/branch_executed/_139’, which has the dynamic op ‘Merge’. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [Identity]”}
Later I tried someone else’s model that was a Roboflow 2.0 model and it worked flawlessly with roboflow 1.1.44 however roboflow 3.0 models don’t work. Do you guys have any idea what might be the cause? Thanks a ton in advance!!!