Based on Batch Scoring Deep Learning Models With AKS
In this repository, we use the scenario of applying vehicle detection onto a video (collection of images). This architecture can be generalized for any batch scoring with deep learning scenario.
The above architecture works as follows:
- Upload a video file to storage.
- The video file will trigger Logic App to send a request to the flask endpoint hosted on one of the nodes of the AKS cluster.
- That node will first preprocess the video file by splitting the video into individual images and extracting the audio file.
- That node will then add all images to the Service Bus queue.
- The other nodes in the AKS cluster are continuously polling the Service Bus queue - as soon as any images are in the queue, it will pull it off the queue and apply style transfer to the image.
- When all frames have been processed, the images will be stitched back together into a video with the audio file.
Local/Working Machine:
- Ubuntu >=16.04LTS (not tested on Mac or Windows)
- (Optional) NVIDIA Drivers on GPU enabled machine [Additional ref: https://github.com/NVIDIA/nvidia-docker]
- Conda >=4.5.4
- Docker >=1.0
- AzCopy >=7.0.0
- Azure CLI >=2.0
Accounts:
- Azure Subscription
- (Optional) A quota for GPU-enabled VMs
While it is not required, it is also useful to use the Azure Storage Explorer to inspect your storage account.e az cli
installed and logged into
- Clone the repo
git clone https://github.com/Azure/Batch-Scoring-Deep-Learning-Models-With-AKS
cd
into the repo- Setup your conda env using the environment.yml file
conda env create -f environment.yml
- this will create a conda environment called batchscoringdl - Activate your environment
source activate batchscoringdl
- Log in to Azure using the az cli
az login
Run throught the following notebooks:
- Test the vechicle detection script
- Setup Azure - Resource group, Storage, Service Bus.
- Test the model locally
- Create the AKS cluster
- Run vehicle detection on the cluster
- Deploy Logic Apps
- Clean up
To clean up your working directory, you can run the clean_up.sh
script that comes with this repo. This will remove all temporary directories that were generated as well as any configuration (such as Dockerfiles) that were created during the tutorials. This script will not remove the .env
file.
To clean up your Azure resources, you can simply delete the resource group that all your resources were deployed into. This can be done in the az cli
using the command az group delete --name <name-of-your-resource-group>
, or in the portal. If you want to keep certain resources, you can also use the az cli
or the Azure portal to cherry pick the ones you want to deprovision. Finally, you should also delete the service principle using the az ad sp delete
command.
All the step above are covered in the final notebook.