ResNet-18 Tensor-Train
model compression for dysplasia grading
2 min readupdated
This model is a compressed version of PyTorch-based ResNet-18, featuring 3x3 convolutional kernels decomposed using the Tensor-Train format. It is trained to grade the severity of oral epithelial dysplasia on the OralEpitheliumDB dataset. The main feature of this method is that reducing the parameter count does not decrease the computational volume (GFLOPs): the kernels are reassembled on each forward pass, which cuts memory requirements while increasing latency. The model is intended for research and educational tasks in medical image analysis.
Key features
- Significant parameter reduction (down to 4.60 M compared to 11.18 M for the baseline).
- Preservation of computational complexity (GFLOPs remained at 3.63).
- Use of the Tensor-Train method with four cores per single convolutional kernel.
- Efficiency comparison with alternatives such as the Tucker-2 model.
What you can do
- Apply the model for tissue histological image analysis and classification in research projects.
- Conduct experiments to evaluate latency and resource consumption on CPU and GPU.
- Compare the performance quality of Tensor-Train with the baseline ResNet-18 architecture and the Tucker-2 variant.
Example
# pip install torch torchvision safetensors huggingface_hub
from huggingface_hub import hf_hub_download
import importlib.util, sys
from PIL import Image
path = hf_hub_download("LuisPaim/oed-resnet18-tensortrain", "oed_models.py")
spec = importlib.util.spec_from_file_location("oed_models", path)
oed = importlib.util.module_from_spec(spec); sys.modules["oed_models"] = oed; spec.loader.exec_module(oed)
model = oed.from_pretrained("LuisPaim/oed-resnet18-tensortrain")
print(oed.predict(model, Image.open("roi.tif")))Read more
DetailsParameters: 4.60 M (59% reduction compared to baseline)
GFLOPs: 3.63 (unchanged compared to baseline)
Metrics (on a test set of 92 images): AUC 0.9787, F1 0.8896, QWK 0.9195, Accuracy 0.8913
Hardware and latency: GPU latency 7.01 ms (RTX 3050), CPU latency 52.2 ms (Intel Xeon)
Limitations: for research and education only, not a medical device










Comments