Content uploaded by Julian Szymanski
Author content
All content in this area was uploaded by Julian Szymanski on May 09, 2018
Content may be subject to copyright.
Detection of the Bee Queen Presence
using Sound Analysis
Tymoteusz Cejrowski1, Julian Szymański1, Higinio Mora2, David Gil2
1Gdańsk University of Technology, Faculty of Electronics,
Telecommunications and Informatics, Poland,
2Department of Computer Science Technology and Computation,
University of Alicante, Spain
tymoteusz.cejrowski@gmail.com, julian.szymanski@eti.pg.gda.pl,
hmora@ua.es, david.gil@ua.es
Abstract. This work describes the system and methods of data analy-
sis we use for beehive monitoring. We present overview of the hardware
infrastructures used in hive monitoring systems and we describe algo-
rithms used for analysis of this kind of data. Based on acquisited signals
we construct the application that is capable to detect an absence of honey
bee queen. We describe our method of signal analysis and present results
that allow us to drown conclusions on honey bee behaviour.
Keywords: Honey Bees ·Hive monitoring ·Signal analysis
1 Introduction
Honeybee (Apis mellifera) is probably one of the most important insects in the
agriculture. This extremely valuable insects are treated as the key factor in
plants pollination [1, 2]. It is crucial that the number of bees increases. Their
work is considered as the guiding light for the hard-workers and is appreciated
for ages. People and especially beekeepers should provide special care for this
insects. Unfortunately today’s beekeeping is facing many issues which cause the
number of insects to decrease [3]. Disease or uncontrolled swarming can be the
cause of bee distinction. Also insufficient care of the beekeeper is very often the
main factor of collapsing the whole bee’s families.
One of the important tasks for beekeeper is to check whether the queen bee is
healthy and capable to lay eggs. This is done by opening the hive and inspecting
the hive frames. If there is no eggs or larvae, the queen bee might be dead, ill or
just not present in the hive. In such situations life of the whole swarm could be in
danger and an immediate action is required. Whenever there is no reproduction
because of the death or disability of the queen bee there is also no more younger
bees that could replace the older ones [4]. Usually the bee worker lives only up
to 40 days and after that her work should be overtaken by another bee [5]. The
lack of healthy queen bee is extremely unfavorable and should be detected as
soon as it is possible. But on the other side, daily hive inspections and checking
whenever queen bee is present can be harmful for the whole bee family. Frequent
disturbances can be a stressful factor and introduce the anxiety to the swarm.
To avoid such situations it is necessary to use a non-invasive method that is able
to detect lack of the queen bee.
In this paper we present the remote, non-invasive system that monitors and
analyzes the honey bees behavior according to different conditions. For our study
we create the situation where the queen bee is not present inside the hive. We
monitor that situation with the set of the sensors and based on it we create the
classifier that indicates whether the bee family becomes aware of the missing
queen. The system presented in this paper can possibly detect different illnesses
of bee colony such as presence of Varroa Destructor or predict bee swarming but
that analysis is a plan for the future work.
2 Related works
In recent years the interest in bees and their habits is increasing rapidly. Such
situation cause growth the number of systems which are capable of collecting
data from the hives.
For example, the commercial Arnia3system is designed for collecting weight,
temperature and humidity measurements. The device is also equipped with mi-
crophone to obtain sound samples from inside the beehive. All data is transferred
remotely to the server and then presented to the user. There are many similar
projects with the same core objectives. For example, projects presented in [6] and
[7] differ only in the set of sensors. Some of them like the BuzzBox4additionally
provides open access to recorded data.
There are also number of scientific projects which are focused on detecting
particular situations inside the beehive. For example, problem of bee swarming
(when the insects leave the hive because of newborn queen) has been studied in
[8]. The proposed solution uses cyclic temperature measurements and pattern
recognition techniques which are based for a predictive algorithm. System is able
to detect the preswarming moment by evaluating the increase in temperature
inside the hive. Authors found five patterns that may occur during the year.
Anomalies, which are accompanied by elevated temperatures within the hive,
and hence the inability to classify data from a particular moment may be a sign
of the incoming swarming.
Ferrari’s work about the bee swarming prediction [9] describes wireless net-
work of sensors that collect sounds, temperature and humidity values from the
hive during the swarming periods. Based on empirical graphs observations some
patterns were specified and determined.
There are also some projects focused on bee’s diseases detection. Project
which was developed at Edith Cowan University in Australia [10] aims to com-
pletely eliminate external parasitic mite Varroa Destructor from the Australian
continent. Device collects sound samples and converts them to feature vector,
at the end the data is classified using SVM or LDA algorithms. Mite detection
3Arnia system: www.arnia.co.uk, access 10 Sep 2017
4BuzzBox: www.osbeehives.com, access 10 Sep 2017
such as Varroa Destructor can also be solved using image analysis processing. In
Larissa Chazette’s work [11] camera-equipped system has been developed which
recognizes Varroa Destructor infected bees by using Convolutional Neural Net-
works (CNN). In Schurischuster’s work [12] a Raspberry Pi 3 based device is
able to collects high resolution and well-exposed pictures of bees entering the
hive. The combination of [11] and [12] systems could lead to even better results.
3 System design
Our system is composed from three parts: server, client and embedded mod-
ule. The wireless network of embedded devices was made according to master-
slave architecture. The endpoints which are mounted directly inside the hive are
responsible for collecting measurements and passing them to accesspoint. The
accesspoint uploads raw data to the server where is processed.
Analysis of bees behavior can only be performed by usage of sensors that
provide case-essential data. Significant type of data can be specified basing on the
related work. Bees like most of the insects produce sound during the flight. The
bee worker emits sounds at 250 Hz on the air. But bees can be also considered
as one super-organism where their sounds accumulates to one, common buzz.
Seemingly irrelevant noise emanating from the center of the hive can be a source
of valuable information. For example, when bees are preparing for swarming,
they also change their extremely ordered behavior. Some of the insects start
becoming restless, bring excitement to the hive and finally change nature of the
common buzz. Without doubt sound is one of the most important factors in bee
analysis. In presented work, sound samples are collected by specially designed
microphone. The band-pass filters have been selected so that the microphone
will be sensitive for bee’s sounds (20 -2000 Hz).
Bees also need proper level of temperature and humidity inside the hive.
Without suitable conditions the colony can leave their current place of occupa-
tion [8]. Invalid humidity level is causing multiple bee diseases so it is also sig-
nificant value for monitoring. Temperature and humidity are the most sensitive
factors among the bees and these two values are monitored using an integrated
sensor HDC1008.
In our system the microphone, temperature and humidity sensors was in-
serted into a specially designed bee hive frame in order to not disturb the bees.
The designed frame is shown in the Fig 1. Single data set contains one second
sound sample and information about levels of temperature and humidity. Data
is acquired every 15 minutes and then uploaded to the server.
4 Data processing
In our approach we divide the data into two sets: one derived from normal
bees work and one from abnormal, where there is a lack of bee queen in the
hive. Thanks to that it is possible to extract the pattern, which will allow us
to differentiate particular behaviors. At the beginning of the analysis process
Fig. 1. Bee hive frame used in experiment.
the data is downloaded from server. This step must ensure data consistency
in which the sound, temperature and humidity values must be available at a
given moment. Then, the features are extracted from the available data and
classification potential is tested. At the end the model is worked out and final
classification is performed.
4.1 Feature extraction - Linear Predictive Coding (LPC)
The process of the data analysis start from the transformation of the input data
from the hive into a form that can be used as input for algorithms. Sound signal
should be compressed into the finite element vector of the size significantly less
than the original length of the sound sample vector. For this purpose Linear
Predictive Coding was used.
LPC is a method used in a speech audio compression. This method assumes
that signal is produced by a buzzer located at the end of the tube [13]. For the
correct sound characterization it is important to determine the output signal
parameters as the inverse of the impulse response of FIR filter that represents
the vocal tract. In order to facilitate the use, the input is the Dirac delta function.
Model can be represented as in (1)
H(z) = G
1−Pm
k=1 akz−k(1)
where Gis the gain, mlevel of the model and akrepresents searched char-
acteristic coefficients.
Using Z transform, and Levinson-Durbin algorithm a coefficient vector is
obtained [14]. It is assumed that 10-14 LPC coefficients describe well the signal
and further increasing this number results in an insignificant improvement in
signal approximation. In this work the given sound sample with a dimension of
3000 was characterized using LPC algorithm by vector of size N= 14. The final
data was extended by temperature and humidity values collected from the same
moment of time as the sound sample.
4.2 Classification potential - t-SNE
Having some set of a data it is crucial to determine if the classification and model
extraction is possible at all. This process is a supportive step and performed only
in the case of recognizing new features. Could be carried out by viewing the 2D
or 3D points which corresponds to input data. If there is possibility for data
separation it means that examined feature can be used in hive modeling. To get
2D points from multidimensional input vector it is necessary to use technique
for dimensionality reduction such as t-SNE.
Algorithm was introduced by Laurens van der Maaten in 2008 and is the
variation of previously existing algorithm called SNE developed by Geoffrey
Hinton and Sam Roweis in 2002. T-SNE converts multidimensional set of data
χ={x1, x2, ..., xn}to 2D or 3D vectors Υ={y1, y2, ..., yn}. The basis of this
algorithm is to compare the density distribution of multivariate variables with
the distribution of their projection on a two or three-dimensional plane [15].
The difference between these two distributions is calculated by Kullback–Leibler
divergence and minimized by gradient descent.
In our work the t-SNE algorithm was used to evaluate the potential of the
hive classification according to presence of the queen bee inside the hive. We
treat LPC coefficients vectors, extended with humidity and temperature values,
as the input for t-SNE algorithm. We perform dimension reduction on vectors
of size n= 16 to obtain 2D or 3D map of points that corresponds to state of the
colony at given moment. Then we can decide if future classification is reasonable.
It is desired to observe clusters of data representing samples taken during the
normal work and a separate set representing anomalies. If so, we can perform
the last step which was the classification according to previously chosen feature.
4.3 Learning - SVM
Information of the separation capacity is important for the next stage of the
mathematical bees modeling. Input data in the form of n-dimensional vector is
given as the input to the classifier. Presented system use SVM classifier developed
by Vapnik [16] in 1963 with the modification [17] from 1992 introduced by Boser,
Guyon and Vapnik himself.
The basic SVM classifier is capable of separating two sets that are linearly
separated so that the hyperplane spreading the training data maximizes the
value of the geometric margin. The output of SVM algorithm is the separating
hyperplane which form is presented in (2)
y(x) = wTx+b= 0 (2)
where w= [w1, w2, ..., wN]Tis the Ndimension weight vector and x=
[x1, x2, xN]Tis the input vector. As a matter of fact the input data rarely can
be linearly divided into two separate sets. Separation of the data that can not
be linearized is solved with the help of a so-called kernel trick [18]. It transforms
nonlinearly input data so that they are likely to be linearly separable.
In presented work non-linear, Gaussian-kernel, SVM classifier was used to
obtain a model of the hive in relation to the designated feature. We have used
SVM method on two data sources: previously described n= 16 dimensional
vectors and the output of t-SNE. Both approaches provide similar results. The
SVM output is the hyperplane dividing learning set into two separate clusters,
one indicating anomaly and second describing normal swarm behavior. Such
model can be later evaluated on testing data and relevant conclusions regard to
the behavior of bees can be learned.
5 Experimental results
Bee colony was monitored in the period from February 2017 to August 2017.
Unfortunately, the bees did not swarm in that time also they were not infected
by any of the diseases. To test our classification system, it was decided to force
a critical situation for the bees. Absence of a bee’s queen in the hive was chosen
and it was caused manually by a beekeeper. The aim of the experiment is to
develop a hive model in which will be possible to observe and specify the patterns
characteristic for bees living without the queen.
The experiment was carried out using embedded system described in Section
3. Bee hive frame was inserted into the hive as third frame from the entrance.
The mother exchange process together with periods of downloading of sound
data is presented in Fig 2.
Fig. 2. Queen exchange workflow.
In the first step, two data sets previously designated as "Before picking up
the queen" and "Without the queen" were used as input data. The audio samples
were compressed into a feature vector, which was the LPC coefficients. These
vectors were also extended with temperatures and humidity values. At the end
data was normalized. Such prepared vector was provided for the input of the
t-SNE dimension reduction algorithm to identify the classification potential. Re-
sult was shown in Fig 3.
Fig. 3. Output of t-SNE algorithm with data "Before picking up the queen" and "With-
out the queen".
Based on output of t-SNE algorithm it is clear that bees with and without
the queen act differently. Thus detection of this two cases can be performed using
classification method. For that purpose Support Vector Machine algorithm with
C-classification was used. Cost was set to C= 100 and kernel was defined as
K(xj,x) = exp−γkx−xjk2with γ= 0.4. Result as shown in Fig 4.
Fig. 4. SVM classification borders plot. Modeling the hive with absence queen bee as
feature: queen inside the hive (Before) and Queen taken (Missing).
Such defined model was tested with test data presented in Fig 2. Table 1
presents classification on the test data.
Data named as "Test old queen" and "Test old queen 2" indicates normal
work of the swarm. Such situations was classified correctly and model was very
accurate. It is possible to determine the moment when the queen bee may suffer
Table 1. Test data classification.
Name Samples With queen Without queen Error
Test old queen 92 90 2 2.17%
Test old queen 2 72 70 2 2.77%
Test new queen 130 98 32 75.38%
or even die for example from a pest attack. In such cases we should found samples
which significantly differ from the others.
It was also expected that after some time the data and situation inside the
hive should return to the situation before the mother’s removal. The experiment
showed that the colony did not return to the same state even 15 days after new
queen bee insertion. To more precisely examine this situation it was decided
to check classification potential between "Test data for the old queen bee" and
"Test data for the new queen". Result as shown in Fig 5.
Fig. 5. Swarm classification with two different queen bees.
Output data is quite easy separable what indicates that different bee queens
cause different behaviors across the swarm. For queen bee collapse detection
the system should only analyze changes of the behavior patterns but expecting
same behavior patters with fresh and old queen could be misleading. These
observations was discussed with two independent beekeepers who confirmed that
queen bee influences the behavior of the whole family. The new queen bee after
introduction into the family makes the bees subordinate to her disposition and
sound significantly changes. Model derived from "normal state" of two different
bee queens has been tested on two extra test datasets.
Results presented in Table 2 show that it is necessary to calculate a new
model for the newly introduced queen bee in order to detect next possible swarm
collapse. New queen is significantly different from her predecessor, and thus the
old model loses its usefulness.
Table 2. Classification of two test datasets from two different queen.
Name Samples Old queen New queen Error
Test data old queen 72 68 4 5.55%
Test data new queen 183 17 166 9.28%
6 Conclusion and future work
The experiment and its results confirm the validity of the proposed model. It
has been proved that there is a pattern that characterizes the normal work of
the swarm and it can be correctly identified using the system presented in this
paper. The anomalies such as the exchange of the mother are distinguishable
and extracted by the presented system.
The developed classification system can also be significantly improved. It is
necessary to collect much more data from different anomalies occurring inside the
hive in order to develop a global model of bees behavior. Detection of swarming
or diseases with usage of the described system can be real. For that purpose we
plan to use more sophisticated classifiers [19] ant their parallel implementation
[20] that should allow us to process larger set of the data in more effective way.
We can also obtain some improvement on the level of the data representation.
Here, we plan to add to Linear Predictive Coding analysis of particular feature
context in the similar way done in [21].
Our system is only a starting point for further work that is currently being
conducted. The life and behavior of animals in particular bees can be a source
of valuable information. Researchers at Nanchang University in China [22] have
found that bees work harder the day before the expected rain. This observation
is the basis for extending the system for predicting temperature and humidity
based on data coming from the hive.
Acknowledgments: This work has been supported partially by COST project
CA15118 "Mathematical and Computer Science Methods for Food Science and
Industry" and founds of the Department of Computer Architecture, Faculty of
Electronics, Telecommunications and Informatics, Gdańsk University of Tech-
nology.
References
1. Gill, R.: The value of honeybee pollination to society. Acta Hortic 228 (1991)
2. Svensson, B.: The importance of honeybee-pollination for the quality and quantity
of strawberries. Acta Hortic 228 (1991) 260–264
3. Cox-Foster, D.L., Conlan, S., Holmes, E.C., Palacios, G., Evans, J.D., Moran, N.A.,
Quan, P.L., Briese, T., Hornig, M., Geiser, D.M., et al.: A metagenomic survey of
microbes in honey bee colony collapse disorder. Science 318(5848) (2007) 283–287
4. Ratnieks, F.L.: Egg-laying, egg-removal, and ovary development by workers in
queenright honey bee colonies. Behavioral Ecology and Sociobiology 32(3) (Mar
1993) 191–198
5. Tautz, J.: The Buzz about Bees. Springer Science (2008)
6. Zacepins, A., Kviesis, A., Ahrendt, P., Richter, U., Tekin, S., Durgun, M.: Beekeep-
ing in the future—smart apiary management. In: Carpathian Control Conference
(ICCC), 2016 17th International, IEEE (2016) 808–812
7. Strob, M., Kašparu, M.: Beehive electronic measuring system
8. Kridi, D.S., Carvalho, C.G.N.d., Gomes, D.G.: A predictive algorithm for mitigate
swarming bees through proactive monitoring via wireless sensor networks. In:
Proceedings of the 11th ACM symposium on Performance evaluation of wireless
ad hoc, sensor, & ubiquitous networks, ACM (2014) 41–47
9. Ferrari, S., Silva, M., Guarino, M., Berckmans, D.: Monitoring of swarming sounds
in bee hives for early detection of the swarming period. Computers and electronics
in agriculture 64(1) (2008) 72–77
10. Qandour, A., Ahmad, I., Habibi, D., Leppard, M.: Remote beehive monitoring
using acoustic signals. (2014)
11. Chazette, L., Becker, M., Szczerbicka, H.: Basic algorithms for bee hive monitoring
and laser-based mite control. In: Computational Intelligence (SSCI), 2016 IEEE
Symposium Series on, IEEE (2016) 1–8
12. Schurischuster, S., Z.S.: Sensor study for monitoring varroa mites on honey bees
(apis mellifera)
13. Atal, B.S., Hanauer, S.L.: Speech analysis and synthesis by linear prediction of
the speech wave. The journal of the acoustical society of America 50(2B) (1971)
637–655
14. Makhoul, J.: Linear prediction: A tutorial review. Proceedings of the IEEE 63(4)
(1975) 561–580
15. Maaten, L.v.d., Hinton, G.: Visualizing data using t-sne. Journal of Machine
Learning Research 9(Nov) (2008) 2579–2605
16. Cortes, C., Vapnik, V.: Support-vector networks. Machine learning 20(3) (1995)
273–297
17. Boser, B.E., Guyon, I.M., Vapnik, V.N.: A training algorithm for optimal margin
classifiers. In: Proceedings of the fifth annual workshop on Computational learning
theory, ACM (1992) 144–152
18. Schölkopf, B.: The kernel trick for distances. In: Advances in neural information
processing systems. (2001) 301–307
19. Draszawka, K., Szymański, J.: Thresholding strategies for large scale multi-label
text classifier. In: Human System Interaction (HSI), 2013 The 6th International
Conference on, IEEE (2013) 350–355
20. Czarnul, P., Rościszewski, P., Matuszek, M., Szymański, J.: Simulation of parallel
similarity measure computations for large data sets. In: Cybernetics (CYBCONF),
2015 IEEE 2nd International Conference on, IEEE (2015) 472–477
21. Szymański, J.: Words context analysis for improvement of information retrieval.
In: International Conference on Computational Collective Intelligence, Springer
(2012) 318–325
22. He, X.J., Tian, L.Q., Wu, X.B., Zeng, Z.J.: Rfid monitoring indicates honeybees
work harder before a rainy day. Insect science 23(1) (2016) 157–159