Project
Pneumonia Detection on Raspberry Pi
First and corresponding author · May – Nov 2025
Overview
The primary goal of the study was to evaluate performance of convolutional neural networks (CNNs) for pnuemonia detection of chest x-ray images. Specifically, we wanted to do so in the context of under-resourced hospitals, so we optimized for low inference latency and model size, while aiming for high accuracies, F1 scores, recall, etc.
Dataset and preprocessing
We used the Pnuemonia MNIST dataset with 5,586 grayscale chest x-ray images. We chose the 64 x 64 pixel version of the dataset to simulate the low quality images that some hospitals may have to work with. The testing split was held off until final evaluation.
The dataset was imbalanced, which resulted in prediction leaning towards the majority class. To address this, we artifically added images to the minority class. We did so by augmenting the images, with cropping, random rotations, flips, contrast adjustments, and noise. We then normalize the pixel values to the 0 - 1 range again. Throughout the research, a fixed random seed was used to try and improve the reproducibility of results.
The paper illustrates the classes with higher-resolution versions of the images. The models used the 64 × 64 versions.
Model design
In total we evaluated 12 CNNs, a combination of custom built ones and transfer learning ones. Each model has a corresponding model of its quantized version. See below for the diagram of the custom CNN architecture and hyperparameter tuning choices.
Raspberry Pi deployment
We benchmarked inference on a Raspberry Pi 5 with 16 GB of RAM and a 2.4 GHz quad-core Arm Cortex-A76 CPU. The study reports average model inference latency.
Study results
The default TensorFlow quantization we used kept the same accuracy and metrics as the original model but resulted in reduced model size. See below for specific details.
| Model | Accuracy | Pneumonia recall | Size | Avg. latency |
|---|---|---|---|---|
| Laptop CNN | 95% | 97% | 4.83 MB | 1.71 ms |
| P100 CNN | 94% | 97% | 1.45 MB | 1.46 ms |
| T4 CNN | 91% | 98% | 1.45 MB | 1.46 ms |
Limitations
While we used low compute (Raspberry Pi) for inference, training was done on a GPU. It is possible that in some cases hospitals might not have access to the GPU or trained model.
Publication
Andy L. Chen, Eric Cheek, and Morteza Sarmadi. Cureus 17(11), e97959. Published Nov 27, 2025.
Read the full paper on PubMed Central · DOI: 10.7759/cureus.97959
Figures 1, 2, 3, and 5 reproduced from Chen et al. (2025) under CC BY 4.0.