🦴 Knee Osteoarthritis X-ray Classifier

This model classifies grayscale knee X-ray images into 5 severity classes:

  • Normal
  • Doubtful
  • Mild
  • Moderate
  • Severe

πŸ“Š Model Details

  • Model: CNN built with Keras
  • Input shape: (162, 300, 1)
  • Preprocessing: Grayscale conversion, resizing, internal normalization (Rescaling(1./255))
  • Data Augmentation: Flip, rotation, zoom
  • Output: Softmax probability over 5 classes

🧾 Dataset Description

This model was trained on the Digital Knee X-ray Images dataset available on Kaggle. The dataset contains labeled grayscale knee X-ray images categorized into:

  1. Normal
  2. Doubtful
  3. Mild
  4. Moderate
  5. Severe

These categories represent the Kellgren and Lawrence grading system for osteoarthritis severity. The images are organized into corresponding folders and include both healthy and osteoarthritic knee conditions.

Link to dataset: Digital Knee X-ray Images (Kaggle)

πŸ“ˆ Training Summary

  • Epochs: 100 with early stopping (83)
  • Optimizer: Adam
  • Loss: Sparse Categorical Crossentropy
  • Metric: F1 Score

πŸš€ Usage

from keras.models import load_model
model = load_model("knee_oa_classifier.keras")

# Preprocess and predict (image should be (162, 300, 1) when using a url to an image
response = requests.get(url)
img = Image.open(BytesIO(response.content))
img = img.convert('L').resize((162, 300))
display(img)
img_array = np.array(img) 
img_array = img_array.reshape((1, 162, 300, 1))  # Add batch and channel dimensions

pred_probs = model.predict(img_array)
pred_class_index = np.argmax(pred_probs)
pred_class_label = train_ds.class_names[pred_class_index]

for pred_prob in pred_probs:
    for i, class_name in enumerate(train_ds.class_names):
        display(f'{class_name} -> {pred_prob[i]*100}')
    display('')

πŸ–Ό Example Prediction

Image link

Class probabilities:

  • 0Normal -> 0.0
  • 1Doubtful -> 0.0
  • 2Mild -> 100.0
  • 3Moderate -> 0.0
  • 4Severe -> 0.0
Downloads last month
17
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support