Detecting and Localizing Pneumonia from Chest X-Ray Scans with PyTorch



Over the years, we have seen very powerful models being built to distinguish between objects. These models keep getting better in terms of performance and latency day by day but have we ever wondered what exactly these models pick up from images used to train them to make practically flawless predictions. There are undoubtedly features in images we feed into these models that they look at to make predictions and that is what we seek to explore in this article. Not long ago, researchers at Stanford university released a paper on how they are using deep learning to push the edge of Pneumonia diagnosis. Their work really got me fascinated so I tried it out in Pytorch and I am going to show you how I implemented this work using a different dataset on Kaggle.

This is a companion discussion topic for the original entry at


This is a very incomplete post, does not have a GitHub link, dont have training, test or eval results, nothing… anyone can write anything, but not everyone can show that what they are posting works…


Hey Oscar,
Sorry for not providing the Github link for this blogpost. Here you go About the training and evaluation metrics, the goal of this project was not to show how to build and fine-tune a model to achieve high evaluation metric values but the actual aim of this post was to demonstrate how to draw Class Activation Maps as proposed by the authors of the paper in Pytorch. If you actually had a hard time figuring out how to build the model and fine-tune it to achieve high evaluation metric values, then you should check out the cool documentation from the Pytorch official website.


Dear Sir,

I’m unable to open your code. Kindly help me.:disappointed_relieved:


@henry_ansah Looks like I can’t view the notebook either (same issue as @Souvik_Neogi)


Hey @Souvik_Neogi @Daniel
Sorry for the inconvenience but this is an issue from the side of Github. As a solution to this issue, I have added a Google Colab link badge to the file so you can open the code in google colab but take note that you’d need to obtain the dataset through your google drive account or you could also use kaggle command line to obtain the dataset (
Kind regards.