Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 1.18 KB

File metadata and controls

47 lines (30 loc) · 1.18 KB

Necro Net

Classifying pancreatic adenocarcinoma (PAAD) from histology slides is hard — limited labeled data, high class imbalance, and no clear winner between CNN and transformer architectures for this domain. This repo benchmarks ResNet50 against a Vision Transformer (ViT) on real PAAD histopathology images to find out which generalizes better under those constraints.

ResNet50

The ResNet50 trainer lives in ResNet50/raj_data_paad/. It uses class-balanced loss, early stopping, and learning rate scheduling. The best model is exported to ONNX and TorchScript.

Configure paths and hyperparameters in config.json, then run:

cd ResNet50/raj_data_paad
uv run train_classify.py

Vision Transformer (ViT)

The ViT trainer is in ViT/. It defaults to CPU-optimized settings (70 threads) but works on GPU too.

cd ViT
uv run train_raj_vit.py --epochs 8 --batch_size 16 --output_dir models

Override defaults as needed:

uv run train_raj_vit.py --epochs 20 --patience 5 --cpu_threads 72 --num_workers 20

Setup

CPU:

uv sync --project pyproject_cpu.toml

GPU (CUDA):

uv sync --project pyproject_gpu.toml

Requires Python 3.10+.