Classifying Bats to Species Based on Ultrasound Recordings Systems Using Artificial Neural Networks and Random Forests
Total Page:16
File Type:pdf, Size:1020Kb
IT 20 047 Examensarbete 30 hp Augusti 2020 Classifying bats to species based on ultrasound recordings Systems using artificial neural networks and random forests Samuel Pettersson Institutionen för informationsteknologi Department of Information Technology Abstract Classifying bats to species based on ultrasound recordings Samuel Pettersson Teknisk- naturvetenskaplig fakultet UTH-enheten Methods from machine learning are applied to species identification of bats based on short audio recordings. Feedforward artificial neural networks (densely connected as Besöksadress: well as convolutional) perform the classification based on spectrograms of the Ångströmlaboratoriet Lägerhyddsvägen 1 recordings. This is an in the literature largely unexplored method for acoustic Hus 4, Plan 0 species-identification of bats that has seen great success for species identification of birds. Random forests are trained to classify individual bat calls (detected Postadress: automatically using preëxisting software) based on temporal and spectral features Box 536 751 21 Uppsala (automatically measured in spectrograms of the recordings). The random forests then classify entire recordings by aggregating the classifications of all calls in each recording. Telefon: 018 – 471 30 03 The deep convolutional neural networks perform the best, achieving an accuracy of Telefax: 89.09 % (averaged over all classes) on a held-out test set and proving the viability of 018 – 471 30 00 deep learning for acoustic species-identification of bats. The best-performing random forest achieves an accuracy of 83.10 % (averaged over all classes) on a held-out Hemsida: validation set. These results seem to compare decently to results found in the http://www.teknat.uu.se/student literature, but a fair comparison is difficult to make. Handledare: Lars Pettersson Ämnesgranskare: Alexander Medvedev Examinator: Mats Daniels IT 20 047 Tryckt av: Reprocentralen ITC Contents 1 Introduction 1 2 Background 1 2.1 Bat surveying in general . 2 2.1.1 Motivation . 2 2.1.2 Methods . 3 2.2 Acoustic bat-surveying . 4 2.2.1 Echolocation . 4 2.2.2 Social calls . 7 2.2.3 History of bat acoustics . 8 2.2.4 Automated feature extraction from bat recordings . 8 2.2.5 Automated bat-species identification . 10 2.2.6 Concerns regarding automated species-identification . 15 2.3 Signal processing . 15 2.4 Supervised machine learning . 16 2.4.1 Artificial neural networks . 27 2.4.2 Convolutional neural networks . 33 2.4.3 Decision trees . 41 2.4.4 Random forests . 43 2.5 Popular tools for machine learning . 44 3 Materials and methods 45 3.1 The dataset . 45 3.2 Preprocessing . 46 3.3 Hardware and software . 49 3.4 Part 1: Classifiers using low-level features . 49 3.4.1 Using unweighted data . 50 3.4.2 Using weighted data . 54 3.4.3 Fine tuning . 55 3.5 Part 2: Classifiers using high-level features . 56 4 Results 57 4.1 Part 1: Classifiers using low-level features . 57 4.2 Part 2: Classifiers using high-level features . 76 5 Discussion 79 5.1 Future work . 87 6 Conclusion 92 7 Acknowledgments 92 References 92 iii 1 Introduction Bats of most species make use of echolocation in flight in order to navigate, avoid obstacles, and find prey. In other words, they periodically emit sound and listen to the echoes to get an understanding of their surroundings. These echolocation calls turn out to differ between species to varying degree, allowing for the identification of the species of a bat by acoustic means. This project is performed at Pettersson Elektronik AB, which is a company based in Uppsala that develops hardware and software for bioacoustics. The task is to develop a prototype for classifying short ultrasound recordings of echolocation calls and other vocalizations of bats according to the species of the vocalizing bats, i.e., for acoustic species-identification of bats. Moreover, the classifier should beable to identify recordings that do not actually contain any bat vocalizations; such recordings are plentiful in practice. Preferably, the output of the classifier should be not just a single most likely species but a degree of belief for each species under consideration. It should be possible to refine and extend the prototype into a product (or incorporate the classifier into an existing product), but such refinement is outside the scope of the project. There are two important use cases for a such a classifier. First, large quantities of bat recordings (e.g., as obtained from unattended recording devices) can be analyzed in an offline setting, typically ona desktop computer. This alleviates bat researchers from the time-consuming task of manually classifying all the recordings. Secondly, individual recordings made with a hand-held device can be classified in real time. Compared to the first use case, this places more severe computational constraints and memory constraints on the classifier. This project focuses on the first usecase. Two different approaches to the acoustic species-identification of bats are explored in this project, which is correspondingly divided into two parts. Some aspects are common for both parts: the classifiers distinguish between vocalizations of 13 Swedish bat species as well as other sounds (e.g., vocalizations of other animals and weather-induced noise, grouped into a single ’No bat’ class). This is achieved through the use of methods from machine learning and a dataset of audio recordings labeled by human experts with the species of the vocalizing bats. The classifiers are trained to imitate the labeling of the recordings by the humans in such a way that their labeling abilities to a large extent generalize to previously unseen data. The classifiers are limited to recordings of at most one species of bateach. In the first part of the project, entire recordings (upto 5 seconds) are classified using artificial neural networks (traditional densely connected as well as convolutional networks). The inputs to the networks are power spectral density spectrograms. Most of the artificial neural networks are deep, and so this first part of the project may be thought of as exploring the viability of deep learning for acoustic species- identification of bats, which apparently had not been done in the literature before 2020. Seeing asvery little domain-specific knowledge is used, this approach is likely applicable to species identification of other vocalizing animals. In the second part of the project, a more traditional approach to acoustic species-identification of bats is taken. Individual bat calls rather than entire recordings are classified to species using random forests. The classifier inputs are temporal and spectral measurements of a call, as extracted by the callViewer software. By aggregating the classifications of all calls in a recording, the classifier may be used toclassify entire recordings. All classifiers are trained on a dedicated training set and evaluated on a held-out validation set.The average accuracy over all classes and confusion matrices, which reveal how the predictions relate to the true labels, are computed. The best-performing classifier is finally reëvaluated on a held-out testset (different from the validation set) to ensure that the performance of the final classifier ismeasuredas fairly as possible. 2 Background Bats have inhabited the Earth for over 50 million years [119]. They constitute a speciose (species-rich) and in many ways extraordinary order of mammals, making use of such novelties as powered flight and echolocation. 1 Bats are one of only four groups of animals to have developed powered flight (the other three being insects, pterosaurs, and birds) [9], which makes bats the only mammals capable of powered flight. This has contributed to their rich dietary diversity (which includes insects, fruits, leaves, flowers, nectar, pollen, seeds, fish, frogs, and blood), diverse roosting habitats (which include foliage, caves, hollow trees, crevices in rocks and trees, and various man-made structures), reproductive strategies, and social behavior and likely to their prevalence across the Earth [68]. Most bats (more than 85 % of all species) make use of echolocation [38, 22], which is the emission of sound and use of its echoes to get an understanding of the surroundings. Bats use echolocation for navigation and avoiding obstacles [12] and finding prey [38]. 2.1 Bat surveying in general Identifying the species of bats is critical in surveys and monitoring programs [138], and it is also the focus of this project. 2.1.1 Motivation Bats are excellent indicators for human-induced environmental change (physical or chemical alterations), the ecological effects of environmental change (how biotic systems are affected), and biodiversity (richness and variety of species) [113]. In short, they are excellent bioindicators. Some reasons for this are: • Bats are a diverse group of mammals. In terms of number of individuals, bats may be among the most abundant groups of mammals [68]. In terms of number of species, there are over 1300 species of bats, which amounts to more than a fifth of all mammalian species and makes them secondin species richness only to rodents among all orders of mammals [113, 22]. • Bats are globally distributed. The polar regions and some remote Oceanic islands are the only regions without living bats [68]. • Bats are taxonomically stable. In other words, they have characteristics that make them easy to identify and the rate of species invalidation through synonymy is low [68]. • Insectivorous (insect-eating) bats occupy high trophic levels, which makes them more sensitive to the accumulation of pesticides and other toxins than, e.g., herbivorous (plant-eating) animals [68]. • Bats offer several ecosystem services, such as pollination, seed dispersal, and pest control. There- fore, the change in bat-population size reflects the state of plants and insects in the ecosystem [68]. • Bats have a low reproductive rate, which makes trends in the size of bat populations less sensitive to noise [68]. Other animals used as bioindicators include insects that are easily sampled and birds [68].