camera traps are used by the conservation community to take inventory of wildlife populations and ultimately measure the health of biodiversity in a non-invasive way using motion sensor cameras these cameras take care of automatically snapping photos when movement is detected but the tricky part after is reviewing each of the millions of photos and counting each species as well as bad actors such as poachers this is where machine learning is of great help and so in this episode we will share how to build an image classification app for camera traps so let's dive in thanks to data
today we can understand our natural world with far greater richness than ever before by orders of magnitude this now empowers us to build amazing apps that can help us solve complex social and environmental challenges and so in this series let's build an app together meet tanya from google where her and a team of volunteers have done an amazing job at partnering with multiple organizations to launch a successful image classifier for camera traps along with a web app that lets anyone upload camera trap data since it's fundamental in machine learning to use a lot of data
and so sharing with us many organizations is essential to research as many species as possible you can check out the website at wildlifeinsights.org wildlife insights is a project that's a collaboration between leading conservation organizations in google and the bigger picture challenge that we're facing is we've lost 68 percent of wildlife populations on average since the 1970s biologists for a number of years about you know several decades or even even further have been using these things called camera traps this is a motion triggered camera the animal walks by and the camera takes a series of images
[Music] so one of the challenges the data is is siloed oftentimes it's in it's housed in universities or research institutions um and there there isn't an easy way to share that data the second problem is it's really hard to process um like i said you can be you know drowning in all of this data millions and millions of images and what you really need is the species of your interest so we have been working with the google cloud platform to upload to manage and share uh and store all of this camera trap data millions and
millions of images on the google cloud and then um we've been applying uh artificial intelligence models to understand make predictions upon what species is in what image this project is quite amazing and now i will walk you through how to build a simple version let's start with the main ingredients for the hardware and the software from a hardware standpoint we need a camera trap taking photos that's connected to a microcontroller like a raspberry pi or arduino this basically serves as a small linux computer and will have an ml model we install that labels images of
species and omits blank images if it is able to connect to the internet via a cellular network it can send labeled photos automatically but in remote areas you can carry the microcontroller to a wi-fi enabled area periodically to do this transfer as a friendly tip when managing a large fleet of microcontrollers it's handy to write a script that uses cloud iot core in order to update all your devices simultaneously rather than updating each device manually especially as the classification model is updated with new data from the field next is the software which we will be
using cloud computing resources from google cloud i think one of the biggest um challenges for this project uh is building it upon a robust enough platform that it can scale and also that can handle the kind of inference that we'll be doing when you know you have biologists from all over the world that are uploading their data and using cloud ai platform predictions for this project specifically the estimated cost per month is less than thirty dollars as of the making of this video and includes three gigabytes of images there are two main workflows in the
solution one is a training model and the other is classifying images and the two products that perform most of the heavy lifting is dataflow and ai platform let's start with dataflow which is a serverless data processing service that can process very large amounts of data needed for machine learning activities in this scenario we use it to run two jobs the first job creates a database in bigquery by uploading two columns of the metadata from the camera trap data set from lila diet science this is a one-time setup those two columns contain the category of the
label of the species the other is the file's name or the path where the image is located it also emits rows that do not contain relevant information which is an essential data pre-processing step the second data flow job makes a list of images that would be great for creating a balanced data set this is informed by our requirements for selecting images that have a minimum and a maximum amount of species per category to ensure that we train a bias-free model that doesn't include a species it has too little information about and is later unable to
classify it correctly when this assessment is complete dataflow proceeds to download the actual images into cloud storage from that lila science dataset i mentioned this enables us to only store and process the images that are relevant and not the entire data set this keeps computational time and costs down next we build a model with ai platform which uses automl and the images we store in cloud storage once the model is deployed we can classify images let's see what the model thinks about some of these images [Music] so this is fantastic we have a model working
now the next step is to upload it to each microcontroller so that it classifies images locally next time you want to upload these classified images from the field we can save them as jpeg files directly into cloud storage and their metadata into bigquery note that you can optionally collect more metadata information such as the camera traps location the date etc and build a simple dashboard that you can report aggregated insights of species to recap wildlifeinsights.org is an amazing project and today we took apart this case study in order to inspire you to try to replicate
the solution for your own use case so what's next well i have appended in this video's description several helpful links including a link to a notebook that contains all the code we used for this example which means you don't have to write any of it all you have to do is click play for each section and finally you can hit like or leave us a comment if you found this content helpful and share what other ai for good use cases you have in mind thank you so much for watching friends i'll leave you with tania's
fun fact about this project cheers a fun fact about working on this project has been putting a camera trap in my very own backyard yeah we've caught all sorts of animals we've got mountain lions bobcats foxes deer of course opossums and yeah it's really great to be able to teach my kids about the wildlife in our backyard you