Hi !
So my next step in my build process is to host the CustomVision.ai exported model in a RaspberryPi (RPI). RPI supports docker, so it should be easy to work with the exported Linux image.
So let’s take a look at the original [DockerFile] in the Linux export
FROM python:3.5 ADD app /app RUN pip install --upgrade pip RUN pip install -r /app/requirements.txt # Expose the port EXPOSE 80 # Set the working directory WORKDIR /app # Run the flask server for the endpoints CMD python app.py
This file uses a standard python 3.5 linux image as base. However browsing in the docker community, I found a specific set of base image for RaspberryPi in the Docker Hub from Balena (link), see references.
So, using this base image and some resources from [Custom Vision + Azure IoT Edge on a Raspberry Pi 3] I make some changes to the DockerFile to create a running image for RPI.
FROM balenalib/raspberrypi3 RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ build-essential \ python3-dev \ libopenjp2-7-dev \ libtiff5-dev \ zlib1g-dev \ libjpeg-dev \ libatlas-base-dev \ wget RUN pip3 install --upgrade pip RUN pip3 install pillow numpy flask tensorflow RUN pip3 install flask RUN pip3 install pillow RUN pip3 install numpy RUN pip3 install tensorflow ADD app /app EXPOSE 80 WORKDIR /app CMD python3 app.py
The full build process takes a couple of minutes, so you may want to have a coffee or a tea during the build process.
Once the process is complete, we can find the built and run the image from the docker image list
Next step is to try the remote container with a single cURL command and done!
Happy coding!
Greetings @ Toronto
El Bruno
References
- Custom Vision
- Docker Desktop
- Raspberry Pi
- Custom Vision + Azure IoT Edge on a Raspberry Pi 3
- Balena Docker Files for Raspberry Pi 3
My Posts
- Object recognition with Custom Vision and ONNX in Windows applications using WinML
- Object recognition with Custom Vision and ONNX in Windows applications using WinML
- Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
- Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
- Canβt install Docker on Windows 10 Home, need Pro or Enterprise
- Running a Custom Vision project in a local Docker Container
- Analyzing images in a Console App using a Custom Vision project in a Docker Container
- Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
Windows 10 and YOLOV2 for Object Detection Series
- Introduction to YoloV2 for object detection
- Create a basic Windows10 App and use YoloV2 in the camera for object detection
- Transform YoloV2 output analysis to C# classes and display them in frames
- Resize YoloV2 output to support multiple formats and process and display frames per second
- How to convert Tiny-YoloV3 model in CoreML format to ONNX and use it in a Windows 10 App
- Updated demo using Tiny YOLO V2 1.2, Windows 10 and YOLOV2 for Object Detection Series
- Alternatives to Yolo for object detection in ONNX format
15 comments