Downloads · 30 days
0
ankon1/oral-cancer-classifer
oral-cancer-classifer is a machine learning model from ankon1. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Jan 21, 2026
Repo size
477 MB
Likes
0
Public
Click a slice to open those files.
.safetensors343 MB · 72%
From the Hugging Face model README
ankon1/oral-cancer-classifer
A comprehensive deep learning system for classifying oral cancer images from clinical and histopathological samples. Combines multiple state-of-the-art architectures including Vision Transformers (ViT) and convolutional neural networks (ResNet50, DenseNet121, InceptionV3, VGG16) to detect cancerous tissue in oral cavity images. Processes both clinical photographs and microscopic histopathological images, achieving 95.7% accuracy on independent test data with built-in explainability features using LIME and SHAP.
Primary Use: Classification of oral tissue images as cancerous or non-cancerous for research and educational purposes
Research Applications:
Educational Tool: Assisting dental/medical students in oral lesion identification
Screening Assistance: Preliminary screening in telemedicine applications (requires clinical validation)
Important: This model is NOT for direct clinical diagnosis without FDA/regulatory approval and should not replace professional medical consultation.
# Install required packages
pip install transformers torch tensorflow pillow numpy
# Basic inference example
from transformers import AutoModelForImageClassification, AutoFeatureExtractor
import torch
from PIL import Image
# Load model and feature extractor
model = AutoModelForImageClassification.from_pretrained(
"[Your-Username]/oral-cancer-classifier",
trust_remote_code=True
)
feature_extractor = AutoFeatureExtractor.from_pretrained(
"[Your-Username]/oral-cancer-classifier"
)
# Load and preprocess image
image = Image.open("oral_tissue_sample.jpg").convert("RGB")
inputs = feature_extractor(images=image, return_tensors="pt")
# Make prediction
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_class = torch.argmax(logits, dim=1).item()
# Interpret results
if predicted_class == 1:
print("⚠️ Cancer detected - Please consult a healthcare professional")
else:
print("✅ Non-cancerous tissue detected")
# Get confidence scores
probabilities = torch.nn.functional.softmax(logits, dim=1)
print(f"Cancer: {probabilities[0][1]:.2%}, Non-Cancer: {probabilities[0][0]:.2%}")
# Test with a sample image URL
import requests
from io import BytesIO
# Download sample oral image
url = "https://example.com/sample_oral_image.jpg"
response = requests.get(url)
image = Image.open(BytesIO(response.content))
# Process and predict
inputs = feature_extractor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
prediction = torch.argmax(outputs.logits, dim=1).item()
print(f"Prediction: {'Cancer' if prediction == 1 else 'Non-Cancer'}")