Hi,

This week you'll learn about Improving Text Detection Speed with OpenCV and GPUs.

Image

OpenCV has always been the go-to tool for us when it comes to image processing. From basic image loading functionalities to contour approximations, OpenCV's utility functions cover a huge area. Undeniably, it's one of the best computer vision libraries out there. 

But many of us still don't know that OpenCV hosts its own module for deep learning (DL) inference functionalities, known as the OpenCV DNN (Deep Neural Networks) module. While it only supports deep learning inference on images and videos, its fast inference time makes it a great choice for beginners to play around with different models. 

The best part is that it supports the loading of several models from various frameworks, allowing us to perform a variety of deep learning functions.

In many cases, OpenCV's DNN module outperforms the standard machine learning frameworks in terms of inference time. With the added functionality of loading models from different frameworks, this module definitely becomes an allrounder. Now, can this inference time be even faster if performed on a GPU?

A GPU is conventionally thought to be faster than a CPU at performing complex mathematical computations due to having more logic cores. They have been steadily taking over as the standard computation unit in the world of Deep Learning. 

This brings us to today's tutorial, Improving Text Detection Speed with OpenCV and GPUs, where we teach you how to make your inference time even shorter by using OpenCV DNN on a GPU. 

The big picture: Many times, we fail to realize the potential of our GPU in boosting our DL tasks. Utilizing your GPU, added with OpenCV's DNN module, results in the extremely fast inference of your images and videos. 

How it works: OpenCV's DNN module has been made solely for the purpose of inference. Since all its emphasis is on inference, it stands out in terms of processing speed. Additionally, using a GPU naturally makes computations faster since a GPU contains more CUDA computation cores than a CPU. Hence, running OpenCV's DNN on a GPU naturally reduces the inference time. 

Our thoughts: For beginners, this is a great way to get into Deep Learning in general. You can test out different models using the DNN module to get a gist about them.

Yes, but: The prerequisite for this tutorial is compiling the OpenCV DNN module along with GPU support, which can get a bit frustrating for beginners. Additionally, OpenCV's DNN module doesn't support model training and fine-tuning, so it only helps scratch the surface of the topics you're working on. 

Stay smart: Do not stop at just inference, or there will be gaps in your understanding of topics. Additionally, setting up for this tutorial can also be your gateway into learning more about CUDA computing, which is rising to be an integral topic in today's Deep Learning world. 

Click here to read the full tutorial

PyImageSearch University

This lesson is part of PyImageSearch University, our flagship program to help you master computer vision, deep learning, and OpenCV.  PyImageSearch University is updated each week with new lessons.

Don't spend your time trying to piece together code when you could get pristine code right now.  Want the full, working code of every blog post plus a Colab Notebook and video walkthrough of the code?

I want the code

Having problems with your local development environment or IDE?  Fortunately, our pre-configured Colab Notebooks allow you to run code the moment you join PyImageSearch University.  But, of course, you don't want to be a sys-admin, so don't waste time messing with your development environment.  

Want to Master Computer Vision and Deep Learning?

Do you think mastering computer vision and deep learning has to be time-consuming, overwhelming, and complicated? Or has to involve complex mathematics and equations? Or requires a degree in computer science?

That's not the case. All you need to master computer vision and deep learning is for someone to explain things to you in simple, intuitive terms. And that's exactly what we do. Our mission is to change education and how complex Artificial Intelligence topics are taught.

Inside PyImageSearch University, you'll find:

  • Code that works for almost any OpenCV or TensorFlow CV problem
  • 35+ courses on the hottest computer vision, deep learning, and OpenCV topics
  • 35+ Certificates of Completion (one for each course)
  • 39+ hours of on-demand video
  • Pre-configured Jupyter Notebooks running in Google Colab
  • Run all code examples in your web browser — works on Windows, macOS, and Linux (no dev environment configuration required!)
  • Access to centralized code repos for all 500+ tutorials on the PyImageSearch blog
  • Easy one-click downloads for code, datasets, pre-trained models, etc.
  • Access on mobile, laptop, desktop, etc.
  • New courses released regularly and new tutorials weekly, ensuring you can keep up with state-of-the-art techniques

Click here to join PyImageSearch University


The PyImageSearch Team