An MLHub prebuilt model for object recognition
Switch branches/tags
Nothing to show
Clone or download


Object Recognition

This package, based on the deep learning kubernetes tutorial by Mathew Salvaris and Fidan Boylu Uz of Microsoft, demonstrates a pre-trained ResNet152 model to identify the main object of a photo. Sample images are provided within the package and the demonstration applies the pre-built model to each image. This pre-built model has been trained to recognise 1000 different kinds of classes/objects. These include goldfish, great white shark, tiger shark, sports car, etc.

Visit the github repository for the sample code.


  • To install and run the pre-built model:

    $ pip install mlhub
    $ ml install object-recognition
    $ ml configure object-recognition
    $ ml demo object-recognition
  • To classify:

    • An image from a local file:

      $ ml score object-recognition ~/.mlhub/object-recognition/images/lynx.jpg
    • Images in a folder:

      $ ml score object-recognition ~/.mlhub/object-recognition/images/
    • An image from the web (See

      $ ml score object-recognition
    • Interatively without repeatedly reloading the model:

      $ ml score object-recognition
  • To visualise the network graph of the model:

    $ ml display object-recognition

    The default browser will be opened to display the graph rendered by TensorBoard. Please refresh the browser if it cannot connect to http://localhost:6006, because starting TensorBoard may take time.

  • To print a textual summary of the model:

    $ ml print object-recognition            # Show only a short summary of the model
    $ ml print object-recognition --verbose  # Show a long list of layers of the model
    $ ml print object-recognition -n 10      # Show only the first or last 10 layers