Machine Learning in Beekeeping

SofTeco team wants to share some insights in the field of machine learning. The area of our study is pretty much specific – beekeeping.

Conditions

There is a weekly procedure for a beekeeper to inspect bee families in their hives. This procedure is done in the following way: a beekeeper opens the hive, takes out the frames (with honeycombs and bees) and does the inspection of each frame. There are about 10 to 20 frames in each hive and each frame hosts around 1000-2000 bees.

A beekeeper has to be capable to make note of a large amount of information in a short period of time; in particular, the following:

– number of bees in the hive,

– queen bee’s health state and life level,

– presence of immature bees (brood) in the hive.

Requirements

We decided to create a simple and light-weight mobile application (available only for Android now). The mobile app’s main goal is to help beekeepers with hive inspection. 

Machine Learning

We used a “hundred bucks” action camera that records video with the following parameters: resolution: 1280х720, 240 frames per second.

We used different hives and different light conditions to record various video fragments. Then, all video fragments were cut in a thousand of images. We took only best quality images to work with. Our team also paid serious attention to images’ sharpness. We used LabelImg (https://github.com/tzutalin/labelImg) for cropping the “bees areas” on each image as the XML annotations. The images and XML annotations were converted to the Tensorflow compatible format – “tfrecord” being the “source of knowledge”.

Result

As the result, we get a model that could detect the number of bees on the frame. This number could help a beekeeper to have the precise parameters to evaluate the size of the bee colony.

All that we described above is just the first step in the creation of a multi-functional mobile application for beekeeping.