Counting Bees With A Raspberry Pi

Even if keeping bees sounds about as wise to you as keeping velociraptors (we all know how that movie went), we have to acknowledge that they are a worthwhile thing to have around. We don’t personally want them around us of course, but we respect those who are willing to keep a hive on their property for the good of the environment. But as it turns out, there are more challenges to keeping bees than not getting stung: you’ve got to keep track of the things too.

Keeping an accurate record of how many bees are coming and going, and when, is a rather tricky problem. Apparently bees don’t like electromagnetic fields, and will flee if they detect them. So putting electronic measuring devices inside of the hive can be an issue. [Mat Kelcey] decided to try counting his bees with computer vision, and so far the results are very promising.

After some training, a Raspberry Pi with a camera can count how many bees are in a given image to within a few percent of the actual number. Getting an accurate count of his bees allows [Mat] to generate fascinating visualizations about his hive’s activity and health. With real-world threats such as colony collapse disorder, this type of hard data can be crucial.

This is a perfect example of a hack which might not pertain to many of us as-is, but still contains a wealth of information which could be applicable to other projects. [Mat] goes into a fantastic amount of detail about the different approaches he tried, what worked, what didn’t, and where he goes from here. So far the only problem he’s having is with the Raspberry Pi: it’s only able to run at one frame per second due to the computational requirements of identifying the bees. But he’s got some ideas to improve the situation.

As it so happens, we’ve covered a few other methods of counting bees in the past, though this is the first one to be entirely vision based. Interestingly, this method is similar to the project to track squirrels in the garden. Albeit without the automatic gun turret part.

34 thoughts on “Counting Bees With A Raspberry Pi

  1. I read perhaps here about counting bees as they go in and out thru the bee hole in a rather serial mode that’s easy to sense and count. Not much more than a photo-interrupter. Bonus for detecting hornets and other invaders, zap.

    1. When I was in school (at the turn of the century) my instructor made an such a system for someone in another department who was training bees to find land mines. He used two receivers in each pathway to confirm passage and direction. I think there were enough counters for about a dozen bees to enter/exit per counter PCB.

    1. Varoa, move to younger bees to stay near the brood comb. By the time bees start flying nearer the end of their lives it is to late to have any effect on them.

      1. Yes, by the time those mofo’s get attached and the girls are foraging, it is way too late. Now, a tiny rover within the hive to seek them out before they get in the sealed brood cells, I’d go for that. Even to kill small hive beetles…. bastards….

      2. I think I would try enticing the young bees through a bottleneck with the smell of sugar syrup and then zapping the mites as they go through. Should be some interesting photography!

  2. “Apparently bees don’t like electromagnetic fields, and will flee if they detect them.”

    Not so much. There is a lot of verbiage (very few parts of it legitimate) about the deleterious effect of HF EMF on honeybees. Most of that is the usual repeatage and hysterics; RF fields don’t cause bees to run away or they’d be used to get rid of unwanted colonies. For example, this hive is in the base of an operating radio transmitter tower:

    http://4.bp.blogspot.com/-xC8o8fj0ews/UbTVqfLFTRI/AAAAAAAAAH4/hFhogrmxvm0/s1600/DSC_0926.JPG

    1. Oh man! and I was going to ask for more information about that. I was hoping an RF device might be possible that would keep the bees out of my daughter’s playhouse!

  3. Maybe there is a specific range of RF frequency or other variable that could influence the bees… Like microwaves that are blocked by “carbon units” like meat some foods, water etc…

  4. I’m not interested enough to read deep.. How does it keep track of a bee that flies in to a mound of other bees? If it doesn’t do this then how is this even remotely approximate?

  5. How is this going?
    Anyone interested in a version using video input to count, detect varoa and ID invaders using big data and neural nets. Intel’s AI Brain Stick makes it a lot easier… I have some of the skills necessary, but not all…..

    1. Hello Alan – yes I’m interested – I’m currently trying to train networks to detect wasps, just for practise. The network is partially working, but not drawing the bounding boxes properly yet. If you want to collaborate, I’m up for that! My project is aimed at the Asian Hornet, but could easier be modified for varroa etc :

      https://hackaday.io/project/161581-asian-hornet-sentry-gun

      …… Please pm me from the above page.

Leave a Reply to LilyCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.