Table of Contents
Color Detection and Contour Drawing Flowchart
As my previous blog mentioned OpenCV is a great framework for image processing projects. The final presentation for this design challenge is Z7_Color_AID phase 1 project, which is color recognition via OpenCV/PYNQ platform. The overall signal flowchart is as follows.
Current project can recognize multiple colors in the real time on Arty-Z7-20 platform under PYNQ_V3.0.1 without any FPGA HW acceleration.
Colormap for HSV
HSV stands for Hue Saturation Value. The HSV color model is more intuitive to human vision. RGB color model is preferred by display hardware. Therefore, RGB color value from WebCAM is transferred into HSV color value for the targeted color detection. I found that using HSV colormap is a simple and efficient way to bring the project up into running this week. Here is the HSV colormap (Ref[1]) I used for the project.
I found a piece of color patterned paper at my crafting corner, which could be a good subject for Z7_Color_AID platform to run color detection.
I visualized to select the upper/lower bound of each color space from the HSV colormap as below. I used unsigned int 8 data type for Zynq FPGA. The selected color list is red, green, blue, yellow, orange, and light (light blue).
Z7_Color_AID Phase 1 Project Demonstration
It is the showtime of Z7_Color_AID phase 1 project after previous discussion of the background information.
The initial testing result is not bad at all from above photo since the major defined colors are detected as expected.
Here is the short video of color detection in the real time on Arty-Z7-20 platform.
The Jupyter Notebook code for the presentation is below.
Finally close video/HDMI port as below.
Summary of the phase 1 project:
- OpenCV/PYNQ framework is very handy for computer vision applications. Arty-Z7-20 FPGA has a decent performance for general color detection/contour drawing tasks.
- The initial bench testing result laid a solid foundation for my further work on the same platform
Future Work of Z7_Color_AID Project
- Zynq HW acceleration on Arty-Z7-20 platform
PYNQ_v3.0.1 will need to work with AMD/Xilinx Vitis Accelerated libraries, Vitis Vision libraries, and related dependencies. I am digging related training materials of them now. The gap between PYNQ_v3.0.1 prebuilt image and AMD/Xilinx libraries I mentioned could be very big.
- ML algorithm selection and training machine selection
I am new for ML projects. I did learn a lot from the community here. I tried to use a general PC under Ubuntu 20.04 to run BNN training algorithm last month. It took the PC 130 hours for 500 epochs of BNN training and the error rate was still 20%. I am planning to acquire a GPU card for ML projects now. Hopefully, a GPU card can save me tons of time for ML projects.
- Deploy ML on Arty-Z7-20 platform
Deploy ML on Arty-Z7-20 platform can be very challenging due to smaller size of FPGA and less support for ML applications from AMD/Xilinx. However, due to cheaper price of the part and less power consumption, Zynq FPGA can be a good candidate for many less computing ML applications.
References
[1] HSV color map: https://stackoverflow.com/questions/10948589/choosing-the-correct-upper-and-lower-hsv-boundaries-for-color-detection-withcv
Previous Blogs:
Z7_Color_AID-Blog#01:First Impression of PYNQ on Arty-Z7-20
Z7_Color_AID Blog #2: Reproduce PYNQ Image on Ubuntu 20.04
Z7_Color_AID Blog #3: PYNQ Framework: Library and Overlay
Z7_Color_AID Blog #4: Architecture Discussion of Z7_Color_AID
Z7_Color_AID Blog #5: OpenCV on Zynq FPGA