Scene Classifier

Overview

This model recognizes the 365 different classes of scene/location in the Places365-Standard subset of the Places2 Dataset. The model is based on the Places365-CNN Model and consists of a pre-trained deep convolutional net using the ResNet architecture, trained on the ImageNet-2012 data set. The pre-trained model is then fine-tuned on the Places365-Standard dataset. The input to the model is a 224×224 image, and the output is a list of estimated class probabilities. The specific model variant used is the PyTorch Places365 ResNet18 Model.

Model Metadata

Domain Application Industry Framework Training Data Input Data Format
Vision Image Classification General Pytorch Places365 Image (RGB/HWC)

References

Licenses

Component License Link
Model GitHub Repository Apache 2.0 LICENSE
Model Weights CC BY License Places365-CNN Model License
Model Code (3rd party) MIT Places365-CNN LICENSE
Test Assets CC0 Samples README

Options available for deploying this model

This model can be deployed using the following mechanisms:

  • Deploy from Dockerhub:

    docker run -it -p 5000:5000 codait/max-scene-classifier
    
  • Deploy on Red Hat OpenShift:

    Follow the instructions for the OpenShift web console or the OpenShift Container Platform CLI in this tutorial and specify codait/max-scene-classifier as the image name.

  • Deploy on Kubernetes:

    kubectl apply -f https://raw.githubusercontent.com/IBM/MAX-Scene-Classifier/master/max-scene-classifier.yaml
    

    A more elaborate tutorial on how to deploy this MAX model to production on IBM Cloud can be found here.

  • Locally: follow the instructions in the model README on GitHub

Example Usage

You can test or use this model

Test the model using cURL

Once deployed, you can test the model from the command line. For example if running locally:

curl -F "image=@samples/aquarium.jpg" -XPOST http://localhost:5000/model/predict

You should see a JSON response like that below:

{
  "status": "ok",
  "predictions": [
    {
      "label_id": "9",
      "label": "aquarium",
      "probability": 0.97350615262985
    },
    {
      "label_id": "342",
      "label": "underwater\/ocean_deep",
      "probability": 0.0062678409740329
    }
  ]
}

Test the model in a Node-RED flow

Complete the node-red-contrib-model-asset-exchange module setup instructions and import the scene-classifier getting started flow.

Test the model in a serverless app

You can utilize this model in a serverless application by following the instructions in the Leverage deep learning in IBM Cloud Functions tutorial.