YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
Lung Cancer CNN Model
A TensorFlow CNN model to classify chest CT images as Normal or Lung Cancer (~96% accuracy).
Dataset
- IQ-OTH/NCCD Lung Cancer Dataset
- Input: 256x256 grayscale images
- Classes: Normal, Lung Cancer
Usage
- Model: SavedModel format (
lung_cancer_cnn_saved_model.zip) - Inference: Use
handler.pyfor API endpoints - Accuracy: ~96%
Local Inference
import tensorflow as tf
import numpy as np
import cv2
model = tf.saved_model.load("lung_cancer_cnn_saved_model")
infer = model.signatures['serving_default']
class_names = ['Normal', 'Lung Cancer']
def predict(image_path):
img = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
img = cv2.resize(img, (256, 256)) / 255.0
img = img.reshape(1, 256, 256, 1).astype(np.float32)
input_key = list(infer.structured_input_signature[1].keys())[0]
outputs = infer(**{input_key: tf.convert_to_tensor(img)})
output_key = list(outputs.keys())[0]
pred = outputs[output_key].numpy()[0][0]
class_id = 1 if pred > 0.5 else 0
confidence = pred if class_id == 1 else 1 - pred
return class_names[class_id], confidence
result, confidence = predict("path/to/ct.jpg")
print(f"Prediction: {result}, Confidence: {confidence:.4f}")
Disclaimer
For educational use only. Consult healthcare professionals.
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support