hailo-ai / hailo-rpi5-examples

MIT License
300 stars 43 forks source link

[Example Request] perform action when detect object #7

Open fbeels opened 3 months ago

fbeels commented 3 months ago

I saw that you have an example showing object detection,but it's not clear to a machine learning/computer vision newbie like me how to perform an action when a specified object is detected. For example: when a humming bird is detected at a feeder take a photo every X seconds, or when a fedex truck is detected send an email/text. Sorry if this is really simple for you computer vision experts,but I think it would help alot of people that learn by example. Thanks

jiversen commented 3 months ago

Hi,

Suggest you check out the example code in detection.py, starting at line 62 to see how the example does it...you can see it iterates through all the detections and even shows how to do something if it finds a specific object ("person"). So you could start by adding a new if statement like

if label == "hummingbird":
    #do something with the camera, e.g. save the current image from the camera...set up a process to grab images every X seconds, etc

I'm new to ML, too, but we're just talking about basic programming and research. The docs on this repo (and the code examples) show that it is using the popular YOLO model, and there is plentiful information available online.

I don't know if the model has a specific category for Fedex truck--you'll have to experiment on that. A lot of people have! For example, the first search result is https://towardsdatascience.com/building-a-real-time-fedex-ups-usps-detection-system-with-yolo-1cc72382088a ! It looks like destinguishing FedEx fro UPS may need some additional training, but thinking simple I would think using the provided model and detecting a "truck," which I assume is a YOLO category, and emailing a snapshot of the image to yourself would be a simple and fine way to start, unless you have a lot of non-delivery trucks in your neighborhood.

Have fun.