Dhiryashil commited on
Commit
3bf5d0a
·
verified ·
1 Parent(s): fde1bbb

Upload 4 files

Browse files
Files changed (4) hide show
  1. README.md +99 -12
  2. config.json +32 -0
  3. preprocessor_config.json +17 -0
  4. pytorch_model.bin +3 -0
README.md CHANGED
@@ -1,12 +1,99 @@
1
- ---
2
- title: Chest
3
- emoji: 🐠
4
- colorFrom: indigo
5
- colorTo: gray
6
- sdk: gradio
7
- sdk_version: 5.49.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: google/vit-base-patch16-224-in21k
4
+ tags:
5
+ - medical
6
+ - healthcare
7
+ - image-classification
8
+ - chest-x-ray-pneumonia-detection
9
+ datasets:
10
+ - medical-images
11
+ language:
12
+ - en
13
+ library_name: transformers
14
+ pipeline_tag: image-classification
15
+ ---
16
+
17
+ # Chest X-ray Pneumonia Detection
18
+
19
+ ## Model Description
20
+
21
+
22
+ This model is a fine-tuned Vision Transformer (ViT) for detecting pneumonia in chest X-ray images.
23
+ It can classify chest X-rays as either NORMAL (healthy) or PNEUMONIA (showing signs of pneumonia infection).
24
+
25
+
26
+ ## Intended Uses & Limitations
27
+
28
+ ⚠️ **Important**: This model is for research and educational purposes only. It should **NOT** be used for actual medical diagnosis without proper clinical validation and oversight by qualified medical professionals.
29
+
30
+ ### Intended Uses
31
+ - Research and development in medical AI
32
+ - Educational purposes for learning about medical image classification
33
+ - Proof-of-concept applications with proper disclaimers
34
+ - Academic studies and benchmarking
35
+
36
+ ### Limitations
37
+ - Not clinically validated
38
+ - Should not replace professional medical diagnosis
39
+ - May have biases based on training data
40
+ - Performance may vary on different populations or imaging conditions
41
+
42
+ ## Model Details
43
+
44
+ - **Model Type**: Image Classification
45
+ - **Architecture**: google/vit-base-patch16-224-in21k
46
+ - **Classes**: 2
47
+ - **Input**: RGB images (224x224 pixels)
48
+ - **Accuracy**: 95.83%
49
+
50
+ ### Classes
51
+ - NORMAL
52
+ - PNEUMONIA
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ from transformers import AutoModelForImageClassification, AutoImageProcessor
58
+ from PIL import Image
59
+ import torch
60
+
61
+ # Load model and processor
62
+ model = AutoModelForImageClassification.from_pretrained("your-username/chest-x-ray-pneumonia-detection")
63
+ processor = AutoImageProcessor.from_pretrained("your-username/chest-x-ray-pneumonia-detection")
64
+
65
+ # Load and process image
66
+ image = Image.open("path_to_image.jpg")
67
+ inputs = processor(image, return_tensors="pt")
68
+
69
+ # Make prediction
70
+ with torch.no_grad():
71
+ outputs = model(**inputs)
72
+ predicted_class_id = outputs.logits.argmax().item()
73
+ predicted_class = model.config.id2label[predicted_class_id]
74
+
75
+ print(f"Predicted class: {predicted_class}")
76
+ ```
77
+
78
+ ## Training Details
79
+
80
+ This model was fine-tuned from pre-trained vision transformers on medical image datasets. For detailed training information, please refer to the original model documentation.
81
+
82
+ ## Evaluation
83
+
84
+ The model has been tested on held-out validation sets with the reported accuracy metrics. However, clinical evaluation and validation are required before any medical application.
85
+
86
+ ## Ethical Considerations
87
+
88
+ - Medical AI models can have significant impact on human health
89
+ - Proper validation and regulatory approval required for clinical use
90
+ - Potential for bias in training data and model predictions
91
+ - Should be used responsibly with appropriate medical oversight
92
+
93
+ ## Contact
94
+
95
+ For questions about this model, please create an issue in the repository.
96
+
97
+ ## Citation
98
+
99
+ If you use this model in your research, please cite appropriately and acknowledge that it's for research purposes only.
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "google/vit-base-patch16-224-in21k",
3
+ "architectures": [
4
+ "ViTForImageClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "encoder_stride": 16,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.0,
10
+ "hidden_size": 768,
11
+ "id2label": {
12
+ "0": "NORMAL",
13
+ "1": "PNEUMONIA"
14
+ },
15
+ "image_size": 224,
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 3072,
18
+ "label2id": {
19
+ "NORMAL": "0",
20
+ "PNEUMONIA": "1"
21
+ },
22
+ "layer_norm_eps": 1e-12,
23
+ "model_type": "vit",
24
+ "num_attention_heads": 12,
25
+ "num_channels": 3,
26
+ "num_hidden_layers": 12,
27
+ "patch_size": 16,
28
+ "problem_type": "single_label_classification",
29
+ "qkv_bias": true,
30
+ "torch_dtype": "float32",
31
+ "transformers_version": "4.17.0"
32
+ }
preprocessor_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "do_resize": true,
4
+ "feature_extractor_type": "ViTFeatureExtractor",
5
+ "image_mean": [
6
+ 0.5,
7
+ 0.5,
8
+ 0.5
9
+ ],
10
+ "image_std": [
11
+ 0.5,
12
+ 0.5,
13
+ 0.5
14
+ ],
15
+ "resample": 2,
16
+ "size": 224
17
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4b052d087f705ba06b16aa03c01dfdf37f36f0f8ab7b136cda1524bba8ab09d
3
+ size 343280753