File size: 8,610 Bytes
0d7da36 b647b11 ffef7e6 0d7da36 2a0e99a 0d7da36 b647b11 0d7da36 40b9c6d 0d7da36 40b9c6d 0d7da36 40b9c6d 0d7da36 40b9c6d 0d7da36 40b9c6d 0d7da36 b647b11 40b9c6d 0d7da36 40b9c6d |
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
---
license: apache-2.0
language:
- en
metrics:
- accuracy
library_name: keras
pipeline_tag: image-classification
tags:
- astronomy
widget:
- src: https://huggingface.co/IT-Guy007/AstroVisionV1/blob/main/images/spiral-example.png
output:
text: one_one
---
# Model Card for Model ID
This model classifies RGB images to the 2 classes, Spheroid or Spiral.
## Model Details
### Model Description
- **Developed by:** Jeroen den Otter, Michael Rutkowski
- **Funded by:** NASA
- **Model type:** Keras Sequential
- **License:** Apache2
### Model Sources
<!-- Provide the basic links for the model. -->
- **Repository:** https://www.kaggle.com/c/galaxy-zoo-the-galaxy-challenge/overview
## Uses
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.
## How to Get Started with the Model
Use the code below to get started with the model.
```python
model = tf.keras.models.load_model('model.keras')
prediction = model.predict(image)
print(prediction)
```
## Training Details
### Training Data
From the kaggle zoo challenge the classes one_one(Spheroid) 80%> and one_two(Spiral) 90%> are used.
Furthermore are the image segmented for noice removal
### Training Procedure
```python
train_ds, val_ds = image_dataset_from_directory(
dataset_directory,
validation_split=0.2,
subset="both",
seed=123,
image_size=(200, 200),
batch_size=32,
color_mode='grayscale'
)
data_augmentation = tf.keras.Sequential([
tf.keras.layers.RandomFlip('horizontal'),
tf.keras.layers.RandomRotation(0.2),
tf.keras.layers.RandomZoom(0.2),
tf.keras.layers.RandomContrast(0.2),
tf.keras.layers.RandomBrightness(0.2),
tf.keras.layers.GaussianNoise(0.1),
])
AUTOTUNE = tf.data.AUTOTUNE
train_ds = train_ds.cache().shuffle(1000).prefetch(buffer_size=AUTOTUNE)
val_ds = val_ds.cache().prefetch(buffer_size=AUTOTUNE)
model = tf.keras.Sequential([
data_augmentation,
tf.keras.layers.Rescaling(1./255, input_shape=(200, 200, 1)),
tf.keras.layers.Conv2D(32, (3, 3), activation='relu'),
tf.keras.layers.MaxPooling2D(2, 2),
tf.keras.layers.Conv2D(64, (3, 3), activation='relu'),
tf.keras.layers.MaxPooling2D(2, 2),
tf.keras.layers.Conv2D(128, (3, 3), activation='relu'),
tf.keras.layers.MaxPooling2D(2, 2),
tf.keras.layers.Conv2D(128, (3, 3), activation='relu'),
tf.keras.layers.MaxPooling2D(2, 2),
tf.keras.layers.Flatten(),
tf.keras.layers.Dropout(0.5),
tf.keras.layers.Dense(512, activation='relu'),
tf.keras.layers.Dense(2, activation='softmax')
])
model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=0.001),
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
```
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
### Testing Data, Factors & Metrics
### Model summary
```text
βββββββββββββββββββββββββββββββββββ³βββββββββββββββββββββββββ³ββββββββββββββββ
β Layer (type) β Output Shape β Param # β
β‘βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ©
β sequential (Sequential) β (None, 200, 200, 1) β 0 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β rescaling (Rescaling) β (None, 200, 200, 1) β 0 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β conv2d (Conv2D) β (None, 198, 198, 64) β 640 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β max_pooling2d (MaxPooling2D) β (None, 99, 99, 64) β 0 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β conv2d_1 (Conv2D) β (None, 97, 97, 128) β 73,856 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β max_pooling2d_1 (MaxPooling2D) β (None, 48, 48, 128) β 0 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β conv2d_2 (Conv2D) β (None, 46, 46, 256) β 295,168 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β max_pooling2d_2 (MaxPooling2D) β (None, 23, 23, 256) β 0 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β conv2d_3 (Conv2D) β (None, 21, 21, 256) β 590,080 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β max_pooling2d_3 (MaxPooling2D) β (None, 10, 10, 256) β 0 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β flatten (Flatten) β (None, 25600) β 0 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β dropout (Dropout) β (None, 25600) β 0 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β dense (Dense) β (None, 1024) β 26,215,424 β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββββββ€
β dense_1 (Dense) β (None, 2) β 2,050 β
βββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββ΄ββββββββββββββββ
Total params: 81,531,656 (311.02 MB)
Trainable params: 27,177,218 (103.67 MB)
Non-trainable params: 0 (0 MB)
Optimizer params 54,354,438 (207.35 MB)
```
### Loss and Accuracy
![Loss and Accuracy](./images/loss-accuracy.png)
### Results
| | precision | recall | f1-score | support |
|-----------|-----------|--------|----------|---------|
| one_one | 0.98 | 0.98 | 0.96 | 1637 |
| one_two | 0.98 | 0.98 | 0.98 | 1740 |
| accuracy | | | 0.96 | 3377 |
| macro avg | 0.98 | 0.98 | 0.98 | 3377 |
| weighted avg| 0.98 | 0.98 | 0.98 | 3377 |
## Environmental Impact
- **Hardware Type:** M3 Pro
- **Hours used:** 72
|