Update README.md
Browse files
README.md
CHANGED
@@ -19,14 +19,36 @@ I also used this tutorial.[Swin Transformer (tiny-sized model)](https://colab.re
|
|
19 |
|
20 |
The model can be used to classify JPEG images of CT scans into either cancer positive or
|
21 |
Cancer negative groups.
|
|
|
22 |
|
23 |
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
|
|
|
|
|
|
28 |
|
29 |
|
30 |
## How to Use
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
|
|
19 |
|
20 |
The model can be used to classify JPEG images of CT scans into either cancer positive or
|
21 |
Cancer negative groups.
|
22 |
+
I think it would work okay for any image classification task.
|
23 |
|
24 |
|
25 |
|
26 |
+
## Training Data
|
27 |
|
28 |
+
The model was trained on data originally obtained from the National Cancer Institute
|
29 |
+
Imaging Data Commons. https://portal.imaging.datacommons.cancer.gov/explore/
|
30 |
+
The data set used consisted of about 11,000 images which were transformed CT scans
|
31 |
+
some of which contained Cancerous Nodules and some that did not.
|
32 |
|
33 |
|
34 |
## How to Use
|
35 |
+
```python
|
36 |
+
|
37 |
+
from huggingface_hub import hf_hub_download
|
38 |
+
from PIL import Image
|
39 |
+
|
40 |
+
abc= hf_hub_download(repo_id="oohtmeel/swin-tiny-patch4-finetuned-lung-cancer-ct-scans",
|
41 |
+
filename="_X000a109d-56da-4c3f-8680-55afa04d6ae0.dcm.jpg.jpg")
|
42 |
+
image = Image.open(abc)
|
43 |
+
processor = AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
|
44 |
+
model = AutoModelForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
|
45 |
+
inputs = processor(images=image, return_tensors="pt")
|
46 |
+
outputs = model(**inputs)
|
47 |
+
logits = outputs.logits
|
48 |
+
predicted_class_idx = logits.argmax(-1).item()
|
49 |
+
print("Predicted class:", model.config.id2label[predicted_class_idx])
|
50 |
+
|
51 |
+
```
|
52 |
+
|
53 |
+
|
54 |
|