File size: 4,869 Bytes
a7a1967
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8c8c1e
a7a1967
7f7152b
27d3941
7f7152b
a7a1967
7f7152b
 
3b9b953
9c6c144
27d3941
d2af46f
 
cf89946
 
 
a7a1967
 
cfcb727
6c4690e
9c6c144
080337a
9c6c144
 
 
a7a1967
f41b608
a7a1967
c01fa5b
a7a1967
f41b608
a7a1967
f7209bc
a7a1967
f41b608
a7a1967
9c6c144
 
f41b608
 
 
 
8f8fb39
 
9c6c144
ffa3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43f69ac
f41b608
 
 
 
 
 
1107523
f41b608
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483d9b0
43f69ac
21538ec
ee81a04
21538ec
 
 
 
 
 
 
 
587c287
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
tags:
- image-classification
- pytorch
metrics:
- accuracy

model-index:
- name: SDO_VT1
  results:
  - task:
      name: Image Classification
      type: image-classification
    metrics:
      - name: Accuracy
        type: accuracy
        value: 0.8695651888847351
---

# NASA Solar Dynamics Observatory Vision Transformer v.1 (SDO_VT1)

## Authors:
[Frank Soboczenski](https://h21k.github.io/), King's College London, London, UK<br>
[Paul Wright](https://www.wrightai.com/), Wright AI Ltd, Leeds, UK

## General:
This Vision Transformer model has been fine-tuned on Solar Dynamics Observatory (SDO) data. The images used are available here:
[Solar Dynamics Observatory Gallery](https://sdo.gsfc.nasa.gov/gallery/main). This is a Vision Transformer model fine-tuned on SDO data in an active region classification task. We aim to highlight the ease of use of the HuggingFace platform, integration with popular deep learning frameworks such as PyTorch, TensorFlow, or JAX, performance monitoring with Weights and Biases, and the ability to effortlessly utilize pre-trained large scale Transformer models for targeted fine-tuning purposes. This is to our knowledge the first Vision Transformer model on NASA SDO mission data and we are working on additional versions to address challenges in this domain. 

<b>The data used was provided courtesy of NASA/SDO and the AIA, EVE, and HMI science teams.
The authors gratefully acknowledge the entire NASA Solar Dynamics Observatory Mission Team.</b><br>

For the SDO team: this model is the first version for demonstration purposes. It is only trained on the SDO Gallery data atm and we're working on additional data. 

We will include more technical details here soon. 

## Example Images
--> Use one of the images below for the inference API field on the upper right.

Additional images for testing can be found at: 
[Solar Dynamics Observatory Gallery](https://sdo.gsfc.nasa.gov/gallery/main)
You can use the following tags to further select images for testing: 
"coronal holes", "loops" or "flares"
You can also choose "active regions" to get a general pool for testing.

### NASA_SDO_Coronal_Hole

![NASA_SDO_Coronal_Hole](images/NASA_SDO_Coronal_Hole2.jpg)

### NASA_SDO_Coronal_Loop

![NASA_SDO_Coronal_Loop](images/NASA_SDO_Coronal_Loop.jpg)

### NASA_SDO_Solar_Flare

![NASA_SDO_Solar_Flare](images/NASA_SDO_Solar_Flare.jpg)

## Training data
The ViT model was pretrained on a dataset consisting of 14 million images and 21k classes ([ImageNet-21k](http://www.image-net.org/).
More information on the base model used can be found here: (https://huggingface.co/google/vit-base-patch16-224-in21k)

## How to use this Model 
(quick snippet to work on Google Colab - comment the pip install for local use if you have transformers already installed)

```python
!pip install transformers --quiet
from transformers import AutoFeatureExtractor, AutoModelForImageClassification
from PIL import Image
import requests

url = 'https://sdo.gsfc.nasa.gov/assets/gallery/preview/211_coronalhole.jpg'
image = Image.open(requests.get(url, stream=True).raw)

feature_extractor = AutoFeatureExtractor.from_pretrained("kenobi/SDO_VT1")
model = AutoModelForImageClassification.from_pretrained("kenobi/SDO_VT1")
inputs = feature_extractor(images=image, return_tensors="pt")

outputs = model(**inputs)
logits = outputs.logits
# model predicts one of the three fine-tuned classes (NASA_SDO_Coronal_Hole, NASA_SDO_Coronal_Loop or NASA_SDO_Solar_Flare) 
predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])
```

## BibTeX & References

A publication on this work is currently in preparation. In the meantime, please refer to this model by using the following citation: 
```
@misc{sdovt2022,
  author = {Frank Soboczenski and Paul J Wright},
  title = {SDOVT: A Vision Transformer Model for Solar Dynamics Observatory (SDO) Data},
  url = {https://huggingface.co/kenobi/SDO_VT1/},
  version = {1.0},
  year = {2022},
}
```

For the base ViT model used please refer to:

```bibtex
@misc{wu2020visual,
      title={Visual Transformers: Token-based Image Representation and Processing for Computer Vision}, 
      author={Bichen Wu and Chenfeng Xu and Xiaoliang Dai and Alvin Wan and Peizhao Zhang and Zhicheng Yan and Masayoshi Tomizuka and Joseph Gonzalez and Kurt Keutzer and Peter Vajda},
      year={2020},
      eprint={2006.03677},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
```
For referring to Imagenet:

```bibtex
@inproceedings{deng2009imagenet,
  title={Imagenet: A large-scale hierarchical image database},
  author={Deng, Jia and Dong, Wei and Socher, Richard and Li, Li-Jia and Li, Kai and Fei-Fei, Li},
  booktitle={2009 IEEE conference on computer vision and pattern recognition},
  pages={248--255},
  year={2009},
  organization={Ieee}
}
```