Mining Instagram: Computer Vision, Neural Networks, Object Recognition, and Face Detection
Exploring the Instagram API
In order to access the Instagram API, you will need to create an app and register it. This can be done fairly easily on the Instagram Developer platform. From there, simply register a new client, give it a name and description (e.g. “my test application”), and set a redirect URL to a website (e.g., www.google.com). The reason for the redirect URL will become clear shortly.
Your newly created client exists in a sandbox mode, which limits its capabilities. Apps in sandbox mode are restricted to a maximum of 10 users and can access only the 20 most recently posted media by each of those users. Stricter rate limits on the API are also imposed. These restrictions are so that you can test your app before submitting it for review. The Instagram staff can then vet your app. If it falls within the permitted use cases, it will be approved and those restrictions will be lifted. Since our focus is on learning about the API, all our examples assume an app in sandbox mode. This chapter is designed to give you the tools to continue learning on your own and build more sophisticated apps.
Anatomy of an Instagram Post
Responses from the Instagram API are structured as JSON, which we’ve seen before. It’s a way of transmitting humanreadable structured data over APIs as a hierarchical collection of attribute/value pairs. Instagram’s developer documentation contains the latest specifications for how the data is structured, but we’ll take a quick look here.
Crash Course on Artificial Neural Networks
Image analysis has a long history, but teaching computers to look at images and recognize things in them (like a dog or a car) is a more recent technological achievement. Imagine if you had to describe to a robot what a dog looks like.
You might describe the animal as having four legs, pointy ears, two eyes, large teeth, etc. The robot would faithfully apply these rules, but it would return thousands of false positives—other animals that also have four legs, pointy ears, etc. The robot might also fail to detect real dogs because instead of pointy ears, they had droopy ears.
Applying Neural Networks to Instagram Posts
Now that you’ve learned the basics of how a neural network works and have the code for accessing powerful cloudhosted neural networks behind an API, we’ll put the final pieces together. This section covers object recognition and face detection and makes use of our Instagram feeds for some source images.
Detecting Faces in Images
Facial recognition systems are extremely useful. You’ve probably encountered them already if you’ve used a modern digital camera, such as those in smartphones. In photography they are used to identify the subject of a photo and focus the image on the subject.
Last word
After you’ve read that chapter, return to these Instagram examples, and try to extract geographic information contained in the metadata of an Instagram post, or an object mentioned in the image description. Try creating a KML file from this data and open it with Google Earth. This is a neat way to visualize on a map all the places you’ve taken a photo.
Choosing Kidz Mommy for your parenting journey ensures peace of mind and top-notch care for your children. Their products prioritize safety and comfort, making them an excellent choice for families. Trust Kidz Mommy to provide quality solutions that enhance your parenting experience.