🫁 Pediatric Chest Pneumonia Classification:
Leveraging Traditional CNN with GAN for Data Balancing

1Department of Computer Science, University
Medical AI & Healthcare Technology (2024)

Abstract

This research presents an innovative approach to pediatric chest pneumonia classification using deep learning techniques combined with Generative Adversarial Networks (GANs) for addressing class imbalance in medical imaging datasets. We address the critical challenge of limited and imbalanced medical data by employing GANs for synthetic data generation, combined with traditional data augmentation methods. Our methodology demonstrates significant improvements in classification accuracy and model robustness for pneumonia detection in pediatric chest X-rays.

Through systematic experiments across four different data balancing strategies, we demonstrate that the combined approach (augmentation + GAN generation) achieves 87.18% accuracy, outperforming baseline methods and establishing a new benchmark for pediatric pneumonia classification.

System Demo

Interactive Web Application: Real-time chest X-ray classification with probability scores

Problem Statement

Clinical Challenge: Pneumonia is a leading cause of mortality in children under 5 years globally. Early and accurate diagnosis through chest X-ray analysis is crucial for effective treatment.

Technical Challenge: Medical imaging datasets often suffer from class imbalance, where normal cases significantly outnumber pneumonia cases, leading to biased model performance.

Our Solution: We address these challenges using a novel combination of CNN architecture with GAN-based synthetic data generation and traditional augmentation techniques.

Methodology

Our Approach:

1. Data Preprocessing
  • Image resizing to 148×148 pixels
  • Grayscale conversion
  • Pixel normalization [0,1]
2. GAN-based Generation
  • DCGAN architecture
  • 40,000 training iterations
  • 2,534 synthetic normal X-rays
3. Data Augmentation
  • Rotation (±35°)
  • Width/Height shifts
  • Shear & Zoom transforms
4. CNN Classification
  • Optimized architecture
  • Batch normalization
  • Binary classification
TensorFlow/Keras OpenCV NumPy Flask DCGAN CNN Python

Experimental Results

Key Finding: Our combined approach (traditional augmentation + GAN generation) achieved the highest performance with 87.18% accuracy, demonstrating the effectiveness of hybrid data balancing strategies in medical imaging.

Experiment Data Strategy Accuracy Precision Recall F1-Score
Baseline Original Imbalanced 85.26% 0.85 0.85 0.85
Augmentation Traditional Augmentation 86.06% 0.86 0.86 0.86
GAN Generation Synthetic Data Only 84.78% 0.85 0.85 0.85
Combined Augmentation + GAN 87.18% 0.87 0.87 0.87

Key Insights:

  • Data Balancing Effectiveness: Combined approach achieved highest accuracy
  • GAN Quality: Generated images maintained realistic chest X-ray characteristics
  • Model Robustness: Balanced datasets showed improved generalization
  • Clinical Relevance: High recall for pneumonia detection (87%)

Model Architecture

CNN Architecture:

model = Sequential([
    Conv2D(32, (3, 3), input_shape=(148, 148, 1), activation='relu'),
    MaxPooling2D(pool_size=(2, 2)),
    BatchNormalization(),
    Conv2D(64, (3, 3), activation='relu'),
    MaxPooling2D(pool_size=(2, 2)),
    Flatten(),
    Dense(1, activation='sigmoid')
])

# Hyperparameters:
# - Optimizer: Adam
# - Loss: Binary Crossentropy
# - Image Size: 148×148
# - Batch Size: 132
# - Epochs: 15-50
                
🧠 Generator Network

4-layer transposed convolution network for synthetic X-ray generation

🔍 Discriminator Network

4-layer convolution network for authentic vs synthetic classification

⚡ Training Process

40,000 iterations with RMSprop optimizer and adversarial loss

📊 Output Quality

High-quality 148×148 synthetic chest X-ray images

🩺 Try the Model

Interactive Pneumonia Detection Demo

Upload a pediatric chest X-ray image directly to our live model hosted on Hugging Face Spaces

🚀 Open Live Demo in New Tab

Click the button above to access the interactive model demo

📝 Note: If the embedded demo above doesn't load properly, please use the "Open Live Demo in New Tab" button to access the full application.

💡 How to Use:
  1. Upload Image: Click the upload area and select a chest X-ray image
  2. Analyze: The model will automatically process your image
  3. View Results: Get instant classification results with probability scores
  4. Medical Note: Results are for research purposes only - consult medical professionals for diagnosis
📊 Model Performance

Accuracy: 87.18%

Precision: 0.87

Recall: 0.87

⚙️ Technical Specs

Input Size: 148×148 pixels

Architecture: CNN + GAN

Framework: TensorFlow/Keras

Dataset Information

📊 Dataset Statistics:

Total Images

5,863 chest X-rays

Training Set

5,216 images

Test Set

624 images

Classes

Normal vs Pneumonia

Source: Kaggle Chest X-Ray Pneumonia Dataset

Class Distribution: The dataset exhibits class imbalance with more pneumonia cases than normal cases, making it an ideal testbed for our GAN-based balancing approach.

Future Directions

🔬 Multi-class Classification

Extend to different types of pneumonia and lung conditions

🏗️ Advanced Architectures

Implement ResNet, DenseNet, or Vision Transformers

🔐 Federated Learning

Enable privacy-preserving collaborative training

📱 Mobile Deployment

Optimize for real-time mobile medical applications

🏥 Clinical Validation

Collaborate with medical institutions for validation

🤖 Explainable AI

Implement attention mechanisms for decision transparency

Project Information

🔗 Links

Live Demo: Hugging Face Space

Web App: PythonAnywhere Deployment

Code Repository: GitHub

📧 Contact

Authors: Abdul Manaf, Nimra Mughal

Institution: Department of Computer Science

Research Area: Medical AI & Deep Learning

Status: Under Review

This research contributes to the advancement of AI-assisted medical diagnosis, specifically addressing the critical need for accurate pediatric pneumonia detection.