
Chest X-rays classification with ViT
Chest X-rays classification with ViT is not a specific term or model that I am aware of in the context of pneumonia classification using X-ray images. However, I can provide you with a general overview of pneumonia classification using X-ray images and the role of vision transformers (ViTs) in image analysis tasks.
Chest X-rays classification with ViT
Summary
Introduction
Chest X-rays classification with ViT is not a specific term or model that I am aware of in the context of pneumonia classification using X-ray images. However, I can provide you with a general overview of pneumonia classification using X-ray images and the role of vision transformers (ViTs) in image analysis tasks.
The model being referred to is a fine-tuned version of the google/vit-base-patch16-224-in21k model specifically trained on the chest-xray-classification dataset.
Parameters
Inputs
- input - (image -.png|.jpg|.jpeg): This is the Chest X-ray image that needs to be classified.
Output
- output - (text): The model provides a prediction for the class of the input image, such as normal or pneumonia. Along with the prediction, the model also outputs the probability associated with that prediction. The probability represents the confidence level or likelihood of the image belonging to a particular class.
Examples
input | output |
---|---|
![]() | ![]() |
Usage for developers
Please find below the details to track the information and access the code for processing the model on our platform.
Requirements
python~=3.10
torch~=2.0.0
transformers
Code based on AIOZ structure
from transformers import pipeline
import torch, os
...
def do_ai_task(
input: Union[str, Path],
model_storage_directory: Union[str, Path],
device: Literal["cpu", "cuda", "gpu"] = "cpu",
*args, **kwargs) -> Any:
"""Define AI task: load model, pre-process, post-process, etc ..."""
# Define AI task workflow. Below is an example
device = "cuda" if torch.cuda.is_available() else "cpu"
repo_id = os.path.abspath(model_storage_directory + '/...')
classifier = pipeline("image-classification", repo_id, device=device)
with torch.no_grad():
text = classifier(input)
label_score_dict = {}
for item in text:
label = item['label']
score = item['score']
label_score_dict[label] = score
return str(label_score_dict)
Reference
This repository is based on and inspired by Lik Xun Yuan's work. We sincerely appreciate their generosity in sharing the code.
License
We respect and comply with the terms of the author's license cited in the Reference section.