1

I need some help for a project I'm doing. My project is to have my raspberry pi camera detect objects using Ultralytics Yolov8 for instance segmentation. I'm using Thonny for the python code and everything works very well. My python code looks like this:

from ultralytics import YOLO
model=YOLO('best.pt')
model.predict(source=0,show=True)

My camera can successfully detect objects on a live camera. I can see frames are getting printed on the bottom of the code saying 0: 480x640 1 Bottle, 2330.8ms

My question is how can I take the data meaning (0: 480x640 1 Bottle, 2330.8ms) and apply it to send an output signal from my raspberry pi.

Another question would be, where is (0: 480x640 1 Bottle, 2330.8ms) coming from? I don't think it's data coming from a folder I have.

I need the information on each frame to send signals but I don't know where to look. If you know anything or know someone that can help me please let me know. Also, if you have any questions for me please let me know too. Thank you so much!

2
  • this is a question and answer site ... write a clear question and someone will try to answer it ... requests like If you know anything or know someone that can help me please let me know. belong at a chat forum, not at this site
    – jsotola
    Mar 2, 2023 at 5:40
  • Abandoned post by Unregistered user.
    – Milliways
    May 5, 2023 at 1:13

1 Answer 1

0

Check out https://docs.ultralytics.com/reference/engine/results/#ultralytics.engine.results.Results. Something like

print(results[0].boxes.cls)

will print out a tensor of detected classes.

1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Milliways
    Dec 3, 2023 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.