1aurent/Kather-texture-2016
Updated • 269 • 3
How to use 1aurent/phikon-distil-vit-tiny-patch16-224-kather2016 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="1aurent/phikon-distil-vit-tiny-patch16-224-kather2016")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") # Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification
processor = AutoImageProcessor.from_pretrained("1aurent/phikon-distil-vit-tiny-patch16-224-kather2016")
model = AutoModelForImageClassification.from_pretrained("1aurent/phikon-distil-vit-tiny-patch16-224-kather2016")This model is a distilled version of owkin/phikon to a TinyViT on the 1aurent/Kather-texture-2016 dataset.
from transformers import AutoModelForImageClassification, AutoImageProcessor
from urllib.request import urlopen
from PIL import Image
# get example histology image
img = Image.open(
urlopen(
"https://datasets-server.huggingface.co/assets/1aurent/Kather-texture-2016/--/default/train/0/image/image.jpg"
)
)
# load image_processor and model from the hub
model_name = "1aurent/phikon-distil-vit-tiny-patch16-224-kather2016"
image_processor = AutoImageProcessor.from_pretrained(model_name)
model = AutoModelForImageClassification.from_pretrained(model_name)
inputs = image_processor(img, return_tensors="pt")
outputs = model(**inputs)
@article{Filiot2023.07.21.23292757,
author = {Alexandre Filiot and Ridouane Ghermi and Antoine Olivier and Paul Jacob and Lucas Fidon and Alice Mac Kain and Charlie Saillard and Jean-Baptiste Schiratti},
title = {Scaling Self-Supervised Learning for Histopathology with Masked Image Modeling},
elocation-id = {2023.07.21.23292757},
year = {2023},
doi = {10.1101/2023.07.21.23292757},
publisher = {Cold Spring Harbor Laboratory Press},
url = {https://www.medrxiv.org/content/early/2023/09/14/2023.07.21.23292757},
eprint = {https://www.medrxiv.org/content/early/2023/09/14/2023.07.21.23292757.full.pdf},
journal = {medRxiv}
}