Best ML Model for Real-Time Egg Counting on Raspberry Pi

hello everyone! I’m working on a real-time egg-counting project using a Raspberry Pi and computer vision. Originally, I thought I could use OpenCV with contour detection for a quick, lightweight solution. The plan was to convert images to grayscale, reduce noise with blurring, and use edge detection to find contours representing eggs. But as I tested it, contour detection turned out to have several big limitations that made it unreliable for this project. One of the main issues was "lighting sensitivity" even small changes in light, shadows, or reflections would throw off the detection completely, often causing the egg count to vary wildly. Another major problem was "overlapping eggs"—if eggs were close together, contour detection often couldn’t separate them and would count multiple eggs as one. Lastly, "background interference" was a big challenge. The algorithm would sometimes pick up background textures or objects as “eggs,” adding false positives to the count. Because of these issues, I decided to switch to training a model , which should handle these challenges better. Which specific ML model would you recommend for detecting and counting in real-time on a Raspberry Pi? I need something that can handle varying lighting conditions and overlapping objects while still being lightweight enough to run smoothly on the Pi.
27 Replies
techielew
techielew4d ago
Which Pi?
ZacckOsiemo
ZacckOsiemo4d ago
Can I ask, how does training a custom model fix this issues you found?
wafa_ath
wafa_ath4d ago
Raspberry pi 3
wafa_ath
wafa_ath4d ago
Because it can actually learn from examples rather than r fixed rules like contour detection does. training a model with lots of different images of eggs, it starts to recognize them in all sorts of conditions , different lighting, overlapping positions, and even with tricky backgrounds. . The model picks up on subtle patterns and features that make an egg an egg, and that why it may be a better solution for my project because it Real time detection
techielew
techielew4d ago
Why did you choose a Pi 3?
wafa_ath
wafa_ath4d ago
Am doing a real time recognition and counting, it have a good processing power to handle computer vision task in real time
techielew
techielew4d ago
Raspberry Pi
Buy a Raspberry Pi AI Kit – Raspberry Pi
A kit containing a Hailo AI module pre-installed on the M.2 HAT+
ZacckOsiemo
ZacckOsiemo4d ago
yeah I would focus on this first, why don't you work on training a couple of models then we can observe from that?
wafa_ath
wafa_ath4d ago
Yeah,i was thinking about using Yolov5 for the training first, i will try it and share the results
wafa_ath
wafa_ath4d ago
Can i ask , is it worth to invest in the AI kit since i have Pi 3 already.
techielew
techielew4d ago
Are you doing this for fun? For research? Trying to commercialize? What’s your end goal?
wafa_ath
wafa_ath4d ago
No, hoping i can sell it to a production company
melta101
melta1014d ago
I personally find a lot of companies in denial to associate with rpi at an industrial level. Had one client cancel the agreement as i showed the demo in a rpi
wafa_ath
wafa_ath4d ago
What do you suggest i work with !
techielew
techielew4d ago
Was waiting to see what you said @melta101 but was going to ask @wafa_ath if the hope was to migrate to a pi compute module at some point or something else?
techielew
techielew4d ago
Guessing he will say beagle-ai…
melta101
melta1014d ago
Have you discussed this with the company?
melta101
melta1014d ago
what are the expecttions or so?
melta101
melta1014d ago
was going to suggest coral TPU
techielew
techielew4d ago
Have you worked with the Y-AI yet?
melta101
melta1014d ago
no but actually I have used it for classification based problem statement and it had a good support for a lot of things
melta101
melta1014d ago
not yet I was planning to get one in a few month I need to a few others devices to test drivers for K3 series
melta101
melta1014d ago
@wafa_ath i had access to a laptop with a free mini PCle port
melta101
melta1014d ago
Coral
Mini PCIe Accelerator | Coral
Integrate the Edge TPU into legacy and new systems using a Mini PCIe interface.
melta101
melta1014d ago
but in all honestly, I would suggest to have a talk with the company and understand what is more important for them. Some company just wants it to work(like my current company)
melta101
melta1014d ago
No need to waste unnecessary money if the result is the same
wafa_ath
wafa_ath4d ago
Not yet I want to build a working prototype first so I can show it around to companies and let them see it in action.
Want results from more Discord servers?
Add your server