Computer Vision in ArrayFire – Part 1: Feature Detection

Peter Entschev ArrayFire, Computer Vision 6 Comments

A few weeks ago we wrote Writing a Simple Corner Detector with ArrayFire. In that post, we discussed a little bit about the new features that we are working on for ArrayFire. Some of these new computer vision features will be available in the next release of ArrayFire.

For the next release, ArrayFire will have a complete set to start with feature tracking, including FAST for feature detection [1], ORB for description [2] and a Hamming distance matcher. We will also include a dedicated version of the Harris corner detector [3], even though it can be written using existing ArrayFire functions. This implementation is straightforward, easy to use and will have better performance.

For this post, we will share some of our current benchmarks for Harris corner detector and FAST feature detector. We compare the performance of our implementation of these functions against the same functions in OpenCV, which is currently one of the best code references for computer vision.

The results shown below were all generated with an Intel Sandy Bridge Xeon processor with 32 cores for OpenCV CPU implementation and an NVIDIA Tesla K20C GPU for OpenCV CUDA and ArrayFire CUDA implementations.

Software used for benchmarking included ArrayFire development version and OpenCV 2.4.9 with SSE and CUDA support.

Feature Detection Benchmarks

We first start with some benchmarks of the Harris corner detector. The run times for OpenCV’s CUDA implementation at larger sizes are not included because it runs out of memory at larger image sizes. Note that the horizontal axes of all graphs are in logarithmic scale.

The following graphs depict the speedup of ArrayFire CUDA and OpenCV CUDA implementations over OpenCV CPU implementation.

The horizontal axis for Harris detector is the number of pixels, while that of FAST detector is number of features detected. This was done because the Harris score is calculated for all the pixels before eliminating the pixels whose score falls below a certain threshold. The score for FAST features are detected by progressively eliminating pixels that do not fit various criteria. The FAST scores are only calculated once the features have been detected. This results in the time taken for Harris to scale with the number of pixels, while the times taken for FAST scales with the number of features detected.

Feature Detection Samples

In this section, we show the images with the detected features plotted on them for both ArrayFire and OpenCV. There are many variables that influence the results, including among others, rounding and empirically defined constants. For these reasons, we can not expect two implementations to be perfectly equal to each other. Even though ArrayFire and OpenCV implementations do not give the exact same results, they provide features that are very similar.

The following set of images include samples for the Harris corner detector with ArrayFire, immediately followed by OpenCV.

 

ArrayFire Harris
OpenCV Harris

The following images show the similarities in the FAST implementations, first with ArrayFire followed by OpenCV.

ArrayFire FAST

OpenCV FAST

Discussion

By looking at the previous graphs, the advantage of using GPUs for computer vision applications over CPUs is made very clear. For the Harris detector, ArrayFire is at least 16 times faster than the CPU implementation. For the FAST feature detector, ArrayFire is 3-5 times faster for a smaller number of features, but is 8-10 times faster when the number of features requested is higher.

Comparing OpenCV’s CUDA implementation, we see that in almost all cases we are already at least as good as better. For Harris detector, ArrayFire is 4 times faster than OpenCV’s GPU implementation at smaller sizes before evening out. At larger sizes OpenCV CUDA implementation runs out of GPU memory and fails to detect any features.

For FAST, ArrayFire is up to 3 times faster than OpenCV’s CUDA implementation. ArrayFire is consistently at least 2 times faster and is slower for only one image.

However, this is not yet the final version, we are still working on improving performance. We can assure that these numbers will be even more impressive when we release these algorithms to the public.

If you can not wait until the release and want to get a taste of what is coming, please, contact us at sales@arrayfire.com, we will be happy to discuss on how you can get the latest features of ArrayFire before the release!

Stay tuned for the upcoming news on our new set of computer vision functions.

References

[1] Rosten, Edward, and Tom Drummond. “Machine learning for high-speed corner detection.” Computer Vision–ECCV 2006. Springer Berlin Heidelberg, 2006. 430-443.
[2] Rublee, Ethan, et al. “ORB: an efficient alternative to SIFT or SURF.” Computer Vision (ICCV), 2011 IEEE International Conference on. IEEE, 2011.
[3] Harris, Chris, and Mike Stephens. “A combined corner and edge detector.” Alvey vision conference. Vol. 15. 1988.

Comments 6

  1. I had read this blog yesterday and shared it to some of friends who are dedicated to computing vision. We are surprised that ArrayFire is faster than OpenCV CUDA. We ara looking forward these functions in the new version of ArrayFire. BTW, does ArrayFire support FPGA ?

    1. Hi sisiy!
      Yes, we are working on adding FPGA support for ArrayFire in the near future, but we do not have a specific date yet. Please, let us know more about your interest in FPGA support by sending us an email at sales@arrayfire.com, we will be happy to answer all your questions.

      1. Sounds great!I just noted that many users are hesitant to choose between FPGA with GPU embedded development board like Jeton TK1. So I wonder if ArrayFire support FPGA, Jetson,and other board… it will be helpful for these users, they will not worry about the development board any more

  2. Pingback: Computer Vision in ArrayFire – Part 2: Feature Description and Matching | ArrayFire

  3. Pingback: New Features Coming To ArrayFire | ArrayFire

  4. Pingback: The ArrayFire Blog’s Best of 2014 | ArrayFire

Leave a Reply

Your email address will not be published.