# Morphological Classification of Galaxies in S-PLUS using an Ensemble of Convolutional Networks

Published in Notas Técnicas do Centro Brasileiro de Pesquisas Físicas - NT-CBPF, 2021

Abstract: The universe is composed of galaxies that have diverse shapes. Once the structure of a galaxy is determined, it is possible to obtain important information on its formation and evolution. Morphological classification is the cataloging of galaxies according to their visual appearance and it is linked to their physical properties. A morphological classification made through visual analysis is sensible to differences in evaluation among diferent human volunteers. For this reason, systematic, objective and easily reproducible classification of galaxies has been gaining importance since the astronomer Edwin Hubble created his famous classification method. In this work, we combine accurate visual classifications of the Galaxy Zoo project with Deep Learning methods. The goal is to find an efficient technique at human performance level classification, but in a systematic and automatic way, for classification of elliptical and spiral galaxies. For this, a neural network model was created through an Ensemble of four other convolutional models, allowing a greater accuracy in the classification than what would be obtained with any one individual. Details of the individual models and improvements made to these are also described. The present work is entirely based on the analysis of images (not parameter tables) from DR1 (www.datalab.noao.edu) of the Southern Photometric Local Universe Survey (S-PLUS). In terms of classification, we achieved, with the Ensemble, an accuracy of $\approx 99 \%$ in the test sample (using pre-trained networks).

Authors: N. M. Cardoso, G. B. O. Schwarz, L. O. Dias, C. R. Bom, L. Sodre Jr, C. Mendes de Oliveira.

Paper (PDF): arXiv:2107.02287

## Supplementary Materials & Data Output

### Classifications of blind sample

ColumnDescription
raright ascension in decimal degrees (J2000)
decdeclination in decimal degrees (J2000)
r_autoS-PLUS DR1 r-band magnitude (SDSS-like r)
mn170_pEprobability of the object being elliptical given by the classification of the trained model with objects with magnitude $r_{auto} < 17$ (mn stands for “MorphoNet”)
mn170_pSprobability of the object being spiral given by the classification of the trained model with objects with magnitude $r_{auto} < 17$
mn175_pEprobability of the object being elliptical given by the classification of the trained model with objects with magnitude $r_{auto} < 17.5$
mn175_pSprobability of the object being spiral given by the classification of the trained model with objects with magnitude $r_{auto} < 17.5$

### Trained network weights

Weights of trained models as described in the paper. The network was trained with TensorFlow v2 and saved in SavedModel format. Each folder contains the model of a member of the Ensemble. A file in Python3 called MorphoNet Class is available that automates the loading of the weights of each member. It is recommended to use this class instead of making direct predictions as it standardizes member predictions with respect to training data as described in the paper.

### Code Samples

import os
import random
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import morphonet

# kind can be 'mn170' or 'mn175'
mn = morphonet.MorphoNet(kind='mn170', weights_folder='morphonet170')

# this method load the members and meta-model in memory

# load images to memory, using np.load in this case of .npy images
imgs = [np.load(f'colored_splus_stamps_npy/{f}') for f in os.listdir('colored_splus_stamps_npy')]

# call predict method with a list of numpy arrays of shape (128, 128, 3)
preds = mn.predict(imgs)

# select a random sample to plot
ids = random.sample(range(0, len(imgs)), 100)

# plot the reults in a grid
fig = plt.figure(figsize=(14, 16))
grid = ImageGrid(fig, 111, nrows_ncols=(7, 7), axes_pad=0.3)
for ax, _id in zip(grid, ids):
im = imgs[_id]
ax.set_title(f'S={preds[_id][0]:.2f} E={preds[_id][1]:.2f}')
ax.imshow(im)
plt.show()