Repository navigation
Model Weights — v2.0.0
Trained models for the study: Comparing Fixed Size vs. Progressive Resizing training strategies using EfficientNetB4 for bacterial vs. viral pneumonia classification.
Downloads
| File | Size | Format | Use Case |
|---|---|---|---|
fixed_size_model.weights.h5 |
~76 MB | Weights-only HDF5 | ✅ Recommended — load with architecture script |
progressive_model.weights.h5 |
~76 MB | Weights-only HDF5 | ✅ Recommended — load with architecture script |
fixed_size_model.keras |
~317 MB | Full Keras SavedModel | Research / retraining only |
progressive_model.keras |
~317 MB | Full Keras SavedModel | Research / retraining only |
Performance
| Model | Test Accuracy | ROC AUC | FNR Viral |
|---|---|---|---|
| Fixed Size (384×384) | 86.92% | 0.9198 | 32.4% |
| Progressive Resizing (224→256→384) | 78.46% | 0.8011 | 47.3% |
390-image test set (242 bacterial, 148 viral) with 2-pass TTA.
Quick Start (weights-only)
\\python
import tensorflow as tf, numpy as np
from PIL import Image
def build_model(img_size=384):
tf.keras.mixed_precision.set_global_policy('float32')
inputs = tf.keras.Input(shape=(img_size, img_size, 3))
backbone = tf.keras.applications.EfficientNetB4(
include_top=False, weights=None, input_tensor=inputs)
gap = tf.keras.layers.GlobalAveragePooling2D()(backbone.output)
gmp = tf.keras.layers.GlobalMaxPooling2D()(backbone.output)
x = tf.keras.layers.Concatenate()([gap, gmp])
x = tf.keras.layers.Dense(512, activation='swish')(x)
x = tf.keras.layers.BatchNormalization()(x)
x = tf.keras.layers.Dropout(0.5)(x)
out = tf.keras.layers.Dense(2, activation='softmax')(x)
return tf.keras.Model(inputs, out)
model = build_model()
model.load_weights('fixed_size_model.weights.h5')
img = np.array(Image.open('xray.jpg').resize((384, 384))) / 255.0
pred = model(img[np.newaxis].astype('float32'), training=False).numpy()[0]
print(f'Bacterial: {pred[0]:.3f} Viral: {pred[1]:.3f}')
\\
See \models/README.md\ for full documentation.