This week you'll learn about Attending to Channels Using Keras and TensorFlow.

Image

If you are a seasoned deep learning practitioner, let me take you through a trip down memory lane. You have just learned how to build a simple neural network. You are waiting to run the model.fit function. Your anxiety is sky high. 

Source

  After a nervous shift+enter, you see the golden words epoch 1 appear. Your code has worked. You bask in the fact that you are now a deep learning practitioner.

But wait.

What dataset did you use? I can confidently predict that it was the MNIST digit dataset. A collection of handwritten digits in black and white. But what's the moral of the story? 

The point I want to draw your attention to is that those images were single-channel images. There were no red, blue, or green separations. That means the spatial (height and width) composition had good enough patterns for your little network to differentiate the images according to their classes and reach sky-high accuracies. 

Even if you shift to a more complex convolutional neural network (CNN), your intuition would be to believe that spatial information encoded in image data is more important than channel-wise data. 

Today, we will take a different approach, focusing on making the model emphasize the channel-wise features, using the Squeeze-and-Excitation (SE) module. 

The big picture: Using the SE module, we built an attachment for standard CNNs, which can help them attend to the channel-wise information so that it can assign importance to individual channels. 

How it works: This is achieved using the SE module. The global channel information is condensed into a single vector and passed through a simple neural network. The output is a weighted value for each channel, signifying each of their importance. 

Our thoughts: The results have clearly improved over the vanilla CNNs. Intuitively, we are giving another little power-up to the model's capabilities to extract important features. 

Yes, but: The SE module does add computational depth to your model. So the tradeoff of higher accuracy is that your model will train for a slightly longer period. 

Stay smart: Definitely try this out on different datasets to see how more emphasis on channels affects the results!

Click here to read the full tutorial

Solve Your CV/DL problem this week (or weekend) with our Working Code

You can instantly access all of the code for Attending to Channels Using Keras and TensorFlow by joining PyImageSearch University. Get working code to

  • Finish your project this weekend with our code
  • Solve your thorniest coding problems at work this week to show off your expertise
  • Publish groundbreaking research without multiple tries at coding the hard parts

Guaranteed Results: If you haven't accomplished your CV/DL goals, let us know within 30 days and get a full refund.

I want the code


The PyImageSearch Team


P.S. If you're interested in learning how to successfully apply deep learning to your own projects, I would recommend reading my book, Deep Learning for Computer Vision with Python.

Inside the book you'll find:
  • Super-practical walkthroughs that present solutions to actual real-world image classification (ResNet, VGG, etc.), object detection (Faster R-CNN, SSDs, RetinaNet, etc.), and segmentation (Mask R-CNN) problems
  • Hands on tutorials (with lots of code) that show you not only the algorithms behind deep learning for computer vision but their implementations as well.
  • A no-nonsense teaching style that is guaranteed to help you master deep learning for image understanding and visual recognition
If you're interested in learning more about the book, I'd be happy to send you a PDF containing the Table of Contents and a few sample chapters:

Click here to grab the PDF of sample chapters and Table of Contents

After clicking the above link, you'll receive a separate email with the PDF in a few short moments.