Added model card
Browse files
README.md
CHANGED
@@ -1,3 +1,132 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
metrics:
|
6 |
+
- accuracy
|
7 |
+
library_name: keras
|
8 |
+
pipeline_tag: image-classification
|
9 |
+
tags:
|
10 |
+
- astronomy
|
11 |
+
---
|
12 |
+
# Model Card for Model ID
|
13 |
+
|
14 |
+
This model classifies RGB images to the 2 classes, Spheroid or Spiral.
|
15 |
+
|
16 |
+
|
17 |
+
## Model Details
|
18 |
+
|
19 |
+
### Model Description
|
20 |
+
|
21 |
+
- **Developed by:** Jeroen den Otter
|
22 |
+
- **Funded by:** NASA
|
23 |
+
- **Shared by [optional]:** Michael Rutkowski
|
24 |
+
- **Model type:** Keras Sequential
|
25 |
+
- **Language(s) (NLP):** English
|
26 |
+
- **License:** Apache2
|
27 |
+
|
28 |
+
### Model Sources [optional]
|
29 |
+
|
30 |
+
<!-- Provide the basic links for the model. -->
|
31 |
+
|
32 |
+
- **Repository:** https://www.kaggle.com/c/galaxy-zoo-the-galaxy-challenge/overview
|
33 |
+
- **Paper [optional]:** In progress
|
34 |
+
|
35 |
+
## Uses
|
36 |
+
|
37 |
+
The model can be used for identifying different galaxies from cutout images. It does not provide bounding boxes, so multiple galaxies in 1 image is not desired.
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
## How to Get Started with the Model
|
42 |
+
|
43 |
+
Use the code below to get started with the model.
|
44 |
+
|
45 |
+
```python
|
46 |
+
model = tf.keras.models.load_model('model.keras')
|
47 |
+
prediction = model.predict(image)
|
48 |
+
print(prediction)
|
49 |
+
|
50 |
+
```
|
51 |
+
|
52 |
+
## Training Details
|
53 |
+
|
54 |
+
### Training Data
|
55 |
+
|
56 |
+
From the kaggle zoo challenge the classes one_one(Spheroid) 80%> and one_two(Spiral) 90%> are used.
|
57 |
+
|
58 |
+
Furthermore are the image segmented for noice removal
|
59 |
+
|
60 |
+
### Training Procedure
|
61 |
+
|
62 |
+
```python
|
63 |
+
data_augmentation = tf.keras.Sequential([
|
64 |
+
tf.keras.layers.RandomFlip('horizontal'),
|
65 |
+
tf.keras.layers.RandomRotation(0.2),
|
66 |
+
tf.keras.layers.RandomZoom(0.2),
|
67 |
+
tf.keras.layers.RandomContrast(0.2),
|
68 |
+
tf.keras.layers.RandomBrightness(0.2),
|
69 |
+
tf.keras.layers.GaussianNoise(0.1),
|
70 |
+
])
|
71 |
+
|
72 |
+
AUTOTUNE = tf.data.AUTOTUNE
|
73 |
+
train_ds = train_ds.cache().shuffle(1000).prefetch(buffer_size=AUTOTUNE)
|
74 |
+
val_ds = val_ds.cache().prefetch(buffer_size=AUTOTUNE)
|
75 |
+
|
76 |
+
model = tf.keras.Sequential([
|
77 |
+
data_augmentation,
|
78 |
+
tf.keras.layers.Rescaling(1./255, input_shape=(img_height, img_width, 3)),
|
79 |
+
tf.keras.layers.Conv2D(32, (3, 3), activation='relu'),
|
80 |
+
tf.keras.layers.MaxPooling2D(2, 2),
|
81 |
+
tf.keras.layers.Conv2D(64, (3, 3), activation='relu'),
|
82 |
+
tf.keras.layers.MaxPooling2D(2, 2),
|
83 |
+
tf.keras.layers.Conv2D(128, (3, 3), activation='relu'),
|
84 |
+
tf.keras.layers.MaxPooling2D(2, 2),
|
85 |
+
tf.keras.layers.Conv2D(128, (3, 3), activation='relu'),
|
86 |
+
tf.keras.layers.MaxPooling2D(2, 2),
|
87 |
+
tf.keras.layers.Flatten(),
|
88 |
+
tf.keras.layers.Dropout(0.5),
|
89 |
+
tf.keras.layers.Dense(512, activation='relu'),
|
90 |
+
tf.keras.layers.Dense(num_classes, activation='softmax')
|
91 |
+
])
|
92 |
+
|
93 |
+
model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=0.001),
|
94 |
+
loss='sparse_categorical_crossentropy',
|
95 |
+
metrics=['accuracy'])
|
96 |
+
```
|
97 |
+
|
98 |
+
|
99 |
+
#### Training Hyperparameters
|
100 |
+
|
101 |
+
#### Speeds, Sizes, Times [optional]
|
102 |
+
|
103 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
104 |
+
|
105 |
+
[More Information Needed]
|
106 |
+
|
107 |
+
## Evaluation
|
108 |
+
|
109 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
110 |
+
|
111 |
+
### Testing Data, Factors & Metrics
|
112 |
+
|
113 |
+
#### Testing Data
|
114 |
+
|
115 |
+
Test data is manual retrieved data from Hubble and James web, see manually manipulated data in the files and their accuracy. Of each a log and linear scaling is used.
|
116 |
+
|
117 |
+
### Results
|
118 |
+
precision recall f1-score support
|
119 |
+
|
120 |
+
one_one 0.96 0.98 0.96 1637
|
121 |
+
one_two 0.98 0.93 0.96 1740
|
122 |
+
|
123 |
+
accuracy 0.96 3377
|
124 |
+
macro avg 0.96 0.96 0.96 3377
|
125 |
+
weighted avg 0.96 0.96 0.96 3377
|
126 |
+
|
127 |
+
|
128 |
+
## Environmental Impact
|
129 |
+
|
130 |
+
|
131 |
+
- **Hardware Type:** M3 Pro
|
132 |
+
- **Hours used:** 30min
|