Automatic Acceleration Framework for FPGA Implementation of Openvx Vision Algorithms

Automatic Acceleration Framework for FPGA Implementation of Openvx Vision Algorithms

AFFIX: Automatic Acceleration Framework for FPGA Implementation of OpenVX Vision Algorithms Sajjad Taheri1, Payman Behnam2, Eli Bozorgzadeh1, Alexander Veidenbaum1, Alexandru Nicolau1 1Department of Computer Science, UC Irvine 2School of Computing, University of Utah 27th ACM/SIGDA International Symposium on Field-Programmable Gate Arrays FPGA’19 1 / 32 Motivation FPGA’19 2 / 32 FPGAs for Computer Vision Acceleration Computer Vision X Important applications in automation, entertainment, healthcare, etc. × Complex algorithms and demanding workloads FPGAs offer X Inherrent parallelism, high performance, low latency, energy efficiency. Efficient FPGA acceleration requires hardware design expertise and considerable amount of engineering man-hours. FPGA’19 3 / 32 AFFIX Goal FPGA acceleration flow for high level graph-based computer vision algorithms ”Conventional” computer vision algorihtms based on OpenVX specification. Related work include domain specific languages to represent image processing pipeline: e.g., Halide (2016), PolyMage (2016) Application Specification OpenVX Algorithm Design Software Implementation Hardware Implementation Optimization and Code Generation FPGA’19 4 / 32 Our Approach Domain Knowledge Design accelerator architecture by considering image processing kernel behaviors Domain Specific Representation and implementataion Apply algorithm-specific optimizations on the algorithm graphs FPGA Design Methodology Use High Level Synthesis (OpenCL). Portablity Maintainability Apply Hardware specific optimizations FPGA’19 5 / 32 Outline 1 Motivation 2 Customizable library of vision functions 3 AFFIX framework 4 Evaluation 5 Conclusion and future direction FPGA’19 6 / 32 Overview of OpenVX OpenVX Open, royalty-free standard for cross platform acceleration of computer vision applications Performance and power-optimized computer vision processing Graph-based execution model to enable task and data-independent execution FPGA’19 7 / 32 Overview of OpenVX OpenVX defined objects Kernel: Abstract representation of a vision functions, predicates, and delay objects Node: An instance of a kernel Virtual Image: Represents an image Graph: A set of nodes connected in a directed acyclic fashion. OpenVX Node Native camera Downstream control/Data OpenVX Node OpenVX Node Application stored in mem- Processing ory OpenVX Node Graph Construction Graph Verification Graph Execution Graph Deconstruction Graph Lifecycle FPGA’19 8 / 32 Customizable library of vision functions FPGA’19 9 / 32 Vision Function Categorization Vision functions are categorized based on their data access patterns We have implemented streaming kernels for each category in OpenCL Pixel wise Statistics Downsample Stencil Geometric Table Lookup Memory FPGA’19 10 / 32 Vision Function Categorization Kernels from OpenVX Specification 1.2 Category Formal Definition OpenVX Vision Function Pixel-wise out(x, y) = f (in(x, y)) Absolute difference, Accumulate, Accumulate squared, Accumulate weighted, Addition/sub- traction, Bitwise operations, Channel combine, Channel extract, Color convert, Convert bit depth, Magnitude, Phase, Pixel-wise multiplica- tion, Threshold, Min, Max Pi=k Pj=k Fixed-rate Stencil out(x, y) = i=−k j=−k g(in(x + i, y + j)) Box filter, Sobel, Non-maxima suppression, Cus- tom convolution, Erode, Dilate, Gaussian blur, Nonlinear filter, Integral image, Median filter Pi=k Pj=k Multi-rate Stencil out(x, y) = i=−k j=−k g(in(Nx + i, Ny + j)) Down-sample, Scale image Pi=Width Pj=Height Statistical out = i=0 j=0 g(in(i, j)) Histogram, Mean, Standard deviation, Min,max location Geometric out(x, y) = in(h(x, y), h0(x, y)) Remap, Warp affine, warp perspective Table lookup out(x, y) = table[in(x, y)] table lookup Non-primitive N/A Equalize histogram, Fast corners, Harris corners, Gaussian image pyramid, Canny edges, LBP, HOG, HoughLinesP Categorization of Supported OpenVX vision functions FPGA’19 11 / 32 Template-based FPGA Kernel Implementation Templates based on vision function categorization. Easier testing and optimization (5 cases vs 50+ cases) Easier to extend OpenVX with user defined functions Coefficients Coefficients Parameters Computation Memory Computation Coordinates Downstream Result Downstream Result Upstream Geometric (a) Stencil (b) Parameters Computation Computation Lookup table Downstream Downstream Result Result Result Upstream Upstream Upstream Pixel-wise (a) Statistical (c) Table lookup (d) General implementation of different kernel categories FPGA’19 12 / 32 Template-based FPGA Kernel Implementation Kernels can be specialized with Specific compute function (similar to function pointers) Input and output types (OpenCL standard types) SIMD size (1 to 32) Sliding Window size Local memory configuration (banking, etc.) Arithmetic precision (double, float and potentially fixed point) Channels can be specialized with Channel type and width Channel depth FPGA’19 13 / 32 OpenCL Programming Interface A Domain Specific Language (DSL) on top of OpenCL. C-style macros are used to instantiate and specialize generic templates in OpenCL Coefficients Parameters Computation Downstream Result Upstream STENCIL_KERNEL(name, win_size, SIMD_size, kernel_size, in_type, out_type, func, params, in_ch, out_ch) Vision functions such as Gaussian blur, erode, dilate, and box filter can be implemented with this template FPGA’19 14 / 32 OpenCL Programming Interface (Cont’d) C-style macros are used to instantiate and specialize channels in OpenCL as well. Channels are dynamic FIFOs Kernels communicate through channels Example #define SIMD_SZ 8 CHANNEL(ch_con_col, uchar, SIMD_SZ) CHANNEL(ch_thresh, uchar, SIMD_SZ) THRESH(ch_conv_col, SIDM_SZ, thresh_val, ch_thresh) FPGA’19 15 / 32 AFFIX framework FPGA’19 16 / 32 2 Analysises, paritions, and optimizes the algorithm graph 3 Generates code for both FPGA and CPU components OpenVX Kernels Info Lowering Lowered Graph High-level Optimize Optimized Graph Pipelining via Partitioning FPGA pipelines CPU Pipelines OpenCL Library FPGA Implementation Analysis and Optimization Final Graph (OpenCL) OpenCL Compile CPU Implementation FPGA Bitstream AFFIX Plugin Code Generation AFFIX Framework Flow Automatic generation of accelerator systems from input algoritms. 1 Checks input algorihtm Verification Application Model graph for correctness Graph Verification Input graph is represented in a textual format FPGA’19 17 / 32 3 Generates code for both FPGA and CPU components OpenCL Compile CPU Implementation FPGA Bitstream AFFIX Plugin Code Generation AFFIX Framework Flow Automatic generation of accelerator systems from input algoritms. 1 Checks input algorihtm Verification Application Model graph for correctness Graph Verification Input graph is represented in a OpenVX Kernels Info Lowering textual format Lowered Graph 2 Analysises, paritions, and High-level Optimize optimizes the algorithm Optimized Graph Pipelining via graph Partitioning FPGA pipelines CPU Pipelines OpenCL Library FPGA Implementation Analysis and Optimization Final Graph (OpenCL) FPGA’19 17 / 32 AFFIX Framework Flow Automatic generation of accelerator systems from input algoritms. 1 Checks input algorihtm Verification Application Model graph for correctness Graph Verification Input graph is represented in a OpenVX Kernels Info Lowering textual format Lowered Graph 2 Analysises, paritions, and High-level Optimize optimizes the algorithm Optimized Graph Pipelining via graph Partitioning FPGA pipelines CPU Pipelines 3 Generates code for both OpenCL Library FPGA Implementation FPGA and CPU Analysis and Optimization Final Graph (OpenCL) components OpenCL Compile CPU Implementation FPGA Bitstream AFFIX Plugin Code Generation FPGA’19 17 / 32 OpenVX Example: Lane Detection Algorithm Line Segments vxThresholdNode Mask vxHoughLinesPNode Array Edges vxConvolveNode Bird Eye View vxWarpPerspectiveNode vxColorConvertNode RGB Image YUV Image vxChannelExtractNode Y Image (RGB-to-YUV) OpenVX Graph Algorithm Input image Grayscale image b_image f _image t_image Highlighted lanes Lane Detection Algorithm Demonstration (Input video obtained from software.intel.com) FPGA’19 18 / 32 High-Level Analysis and Optimization Simplify and optimize OpenVX graphs Decomposition of OpenVX vision functions into simpler primitives Removal of nodes that are not connected to an output node Separable and symmetric 2D filter implementation More steps can be incorporated... Line Segments vxThresholdNode Mask vxHoughLinesPNode Array Edges vxConvolveNode Bird Eye View vxWarpPerspectiveNode vxColorConvertNode RGB Image YUV Image vxChannelExtractNode Y Image (RGB-to-YUV) Step 1: Input Lange Detection Algorithm Graph. FPGA’19 19 / 32 High-Level Analysis and Optimization Simplify and optimize OpenVX graphs Decomposition of OpenVX vision functions into simpler primitives Removal of nodes that are not connected to an output node Separable and symmetric 2D filter implementation More steps can be incorporated... RGB-to-U U Image Threshold Mask Image HoughLinesP Line Segments Array RGB-to-V V Image Edges Image Convolve Warped Image RGB Image RGB-to-Y Y Image Channel Extract Extracted Image warpPerspective Step 2: Lowered Lane Detection Algorithm. RGB-to-YUV node is replaced with RGB2Y, RGB2U, and RGB2V nodes. Channel extract node drops U and V images. FPGA’19 19 / 32 High-Level Analysis and Optimization Simplify and optimize OpenVX graphs Decomposition of OpenVX vision functions into simpler primitives Removal of nodes that are not connected to an output node Separable and symmetric 2D filter implementation More steps can be incorporated..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    37 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us