Skip to content package of the computer vision best practice repository
Python Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Computer Vision Best Practice

Giving computers some semblance of vision (and the implied ability to process the images and identify the content) has become practical with the massive compute and training data that is available today. A number of pre-built machine learning models are freely available for this task.

This MLHub package provides a demonstration of Microsoft's open source Computer Vision Best Practice repository available from The package supplies an interactive demonstration as an overview of the capabilities of the repository. Individual command line tools are also packaged for common computer vision tasks based on a collection of pre-built computer vision models. These command line tools aim to be used as part of a Linux pipeline of commands to process images.

Visit the github repository for this package for more details:

Quick Start Command Line Examples

$ ml demo     cvbp
$ ml tag      cvbp
$ ml classify cvbp
$ ml detect   cvbp


  • To install mlhub (Ubuntu)
$ pip3 install mlhub
  • To install and configure the package:
$ ml install   cvbp
$ ml configure cvbp

Command Line Tools

A full demonstration of the package is presented below using the demo command. The package also provides a number of useful command line tools which we introduce here.


The tag command will identify the dominant object (todo return all identified objects) in a photo with a reported level of confidence. The confidence and tag and filename are returned from the command, and can be piped on to other commands within a command line to, for example, add the tag to the meta-data of the image file.

This first example is classified 100% as a koala.

$ ml tag cvbp

Perhaps we would like to download this photo and then add the appropriate tag to it:

$ wget -O koala.jpg
$ exiftool koala.jpg | grep -i comment
$ ml tag cvbp koala.jpg |
  cut -d, -f2 |
  xargs bash -c 'mogrify -comment $0 koala.jpg' 
$ exiftool koala.jpg | grep -i comment
Comment                         : koala

Coffee mugs seem to be fairly standard fare:

$ ml tag cvbp

Here we identify the tag for a collection of photos.

$ ml tag cvbp image_*.png 

We can add a tag to each photo in the current folder:

$ ml tag cvbp *.jpg | 
  cut -d, -f2,3 | 
  tr ',' ' ' | 
  xargs -d'\n' -n1 bash -c 'mogrify -comment $0 $1'


The classify command will open up the computer's webcam and begin classifying the primary object within the frame of the camera.

$ ml classify cvbp


The detect command will open up the computer's webcam and begin detecting objects within the frame of the camera.

$ ml detect cvbp




$ ml demo cvbp


This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.

Legal Notices

Microsoft and any contributors grant you a license to the Microsoft documentation and other content in this repository under the Creative Commons Attribution 4.0 International Public License, see the LICENSE file, and grant you a license to any code in the repository under the MIT License, see the LICENSE-CODE file.

Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at

Privacy information can be found at

Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise.

You can’t perform that action at this time.