Close
0%
0%

AI Wildlife Species Bat Detector

Species are auto detected 'in the wild' using machine learning with results transmitted to the cloud

Similar projects worth following
Microphones are used to capture audio data which is then processed using machine learning to identify the animal species, whether it be bird, bat, rodent, whale, dolphin or anything that makes a distinct noise.

The key advantages over other existing technology is that: the audio data is filtered at source saving both disc space and human intervention. Previously recordings could easily generate many hours of footage per day, consuming up to 5 Gb per hour of disc space and adversely affecting the zoologist's golfing handicap and social life.

If anybody wants to support any of our projects, check out our Amazon Wishlist here: https://www.amazon.co.uk/hz/wishlist/ls/3AW6R7V5BVU3R?ref_=wl_share

Patreon donations can be made here: patreon.com/Goat_Industries

The core ingredients of this project are:

  • Nvidia Jetson Nano development board / Raspberry Pi 4 + 4 GB RAM.
  • Noctula fan nf a4x20 5v pwm (Nano only)
  • ADC Pi shield for sensing battery and supply voltages.
  • EVM3683-7-QN-01A  Evaluation Board for supplying a steady 5v to the Nano.
  • 5 Inch EDID Capacitive Touch Screen 800x480 HDMI Monitor TFT LCD Display.
  • Dragino LoRa/GPS HAT  for transmitting to the 'cloud' (Currently Pi 4 only)
  • 12 V rechargeable battery pack.
  • WavX bioacoustics R software package for wildlife acoustic feature extraction.
  • Random Forest R classification software.
  • In house developed deployment software.
  • Full spectrum (384 kb per second) audio data.
  • UltraMic 384 usb microphone.
  • Waterproof case Max 004.

What have been the key challenges so far?

  • Choosing the right software. Initially I started off using a package designed for music classification called ' PyAudioAnalysis' which gave options for both Random Forest and then human voice recognition Deep Learning using Tensorflow. Both systems worked ok, but the results were very poor. After some time chatting on this very friendly Facebook group:  Bat Call Sound Analysis Workshop , I found a software package written in the R language with a decent tutorial that worked well within a few hours of tweaking. As a rule, if the tutorial is crap, then the software should probably be avoided! The same was true when creating the app with the touchscreen - I found one really good tutorial for GTK 3 + python, with examples, which set me up for a relatively smooth ride.
  • After choosing to focus on detecting bats, finding quality bat data for my country. In theory, there should be numerous databases of full spectrum audio recordings in the UK and France, but when actually trying to download audio files, most of them seem to have been closed down or limited to the more obscure 'social calls'. The only option was to make my own recordings which entailed setting up the device overnight in my local nature reserves, by which I managed to find 7 species of bat. Undoubtedly, the data is the most important part of this project and I spent very many pleasant hours out in the wilderness with the detector and the sounds of these wonderful creatures.
  • Using GTK 3 to produce the app. Whilst python itself is very well documented on Stack exchange etc, solving more detailed problems with GTK 3 was hard going. One bug was completely undocumented and took me 3 days to remove! The software is also rather clunky and not particularly user friendly or intuitive. Compared to ordinary programming with Python, GTK was NOT an enjoyable experience, although it's very rewarding to see the app in action.
  • Designing the overall architecture of the app - GTK only covers a very small part of the app - the touch screen display. The rest of it relies on various Bash and Python scripts to interact with the main deployment script which is written in R. Learning the R language was really not a problem as it's a very generic languages and and only seems to differ in it's idiosyncratic use of syntax, just like any other language really. The 'stack' architecture initially started to evolve organically with a lot of trial and error. As a Hacker, I just put it together in a way that seemed logical and did not involve too much work. I'm far too lazy to learn how to build a stack properly or even learn any language properly, but, after giving a presentation to my local university computer department, everybody seemed to agree that that was perfectly ok for product development. Below is a quick sketch of the stack interactions, which will be pure nonsense to most people but is invaluable to remind myself of how it all works:
  • Creating a dynamic barchart - I really wanted to display the results of the bat detection system in the most easy and comprehensive way and the boring old barchart seemed like the way forwards. However, to make it a bit more exciting, I decided to have it update dynamically so that as soon as a bat...
Read more »

View all 13 components

  • Testing the system on a Rock 5B

    Capt. Flatus O'Flaherty ☠03/01/2023 at 08:26 0 comments

    After taking delivery of a Rock 5B with 8 Gb RAM, I took the opportunity to check and update all the processes necessary to install the software necessary to run this device. Many of the previous bugs, such as ALSA not being able to record at high frequencies, have now been fixed by those people themselves. The only real problem I had was that the Rock 5B would not boot up on the first, or even the second try and had to be re-powered up several times.

    Once the software was all successfully installed, the GUI was used to set the system to graphical display, which displays a bar chart, and on pressing 'Start', everything worked pretty much as expected. What was not expected, was the high quality of the recording, with none of the usual aberrations found with the other devices used. This is a massive advantage and well worth the extra expense of the Rock 5B. Also, the 8 Gb of RAM allows many more species to be detected if I had the audio data and there's even a 16 Gb variant available.

    The instructions here and GitHub repo have been updated.

  • Finally Seventh Bat Species Detected!

    Capt. Flatus O'Flaherty ☠10/19/2020 at 07:33 0 comments

    The Lesser Horseshoe Bat is a tiny creature the size of a plum and is quite rare in the UK. Using this equipment, I have detected it in other areas close by but never before outside my home. This is October 19th and, being in the middle of the bat mating season, it's probably because they are venturing further afield looking for a bit of romance.

  • Clean Spectograms on Mains Power

    Capt. Flatus O'Flaherty ☠10/15/2020 at 08:31 0 comments

    Slight interference band at 96K, but otherwise clean on new mains power adapter. Phew - expensive but money well spent!

  • Medical grade power supply

    Capt. Flatus O'Flaherty ☠10/13/2020 at 12:55 0 comments

    Probably not the most exciting log in this project, but trying to run the wildlife detector off the mains power has proved tricky due to poor quality switching adapter power supplies for the Jetson Nano. Eventually went for the most expensive medical grade one I could find. The Stontronics T6380ST. And now there is very minimal interference on the audio recordings :)

  • More Enquiries from Welsh Government and Secret Website revealed

    Capt. Flatus O'Flaherty ☠09/30/2020 at 18:16 1 comment

    After posting the fact that this project was short-listed for the Hackaday Prize on social media, it has suddenly attracted a lot of attention from my country's government. Not one, but two separate gov. agencies have now been in contact with a view to commercialisation. Telephone meeting went well today, despite me being thrown off somebody's farmyard drive, mid conversation, with the classic UK line: "Get Off My Land". Hilarious!

    It's also time to unveil our secret website and the actual name of the product: http://narwhal-ai.org/

  • Secret Project Partner Now Revealed - Hydrophone development

    Capt. Flatus O'Flaherty ☠09/24/2020 at 19:38 0 comments

    I want to mention Ivano Pelicella of Dodotronics who has helped develop this project in secret over the last few months by supplying components etc. such as the Nvidia Jetson Nano. Ivano is a specialist microphone developer in Italy and the project currently uses his Ultramic-384k-ble USB mic. Obviously, to monitor aquatic mammals, a waterproof mic is required and Ivano is developing this very thing, literally, as we speak. Here are the moulds for the prototype:

    Hydrophones are extremely hard to find / expensive, but essential to this project for the future.

  • Commercialisation of this Project is Approaching

    Capt. Flatus O'Flaherty ☠09/24/2020 at 18:11 0 comments

    Just come back from a meeting with some local UK Welsh Government agents who have contacted me via social media. They are very keen to get local tech businesses up and running in the local economy and have made strong indications that this Wildlife Detector will be supported. The plan is primarily to deploy the device on local rivers as part of their Menai Rivers Project to monitor the rodent and otter population and then take it out to sea and monitor aquatic mammals in conjunction with a massive tidal energy project.

  • The Official Hackaday Prize Video

    Capt. Flatus O'Flaherty ☠09/16/2020 at 07:06 0 comments

    Since this project is now one of the 34 finalists, I thought I should produce a video update on the project. Nothing much has changed with the hardware over the last couple of months but I have done quite a few re-training sessions with the addition of new data to improve accuracy. I have used the detector every night, weather permitting, for last 6 months or so and the results can be seen live on this web page: LIIVE FEED between about 19:00 and 08:00 hours local time. I am in the UK and my time zone is BST or GMT or somewhere near 0 (it changes in October!)

    It's actually very satisfying to have a project at some kind of 'finished' stage although it would be really great to have a custom PCB built for the power supply with some kind of scheduling chip on it so that the Nano / RPi 4 can be fired up at a pre-determined time of day and then shut off again later, thus saving battery power.


    Talking about power, it's astonishing that there is no 'consumer' solution for providing adequate battery orientated 5V power for these power hungry devices. At the time of building the system, there was no plug and play shield available for the high currents required and nothing for taking power from a lead acid battery at charging voltages of, for example, 15 volts.

  • Thumbs up from Jensen Huang CEO of Nvidia !

    Capt. Flatus O'Flaherty ☠09/15/2020 at 07:40 0 comments

    Just heard that Jensen Huang has chosen to feature this project in his keynote speech at Nvidia's GPU Technology Conference (GTC) on October 5th 2020. Jensen is the top Honcho of Nvidia who most of us have never heard of before - the Elon Musk of SpaceX. So, for anybody developing Ai projects like myself, this is totally awesome!

    Somebody recently suggested that he might want to send it off into outer space to detect species of Aliens. I never thought of that, but sounds like a great idea!

  • Web Page for Live Updates

    Capt. Flatus O'Flaherty ☠03/31/2020 at 13:12 0 comments

    Most evenings, currently at about 20.00 UTC, this gadget will be deployed in the wild for rigorous testing and debugging. The barchart updates itself every 3 minutes or so and it's quite fun to see the animals appear during the evening / night.
    http://www.goatindustries.co.uk/bat_detector/showdata.php

View all 19 project logs

  • 1
    Install the software on the Rock 5B
  • # Use Balena Etcher to install a Rock 5B image on the SD card.
  • # Install the new card in the Rock 5B, connect ethernet cable and mouse, keyboard and monitor and power it up.
  • # Look for the flashing blue LED, might be necessary to reboot a few times.
    # At command prompt, type:
    sudo apt update && sudo apt upgrade (the user is 'rock' and the password is 'rock').
    # To install ubuntu desktop type:
    sudo apt install ubuntu-desktop
    # If errors, repeat above command.
    # Reboot the Rock 5B.
    # In settings, add a new user called 'tegwyn'.

  • # Switch users to tegwyn.

    sudo apt install make
    sudo apt install build-essential
    # If errors, repeat above command.

    # Manually download bzip2-1.0.6 from soundforge website:
    https://sourceforge.net/projects/bzip2/files/latest/download
    It should now be in the downloads folder.
    cd && cd /home/tegwyn/Downloads/
    tar zxvf bzip2-1.0.6.tar.gz cd bzip2-1.0.6
    sudo make install

    sudo apt install -y git
    git clone https://github.com/paddygoat/ultrasonic_classifier.git

    # Now download the random forest model files:
    sudo apt install -y curl
    curl -o /home/tegwyn/ultrasonic_classifier/rds_files/rds_files.zip -L 'https://drive.google.com/uc?export=download&confirm=yes&id=1YeJUVu2hnVMerrqBaqQNCimyuveOwVJu'
    sudo apt install -y unzip
    unzip /home/tegwyn/ultrasonic_classifier/rds_files/rds_files.zip -d /home/tegwyn/ultrasonic_classifier/rds_files
    rm /home/tegwyn/ultrasonic_classifier/rds_files/rds_files.zip
    rm /home/tegwyn/ultrasonic_classifier/rds_files/nothing.txt

    # Install software tools and libraries:
    sudo apt install -y python3-pip
    sudo apt install -y python3-smbus
    sudo apt install -y i2c-tools
    sudo python3 -m pip install git+https://github.com/abelectronicsuk/ABElectronics_Python_Libraries.git

    sudo apt install -y liblzma-dev
    sudo apt install -y cmake
    sudo apt install -y sox libsox-fmt-all
    # If errors, repeat above command.
    sudo apt install -y audacity

    pip3 install cython
    pip3 install playsound
    pip3 install pydub
    pip3 install pathlib2

    sudo apt install -y gir1.2-appindicator3-0.1
    sudo apt install -y libcairo2-dev libxt-dev libgirepository1.0-dev

    pip3 install pycairo PyGObject
    pip3 install numpy
    pip3 install matplotlib
    pip3 install DateTimeRange
    pip3 install pandas
    pip3 install colorama

    sudo apt install -y python3-scipy
    sudo apt install -y gfortran libreadline6-dev libx11-dev libxt-dev libpng-dev libjpeg-dev libcairo2-dev xvfb libcurl4-openssl-dev texinfo
    # If errors, repeat above command.

    # Install R:
    sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
    sudo apt upgrade
    # sudo apt install focal-cran40
    # sudo apt install R
    sudo apt-get install -y r-base-dev
    # If errors, repeat above command.

    # Change some file permissions:
    sudo chmod -R 777 /usr/local/lib/R/site-library
    sudo chmod -R 777 /usr/local/lib/R/
    sudo chmod -R 775 /home/tegwyn/ultrasonic_classifier/

    # Now run R by typing 'R' in command line:
    R

    # Install some R packages:
    install.packages("crayon")
    install.packages("rstudioapi")
    install.packages("audio")
    urlPackage <- "https://cran.r-project.org/src/contrib/Archive/randomForest/randomForest_4.6-12.tar.gz"
    install.packages(urlPackage, repos=NULL, type="source") install.packages("bioacoustics")
    # If errors, repeat above command.
    # Exit R with ctl + z

    # Run the classifier:
    cd /home/tegwyn/ultrasonic_classifier/ && ./run.sh

    # Rattle some keys near the microphone and a 'UFO' should be detected.

  • 2
    Circuit Diagram
  • View all instructions

    Enjoy this project?

    Share

    Discussions

    Bram Peirs @ FW2W wrote 09/09/2020 at 11:03 point

    Can it be made cheaper? Eg with cheaper microphone and less computing force? It's not important to know right away what kind of bat it is right? Maybe data could be sent to the cloud to analyze?

    There is a market for your product at the big windturbineproducers. In EU there are regulations on bats, and as we speak experiments are being done with bat detectors in windturbines to stall them when bats are flying out. You are always welcome to text us if you need more info.

      Are you sure? yes | no

    Capt. Flatus O'Flaherty ☠ wrote 09/15/2020 at 07:44 point

    Thanks for comment Bram. This is already the cheapest microphone :( It's not possible to compromise on the quality.

      Are you sure? yes | no

    Ken Yap wrote 09/15/2020 at 08:58 point

    I read the other day that scientists found a cheap way to reduce bird fatalities with wind turbines, just paint one blade black. Who would have guessed? Perhaps they could investigate modifying blades to generate sounds to warn bats.

      Are you sure? yes | no

    Jibril wrote 02/28/2020 at 14:33 point

    nice project

      Are you sure? yes | no

    Capt. Flatus O'Flaherty ☠ wrote 09/15/2020 at 07:44 point

    Thanks!

      Are you sure? yes | no

    Ken Yap wrote 02/08/2020 at 00:03 point

    Hmm, is your instrument intelligent or does it detect intelligent bats? Or both? I wouldn't be surprised if they are intelligent too.

      Are you sure? yes | no

    Capt. Flatus O'Flaherty ☠ wrote 02/08/2020 at 09:36 point

    The bats are definitely intelligent, so yes the gadget does both. However, bats can not talk to each other beyond a basic level so can not debate the meaning of life, for example ...... Unless I'm missing something?

      Are you sure? yes | no

    Capt. Flatus O'Flaherty ☠ wrote 02/08/2020 at 09:38 point

    ..... Of course, the bats are a lot more intelligent than this gadget :)

      Are you sure? yes | no

    Ken Yap wrote 02/08/2020 at 09:50 point

    👍

      Are you sure? yes | no

    Dan Maloney wrote 02/07/2020 at 16:46 point

    It's interesting that bats have social calls distinct from their echolocation sounds - didn't know that, but probably should have guessed. Curious how you found out which six bat species you have if you couldn't find a decent database of bat sounds - or did you just determine from the calls that there are six different species yet-to-be-identified?

    Interesting work. We used to have bats come out every night around our house, and I loved watching them maneuver about. Always wondered what they were doing up high when the mosquitoes I was told makes up most of their diet would seem to need to stay close to the ground to feast on us mammals.

      Are you sure? yes | no

    Capt. Flatus O'Flaherty ☠ wrote 02/07/2020 at 17:38 point

    Hello Dan - Great to hear from you! I bought a couple of books on  analysing British and European bats and quizzed the guys on Facebook on some of the more tricky species. Some people are incredibly helpful! As for your bats, different species have different feeding habits - some will feed up high and some even specialise in swooping down over areas of water. I dont know much about USA bats so could not say what they might be :( Generally, as you indicated, insects are attracted to mammals such as cows and their dung so the bats will be associated with cows etc grazing in pastures.

      Are you sure? yes | no

    Similar Projects

    Does this project spark your interest?

    Become a member to follow this project and never miss any updates