It isn’t often that you need to label lots of images. But when the need arises you can use many of the pre-trained deep neural network models available for image labeling tasks. One of the most popular ones is ResNet50 and
keras provides a convenient of using it.
I’m a big fan of
docker and will use gw000/keras
docker image that comes installed with the necessary libraries needed to use ResNet50 for image labeling. A few additional tweaks are still needed and I’ll build a custom
docker image on top of gw000/keras.
First, create a directory in your workspace and
cd into it.
Create a Dockerfile.
Paste the following into your Dockerfile.
Build the image.
docker build -t resnet50labeling:v1 .
Create container from the image and shell into it.
docker run -it resnet50labeling:v1 /bin/bash
Once inside the container download an image to label. The command below downloads an image of a golden retriever.
Next, start a Python session inside the container and get ready to label the image downloaded above. The Python snippet below will be used to label the downloaded image. While executing the snippet below, a large file download will take place. This file contains the pre-trained weights of the ResNet50 deep neural network that is necessary to label the image.
If all goes well you should see the following;
ResNet50 in Keras defines the deep neural network architecture and provides a convenient way to use it as I’ve shown in this post.