A sample machine vision project that accepts an image of a car (presumably with forms of damage), and returns a picture annotated with boxes around likely areas of damage.
We built this project to show how custom trained AI models are incorporated into low code platforms such as Mendix, referencing great work already done in the references section. The aim of this project is to get readers excited about working with AI models, with code examples showing training, inference, containerization and prototype serving (not production) of a simple consumer facing use case. This is by no means a study into each area, but more an attempt at an end to end example of training to serving.
- Git clone this project, making sure weight file (final.pth) downloads into models/weights/
- Make sure prereqs installed, docker, Nvidia drivers (if you are training). If you are running inference or annotating pictures only without a GPU, it will take 5-10 seconds for a response.
- For training, I would advise against training without a GPU unless you're running only a few epochs (or iterations). We trained this model for 100 cycles, with around 80+ showing convergence (for prototype accuracy).
- Use the makefile and run make build-prereqs, make build-image, make run-image (or run-image-gpu if you have Nvidia GPU access)
- Post http://yourservername:5000/annotate with form data of type file, referencing an image from the references/test-images folder
- Expect 5-10 seconds inference time for CPU, or ~500 ms for GPU
- Sign up for a free Weights and Biases account https://wandb.ai, we use them for hyperparameter tracking. Weight files are configured to be stored locally (so as to not exceed cloud storage space)
- Download dataset from Kaggle to ./data/external, and unzip (this is also in the main notebook)
- Assuming you're running a GPU locally or on a cloud instance, at the command line typing nvidia-smi should show you meaningful info.
- Additional steps here... (TBD)
- Python v3.9
- Nvidia (Cuda 11 +) for GPU acceleration
- Docker, Pytorch, Faster R-CNN, Resnet50, COCO
- Kaggle, for data set hosting
- Weights and Biases for hyperparameter and results training
- Inference served with AWS g4dn.xlarge (Nvidia T4), AMI of Deep Learning Ubuntu 18
- Training locally with Ubuntu 20.04 (passthrough Nvidia 1080Ti) VM, Proxmox VE 7
- Car Damage Classification
- CNN Car Exterior Damage
- Pyimagesearch-Pytorch Object Detection
- How to train Object Detector with COCO dataset in Pytorch
- Publish of training components
- Conversion to ONNX and running direct within Mendix runtime
Project based on the cookiecutter data science project template. #cookiecutterdatascience