Ready-to-Use Deep-Learning Models

Getting started with open source model assets from IBM

Object detection at work. Photo by Alexis Chloe on Unsplash https://unsplash.com/photos/dD75iU5UAU4
  • Implement wrapper code that pre-processes the inputs, invokes the framework to produce the model output and converts the output into an application-friendly format.
Pre-trained model + wrapper = deep-learning ready for application use

Getting started

Choose the desired model from the MAX website, clone the referenced GitHub repository (it contains all you need), and build and run the Docker image.

$ git clone https://github.com/IBM/MAX-Image-Caption-Generator.git
$ cd MAX-Image-Caption-Generator
$ docker build -t max-im2txt .
$ docker run -it -p 5000:5000 max-im2txt
   ...
   Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
Docker containers provide all the functionality you need to explore and consume deep learning models from the Model Asset Exchange.

Test-drive the API

The quickest way to test-drive the service is through the generated Swagger UI. Provide the requested input (in this example the location of an image) and send a prediction request:

Running a quick test using the Swagger UI. Note the low probability in this example; the generated image caption might not accurately reflect the image content.
$ curl -F "image=@t.jpg" -X POST http://localhost:5000/model/predict

Consume the API

To leverage the service, invoke the desired REST API endpoint, providing the required input(s). For some of the models we’ve created a sample web application, such as this Python app for the image caption model. To find out whether a sample application exists for the model you are interested in, refer to the model asset’s README file in GitHub.

Annotate images with a description of their content.
  • The model assets are provided as is. Refer to each model asset README for details about its origin, training data set, licensing terms etc.
  • You are welcome to customize the docker images to suit your needs. There are many ways they can be enhanced. Our goal is to provide a foundation that you can build on. So if you would like to restrict access using an API token or require a different output format go ahead and hack away.
  • If running a docker image is not a suitable option for your use-case scenario stay tuned. As Maureen McElaney outlined in her blog post, we have started to look at other ways to make these models available in a browser near you.

IBM CODAIT

Things we made with data at IBM’s Center for Open Source Data and AI Technologies.

Patrick Titzler

Written by

Developer Advocate at Center for Open-Source Data & AI Technologies

IBM CODAIT

Things we made with data at IBM’s Center for Open Source Data and AI Technologies.