Hi !
So now that I have Docker running in Windows 10, it’s time to use a Custom Vision model in Windows hosted in Docker container.
There are 2 version available to export from CustomVision.ai for each one the projects: Linux or Windows
I could not sucessfully built the Windows version, so I’ll work with the Linux one. Once exported the zip file have a set of python files to tun the model, the model file (model.pb) and a Dockerfile to build the docker image.
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
The image uses Python 3.5, and the build command is as simple as
docker build -t elbruno/cvmarvel:3.0 .
After a couple of seconds, the image is build in the local store
docker image ls
Once I have my IMAGE ID, it’s time to start the image. For this demo, I’ll use the port 8080
docker run -p 127.0.0.1:8080:80 -d ddd1623ee694
And then I can submit an image using Invoke-WebRequest and view the results directly in PowerShell
Invoke-WebRequest -uri “http://127.0.0.1:8080/image” -Method Post -Infile “D:\docker\test01.jpg” -ContentType ‘image/jpg’
In order to get the complete output of the POST request, I must add an OutFile into the PowerShell comand. And in the complete output we can see some Iron Fist and Venom results!
Invoke-WebRequest -uri “http://127.0.0.1:8080/image” -Method Post -Infile “D:\docker\test01.jpg” -Outfile “D:\docker\result.json” -ContentType ‘image/jpg’
Happy coding!
Greetings @ Toronto
El Bruno
References
My Posts
- Object recognition with Custom Vision and ONNX in Windows applications using WinML (1)
- Object recognition with Custom Vision and ONNX in Windows applications using WinML (2)
- Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames (3)
- Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS (4)
- Can’t install Docker on Windows 10 Home, need Pro or Enterprise (5)
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
21 comments