Update README.md
Browse files
README.md
CHANGED
@@ -1,7 +1,67 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
pipeline_tag: image-classification
|
4 |
tags:
|
5 |
-
- medical
|
6 |
- vision
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language: en
|
|
|
3 |
tags:
|
|
|
4 |
- vision
|
5 |
+
- image-classification
|
6 |
+
- medical-imaging
|
7 |
+
- tumor-classification
|
8 |
+
license: apache-2.0
|
9 |
+
base_model: google/vit-base-patch16-224
|
10 |
+
model-index:
|
11 |
+
- name: vit_tumor_classifier
|
12 |
+
results:
|
13 |
+
- task:
|
14 |
+
name: Image Classification
|
15 |
+
type: binary-classification
|
16 |
+
metrics:
|
17 |
+
- name: Accuracy
|
18 |
+
type: accuracy
|
19 |
+
value: 0.85 # Replace with your actual accuracy
|
20 |
+
- name: F1 Score
|
21 |
+
type: f1
|
22 |
+
value: 0.84 # Replace with your actual F1 score
|
23 |
+
---
|
24 |
+
|
25 |
+
# Vision Transformer for Tumor Classification
|
26 |
+
|
27 |
+
This model is a fine-tuned version of [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224) for binary tumor classification in medical images.
|
28 |
+
|
29 |
+
## Model Details
|
30 |
+
|
31 |
+
- **Model Type:** Vision Transformer (ViT)
|
32 |
+
- **Base Model:** google/vit-base-patch16-224
|
33 |
+
- **Task:** Binary Image Classification
|
34 |
+
- **Training Data:** Medical image dataset with tumor/non-tumor annotations
|
35 |
+
- **Input:** Medical images (224x224 pixels)
|
36 |
+
- **Output:** Binary classification (tumor/non-tumor)
|
37 |
+
- **Model Size:** 85.8M parameters
|
38 |
+
- **Framework:** PyTorch
|
39 |
+
- **License:** Apache 2.0
|
40 |
+
|
41 |
+
## Intended Use
|
42 |
+
|
43 |
+
This model is designed for tumor classification in medical imaging. It should be used as part of a larger medical diagnostic system and not as a standalone diagnostic tool.
|
44 |
+
|
45 |
+
## Usage
|
46 |
+
|
47 |
+
```python
|
48 |
+
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
49 |
+
from PIL import Image
|
50 |
+
|
51 |
+
# Load model and processor
|
52 |
+
processor = AutoImageProcessor.from_pretrained("SIATCN/vit_tumor_classifier")
|
53 |
+
model = AutoModelForImageClassification.from_pretrained("SIATCN/vit_tumor_classifier")
|
54 |
+
|
55 |
+
# Load and process image
|
56 |
+
image = Image.open("path_to_your_image.jpg")
|
57 |
+
inputs = processor(image, return_tensors="pt")
|
58 |
+
|
59 |
+
# Make prediction
|
60 |
+
outputs = model(**inputs)
|
61 |
+
predictions = outputs.logits.softmax(dim=-1)
|
62 |
+
predicted_label = predictions.argmax().item()
|
63 |
+
confidence = predictions[0][predicted_label].item()
|
64 |
+
|
65 |
+
# Get class name
|
66 |
+
class_names = ["non-tumor", "tumor"]
|
67 |
+
print(f"Predicted: {class_names[predicted_label]} (confidence: {confidence:.2f})")
|