--- license: mit library_name: transformers pipeline_tag: image-classification base_model: facebook/convnextv2-tiny-22k-224 tags: - chest-xray - convnext - convnextv2 - image-classification - medical - medical-imaging - pneumonia - pytorch - transformers datasets: - keremberke/chest-xray-classification metrics: - accuracy - f1 widget: - src: https://huggingface.co/kiselyovd/chest-xray-classifier/resolve/main/samples/bacterial_pneumonia.png example_title: bacterial_pneumonia - src: https://huggingface.co/kiselyovd/chest-xray-classifier/resolve/main/samples/normal.png example_title: normal - src: https://huggingface.co/kiselyovd/chest-xray-classifier/resolve/main/samples/viral_pneumonia.png example_title: viral_pneumonia model-index: - name: kiselyovd/chest-xray-classifier results: - task: type: image-classification dataset: type: keremberke/chest-xray-classification name: Chest X-Ray Images (Pneumonia) metrics: - type: auroc_macro_ovr value: 0.9752638346619307 - type: accuracy value: 0.9134615384615384 - type: macro_f1 value: 0.9029730638714358 --- # chest-xray-classifier Production-grade 3-class chest X-ray classifier: normal vs bacterial pneumonia vs viral pneumonia. ## Metrics | Metric | Value | |---|---| | auroc_macro_ovr | 0.9752638346619307 | | accuracy | 0.9134615384615384 | | macro_f1 | 0.9029730638714358 | ## Usage ```python from transformers import AutoImageProcessor, AutoModelForImageClassification import torch from PIL import Image processor = AutoImageProcessor.from_pretrained("kiselyovd/chest-xray-classifier") model = AutoModelForImageClassification.from_pretrained("kiselyovd/chest-xray-classifier") image = Image.open("your_image.png") inputs = processor(images=image, return_tensors="pt") with torch.no_grad(): logits = model(**inputs).logits predicted_class = logits.argmax(-1).item() print(model.config.id2label[predicted_class]) ``` ## Training Data Trained on [Chest X-Ray Images (Pneumonia)](https://huggingface.co/datasets/keremberke/chest-xray-classification). ## Source Code [GitHub Repository](https://github.com/kiselyovd/chest-xray-classifier) ## Intended Use This model is provided for research and educational purposes. The authors make no warranties about its suitability for any particular application. Users are responsible for evaluating the model's fitness for their use case, including fairness, safety, and compliance with applicable regulations. > **Note:** This model card was generated from the [ml-project-template](https://github.com/kiselyovd/ml-project-template) scaffold.