Multiple Object Tracking or MOT estimates a bounding box and ID for each pre-defined object in videos or consecutive frames, which has been used in tasks such as live sports, manufacturing, surveillance, and traffic monitoring. In the past, the high latency caused by the limitation of hardware and complexity of ML-based tracking algorithm is a major obstacle for its application in the industry. The state-of art algorithm FairMOT has reached the speed of about 30FPS on the MOT challenge datasets, which helps MOT find its way in many industrial scenarios.
This post shows how to train and deploy the state-of-art MOT algorithm FairMOT model with Amazon SageMaker.
- Create an AWS account or use the existing AWS account.
- Make sure that you have a minimum of one
ml.p3.16xlarge
instance for the Training Job. If it is the first time you train a machine learning model onml.p3.16xlarge
, you will need to request a service quota increase for SageMaker Training Jobs. - Create a SageMaker Notebook instance. The default volume size is 5GB, you need to update the volume size to 100GB. For IAM role, choose the existing IAM role or create a new IAM role, attach the policy of
AmazonSageMakerFullAccess
andAmazonElasticContainerRegistryPublicFullAccess
to the chosen IAM role. - Make sure that you have a minimum of one
ml.p3.2xlarge
instance for Infenrece endpoint. If it is the first time you deploy a machine learning model onml.p3.2xlarge
, you will need to request a service quota increase for SageMaker Endpoints. - Make sure that you have a minimum of one
ml.p3.2xlarge
instance for Processing jobs. If it is the first time you run a processing job onml.p3.2xlarge
, you will need to request a service quota increase for SageMaker Processing Jobs. - The region
us-east-1
is recommended.
- one SageMaker notebook on
ml.t3.medium
in us-east-1 region:$0.05
per hour, (250 hours free Tier usage per month for the first 2 months) - one training job on
ml.p3.16xlarge
in us-east-1 region takes 3 hours, total training cost for each training job:$85
- one endpoint on
ml.p3.2xlarge
in us-east-1 region:$3.825
per hour - one SageMaker processing job on
ml.p3.2xlarge
in us-east-1 region:$3.825
per hour - Assuming you run one training job with the default parameters, test the real time inference and batch inference with the default test data, and delete inference endpoint once finishing test, totally it costs less than
$95
.
To tune hyperparameters with Amazon SageMaker Hyperparameter Jobs, we modified the original training script to validate the model during training and set the validation loss as the objective metric. Currently our project only supports model training on a single instance.
Open fairmot-training.ipynb
and run the cells step by step. It will take 3 hours to complete one training job. When performing hyperparameter tuning job, total run time will be about: Maximum total number of training jobs
x Time on one training job
/ Maximum number of parallel training jobs
.
We provide two ways of deploying the trained model: real time inference with endpoint and batch inference.
- To deploy a real time endpoint, open
fairmot-inference.ipynb
and run the cells step by step. - To run batch inference, open
fairmot-batch-inference.ipynb
and run the cells step by step. Because SageMaker Batch Transform only can run the batch transform job finishing within 600 seconds, we use SageMaker processing to run the batch inference.
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.