Skip to main content
Close Up Of Motherboard

Build your own image dataset with Bing Image Search API

March 1st, 2020
TUTORIAL

Need training data for image classification but can't find it on Kaggle? The Bing Image Search API (part of Azure Cognitive Services) lets you search for images programmatically, filtering by size, file size, licence, and colour.

The workflow

In Python: install the Bing Image Search SDK, configure your subscription key and endpoint, search with your keyword and desired count, convert results to a Pandas DataFrame, generate unique filenames using MIME type detection and UUIDs, then download images with error handling for broken links. The whole script can be parametrised to accept an array of search terms for batch downloading.

Moving data to Azure ML Studio

If you're using Azure Machine Learning Studio, upload the image folder to a datastore so other data scientists can access it too. A few lines of code with the azureml.core library handle the upload. The full Jupyter Notebook is available on GitHub.

Close Up Of Motherboard
Building an image recognition project?

LET'S TALK