  We analyze the optical morphologies of galaxies in the IllustrisTNG
simulation at $z\sim0$ with a Convolutional Neural Network trained on visual
morphologies in the Sloan Digital Sky Survey. We generate mock SDSS images of a
mass complete sample of $\sim12,000$ galaxies in the simulation using the
radiative transfer code SKIRT and include PSF and noise to match the SDSS
r-band properties. The images are then processed through the exact same neural
network used to estimate SDSS morphologies to classify simulated galaxies in
four morphological classes (E, S0/a, Sab, Scd). The CNN model finds that
$\sim95\%$ of the simulated galaxies fall in one the four main classes with
high confidence. The mass-size relations of the simulated galaxies divided by
morphological type also reproduce well the slope and the normalization of
observed relations which confirms the realism of optical morphologies in the
TNG suite. However, the Stellar Mass Functions decomposed into different
morphologies still show significant discrepancies with observations both at the
low and high mass end. We find that the high mass end of the SMF is dominated
in TNG by massive disk galaxies while early-type galaxies dominate in the
observations according to the CNN classifications. The present work highlights
the importance of detailed comparisons between observations and simulations in
comparable conditions.
