Update README.md
Browse files
README.md
CHANGED
@@ -48,11 +48,11 @@ Additional images for testing can be found at:
|
|
48 |
|
49 |
#### High_Energy_Ion_Fe_Nuclei
|
50 |
|
51 |
-
.
|
@@ -67,16 +67,16 @@ from transformers import AutoFeatureExtractor, AutoModelForImageClassification
|
|
67 |
from PIL import Image
|
68 |
import requests
|
69 |
|
70 |
-
url = 'https://
|
71 |
image = Image.open(requests.get(url, stream=True).raw)
|
72 |
|
73 |
-
feature_extractor = AutoFeatureExtractor.from_pretrained("kenobi/
|
74 |
-
model = AutoModelForImageClassification.from_pretrained("kenobi/
|
75 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
76 |
|
77 |
outputs = model(**inputs)
|
78 |
logits = outputs.logits
|
79 |
-
# model predicts one of the
|
80 |
predicted_class_idx = logits.argmax(-1).item()
|
81 |
print("Predicted class:", model.config.id2label[predicted_class_idx])
|
82 |
```
|
|
|
48 |
|
49 |
#### High_Energy_Ion_Fe_Nuclei
|
50 |
|
51 |
+

|
52 |
|
53 |
#### XRay_irradiated_Nuclei
|
54 |
|
55 |
+

|
56 |
|
57 |
## Training data
|
58 |
The ViT model was pretrained on a dataset consisting of 14 million images and 21k classes ([ImageNet-21k](http://www.image-net.org/).
|
|
|
67 |
from PIL import Image
|
68 |
import requests
|
69 |
|
70 |
+
url = 'https://roosevelt.devron-systems.com/HF/P242_73665006707-A6_002_008_proj.tif'
|
71 |
image = Image.open(requests.get(url, stream=True).raw)
|
72 |
|
73 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained("kenobi/NASA_GeneLab_MBT")
|
74 |
+
model = AutoModelForImageClassification.from_pretrained("kenobi/NASA_GeneLab_MBT")
|
75 |
inputs = feature_extractor(images=image, return_tensors="pt")
|
76 |
|
77 |
outputs = model(**inputs)
|
78 |
logits = outputs.logits
|
79 |
+
# model predicts one of the two fine-tuned classes (High_Energy_Ion_Fe_Nuclei or XRay_irradiated_Nuclei)
|
80 |
predicted_class_idx = logits.argmax(-1).item()
|
81 |
print("Predicted class:", model.config.id2label[predicted_class_idx])
|
82 |
```
|