IBM/MAX-Sports-Video-Classifier

Name: MAX-Sports-Video-Classifier

Owner: International Business Machines

Description: Classify sport videos

Created: 2018-03-09 23:20:35.0

Updated: 2018-05-17 20:39:18.0

Pushed: 2018-03-20 23:09:27.0

Homepage: null

Size: 3265

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

IBM Code Model Asset Exchange: Sports Video Classifier

This repository contains code to instantiate and deploy a video classification model. The model recognizes the 487 different classes of sports activities in the Sports-1M Dataset. The model consists of a deep 3-D convolutional net that was trained on the Sports-1M dataset. The input to the model is a video, and the output is a list of estimated class probabilities.

The model is based on the C3D TensorFlow Model. The model files are hosted on IBM Cloud Object Storage. The code in this repository deploys the model as a web service in a Docker container. This repository was developed as part of the IBM Code Model Asset Exchange.

Model Metadata

| Domain | Application | Industry | Framework | Training Data | Input Data Format | | ————- | ——– | ——– | ——— | ——— | ————– | | Vision | Video Classification | General | TensorFlow | Sports-1M | Video (MPEG-4)|

References
Licenses

| Component | License | Link | | ————- | ——– | ——– | | This repository | Apache 2.0 | LICENSE | | Model Weights | MIT | C3D-TensorFlow | | Model Code (3rd party) | MIT | C3D-TensorFlow | | Test assets | Various | Asset README |

Pre-requisites:
Steps
  1. Build the Model
  2. Deploy the Model
  3. Use the Model
  4. Development
  5. Clean Up
1. Build the Model

Clone this repository locally. In a terminal, run the following command:

t clone https://github.com/IBM/MAX-Sports-Video-Classifier.git

Change directory into the repository base folder:

 MAX-Sports-Video-Classifier

To build the docker image locally, run:

cker build -t max-tf-c3d .

All required model assets will be downloaded during the build process. Note that currently this docker image is CPU only (we will add support for GPU images later).

2. Deploy the Model

To run the docker image, which automatically starts the model serving API, run:

cker run -it -p 5000:5000 max-tf-c3d
3. Use the Model

The API server automatically generates an interactive Swagger documentation page. Go to http://localhost:5000 to load it. From there you can explore the API and also create test requests.

Use the model/predict endpoint to load a test video file and get predicted labels for the video from the API.

Swagger Doc Screenshot

You can also test it on the command line, for example:

rl -F "video=@assets/basketball.mp4" -XPOST http://127.0.0.1:5000/model/predict
son

tatus": "ok",
redictions": [
{
  "label_id": "367",
  "label": "basketball",
  "probability": 0.39916181564331
},
{
  "label_id": "370",
  "label": "streetball",
  "probability": 0.16513635218143
},
{
  "label_id": "369",
  "label": "3x3 (basketball)",
  "probability": 0.11865037679672
}


4. Development

To run the Flask API app in debug mode, edit config.py to set DEBUG = True under the application settings. You will then need to rebuild the docker image (see step 1).


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.