| --- |
| license: cc-by-4.0 |
| datasets: |
| - InfoBayAI/ct_scan_clinical_reports_with_findings_medical_nlp |
| - InfoBayAI/ct_scan_clinical_reports_without_findings_medical_nlp |
| language: |
| - en |
| metrics: |
| - accuracy |
| pipeline_tag: image-classification |
| tags: |
| - restnet18 |
| - image_classification |
| - medical_image |
| --- |
| # CT Scan Pathology Classification Model (ResNet18) |
|
|
| ## Model Description |
| This model is a deep learning–based CT scan pathology classification system built using a ResNet18 architecture and trained on medical imaging data provided by [InfoBay.AI](https://huggingface.co/datasets/InfoBayAI/ct_scan_clinical_reports_with_findings_medical_nlp). |
|
|
| The training pipeline processes CT scan images from multiple organ regions, applies preprocessing and normalization, and trains a convolutional neural network to classify scans into predefined disease categories. |
|
|
| This approach demonstrates how structured CT imaging data can be leveraged to build efficient medical image classification systems for research and automation tasks. |
|
|
| --- |
| ### 3D Visualization of CT-Scan |
|
|
|
|
|  |
|
|
| --- |
| ## Training Pipeline |
|
|
| The complete pipeline used for training is as follows: |
|
|
| Raw CT Images → DICOM Processing → Image Normalization → Dataset Labeling → ResNet18 Training |
|
|
| - Data Source: CT scan datasets (multi-organ pathology cases) |
| - Preprocessing: DICOM decoding, pixel normalization, resizing (224×224), RGB conversion |
| - Normalization: Min-max scaling to [0, 1] |
| - Labeling: Patient-level disease classification |
| - Model Training: ResNet18 for multi-class classification |
|
|
| --- |
|
|
| ## Key Insight |
|
|
| This model demonstrates that even a relatively small dataset of CT images can be used to train an effective deep learning classifier. |
|
|
| It validates the ability of structured CT datasets to support: |
|
|
| - Medical image pathology classification |
| - Automated dataset structuring |
| - Preprocessing pipelines for radiology AI |
| - Computer vision applications in healthcare |
|
|
| --- |
|
|
|
|
| ## Dataset Split |
|
|
| - Train/Test Split: 80% / 20% |
| - Split Strategy: Random sampling |
| - Number of Classes: 4 |
|
|
| --- |
|
|
|
|
| ## Training Hyperparameters |
|
|
| - Number of Epochs: 10 |
| - Batch Size: 8 |
| - Learning Rate: 1e-4 |
| - Optimizer: Adam |
| - Loss Function: Cross-Entropy Loss |
| - Input Size: 224 × 224 |
|
|
| --- |
|
|
| ## Model Performance |
|
|
| The model demonstrates stable performance on internal validation data: |
|
|
| - Accuracy: ~90%-95% (depends on data distribution) |
|
|
| --- |
|
|
| ## Classification Labels |
|
|
| | Class ID | Label | |
| |----------|---------------------| |
| | 0 | Hydropneumothorax | |
| | 1 | Brain Gliosis | |
| | 2 | Liver Cirrhosis | |
| | 3 | Liver Abscess | |
|
|
| --- |
|
|
| ## Usage |
|
|
| ### Install Dependencies |
|
|
| ```bash |
| pip install torch torchvision pillow numpy pydicom |
| ``` |
|
|
| ```python |
| import torch |
| import torchvision.models as models |
| import torch.nn as nn |
| import json |
| from PIL import Image |
| import numpy as np |
| |
| # Load labels |
| with open("labels.json") as f: |
| labels = json.load(f) |
| |
| labels = {int(k): v for k, v in labels.items()} |
| |
| # Recreate model |
| model = models.resnet18(pretrained=False) |
| |
| model.fc = nn.Sequential( |
| nn.Linear(model.fc.in_features, 256), |
| nn.ReLU(), |
| nn.Dropout(0.4), |
| nn.Linear(256, len(labels)) |
| ) |
| |
| # Load weights |
| model.load_state_dict(torch.load("pytorch_model.bin", map_location="cpu")) |
| model.eval() |
| |
| # Preprocess |
| def preprocess(image_path): |
| img = Image.open(image_path).convert("RGB") |
| img = img.resize((224, 224)) |
| img = np.array(img) / 255.0 |
| img = torch.tensor(img).permute(2, 0, 1).unsqueeze(0).float() |
| return img |
| |
| # Predict |
| img = preprocess("test_image.png") |
| |
| with torch.no_grad(): |
| output = model(img) |
| probs = torch.softmax(output, dim=1) |
| pred = torch.argmax(probs, 1).item() |
| |
| print("Prediction:", labels[pred]) |
| |
| ``` |
| --- |
|
|
| ### Considerations |
|
|
| This model is trained on a CT image dataset of InfoBay.AI and is intended for research and evaluation purposes only. |
|
|
| For access to the full dataset or enterprise licensing inquiries, please contact [InfoBay.AI](https://infobay.ai/). |
|
|
| Ph: +91 8303174762 |
| Email: datareq@infobay.ai |
| |