Azure Machine Learning Package For Computer Vision

Azure Machine Learning Package for Computer Vision (AMLPCV) is a Python extension for Azure Machine Learning. With this package, you can quickly build and deploy highly accurate machine learning and deep learning computer vision models.

Recycling example

The AMLPCV package supports the following scenarios:

  • Image classification
  • Object detection
  • Image similarity

For more information about each module and class in this package, see the package reference pages.

Why use this package?

The main advantages of AMLPCV:

  • High AI quality. AMLPCV supports state-of-the-art algorithms and includes default parameters proven to work on a wide variety of tasks when building accurate computer vision models.

  • Rapid time to solution. Automate important computer vision tasks enabling you to build and deploy a computer vision pipeline faster.

  • Flexibility. Powerful and composable Python API gives you out of the box capabilities with the full power to customize and fine-tune your computer vision models.

What's included in AMLPCV

Dataset creation

Easily connect and run your data set with AMLPCV. Input data can be stored as images on your local disk, downloaded using a list of URLs, or accessed in a dataset created by querying an Image Search API. The labels associated with these images can be added/modified through Python code or using the UI that runs inside the notebook. The data can be split into training, testing, and validation sets based on several split criteria supported by the package.

Data augmentation

Augment the datasets by transforming existing images based on a variety of image transformation techniques. You can use any image augmentation techniques supported by the imgaug library.

Modeling and training

Create Deep Neural Network (DNN) models, train, and score them. The user can fine tune and customize models or use a pretrained model for a transfer learning use case.

This package supports the CNTK framework for classification and image similarity and allows you to specify the layers to be frozen while training.

The object detection uses Tensorflow underneath. The training of the defined model with the dataset is done in a local compute environment such as an Azure Deep Learning Virtual Machine (DLVM) with GPU support.

Model evaluation

AMLPCV includes default parameters and algorithms that best fit the scenario. These selections were tested with various datasets in order to provide high-quality AI on first run. You can customize and fine-tune the parameters to improve the AI quality of your models.

Deployment

You can deploy trained models to Azure Machine Learning. The model can be deployed in a local Docker container or cluster environment using the deployment modules of this package. See the prerequisite section for deployment configuration information.

Prerequisites

You will need the following to install and use AMLPCV:

  1. An Azure subscription. If you don't have an Azure subscription, create a free account before you begin.

  2. A Windows Deep Learning Virtual Machine (DLVM) on Azure, which automatically has GPU support. To provision a DLVM, follow these instructions.

  3. The following accounts and application must be set up and installed:

    • An Azure Machine Learning Experimentation account
    • An Azure Machine Learning Model Management account
    • Azure Machine Learning Workbench installed on the DLVM

    If these accounts don't exist yet or if you haven't installed Workbench, follow the Azure Machine Learning Quickstart and Workbench installation article.

    The Azure Machine Learning Computer Vision Package runs on Azure Machine Learning Workbench. The DLVM comes with a pre-downloaded installable Workbench. Click on "AzureML Workbench Setup.msi" icon on the DLVM desktop to install Workbench.

  4. If you intend to deploy your models, you must configure your deployment environment. If you don't have one yet, set up your deployment environment now using these instructions.

    To see your active deployment environment, use the following CLI command:

    az ml env show

    Sample Azure CLI command to create and set deployment environment:

    az provider register -n Microsoft.MachineLearningCompute
    az provider register -n Microsoft.ContainerRegistry
    az provider register -n Microsoft.ContainerService
    az ml env setup --cluster -n [your environment name] -l [Azure region e.g. westcentralus] [-g [resource group]]
    az ml env set -n [environment name] -g [resource group]
    

Install this package

After completing the prerequisites, you can download and install the Azure Machine Learning Package for Computer Vision.

  1. Log into the Deep Learning Virtual Machine (DLVM).

  2. Download the package onto the DLVM.

  3. Navigate to the download location and unzip the file to get distribution artifacts under the following directory structure. Notice the install folder.

    install/
        setup.bat
        cvp*.whl
        ...
    CVP-project/
     classification/...
     detection/...
     similarity/...
     deployment/...
    README.md
    <licenses...>
    
  4. On the DLVM, enable the Win32 long paths group policy so that the package installer can run without encountering any long path issues. For detailed steps on enabling this policy, see here.

    1. On the Windows icon, type edit group policy to open the Local Group Policy Editor.

    2. In the Local Group Policy Editor, navigate to Computer Configuration > Administrator templates > System > File system > Enable win32 long path (State=Enabled)

  5. Launch Azure Machine Learning Workbench.

  6. From the Workbench menu, select File > Open Command Prompt.

  7. At the prompt, go to the install folder and run the setup.bat script to install the dependencies and package.

    cd install
    .\setup.bat
    

    Now you can explore the package functionality through its Jupyter notebooks in the Get started section.

Get started using Jupyter notebooks

The best way to familiarize yourself with the workflow of this computer vision package is through the sample Jupyter notebooks and Python scripts distributed with the package. The notebooks and scripts cover these computer vision scenarios:

  • Image classification
  • Object detection
  • Image similarity

The sample notebooks explain how to build a model with the package and customize that model to your specific dataset and scenario.

The sample notebooks must be run in the Azure Machine Learning Workbench environment.

To open the computer vision project in Workbench:

  1. Launch Azure Machine Learning Workbench.

  2. From the Workbench menu, select File > Add Existing Folder as Project.

  3. In the Project Directory field, navigate to the CVP-project directory. To access the data and documentation referenced by the notebooks, open the entire CVP-project directory.

    Note

    Since Workbench projects are capped at 25 MB, store your datasets in a different location than the project file. For some good practices on file storage within AML Workbench, please refer to this document.

To launch a notebook session from the command prompt:

  1. From the Workbench menu, select File > Open Command Prompt.

  2. At the prompt, go to the project root folder.

  3. At the prompt, start a notebook session using this Azure ML CLI command:

    az ml notebook start
    

Your default browser is automatically launched with Jupyter server pointing to the project home directory. You can now open the notebook of your choice and start interacting with it.

By running samples this way, you get the advantages of the Run History and Logging capabilities of Workbench. Additionally, you can store larger files under a folder output that does gets special treatment from Workbench.

Learn more about running Jupyter notebooks from Workbench in this document.

Get started using sample scripts

You can run Python scripts from the Azure Machine Learning Workbench command-line window.

To run a Python script from AML Workbench CLI window:

  1. Launch Azure Machine Learning Workbench.

  2. From the Workbench menu, select File > Open Command Prompt.

  3. At the prompt, submit an experiment:

    az ml experiment submit -local <script_name>.py
    

Reporting issues

For help with any issues, you encounter using this package, contact amlcvp@microsoft.com.