  We train a deep residual convolutional neural network (CNN) to predict the
gas-phase metallicity ($Z$) of galaxies derived from spectroscopic information
($Z \equiv 12 + \log(\rm O/H)$) using only three-band $gri$ images from the
Sloan Digital Sky Survey. When trained and tested on $128 \times 128$-pixel
images, the root mean squared error (RMSE) of $Z_{\rm pred} - Z_{\rm true}$ is
only 0.085 dex, vastly outperforming a trained random forest algorithm on the
same data set (RMSE $=0.130$ dex). The amount of scatter in $Z_{\rm pred} -
Z_{\rm true}$ decreases with increasing image resolution in an intuitive
manner. We are able to use CNN-predicted $Z_{\rm pred}$ and independently
measured stellar masses to recover a mass-metallicity relation with $0.10$ dex
scatter. Because our predicted MZR shows no more scatter than the empirical
MZR, the difference between $Z_{\rm pred}$ and $Z_{\rm true}$ can not be due to
purely random error. This suggests that the CNN has learned a representation of
the gas-phase metallicity, from the optical imaging, beyond what is accessible
with oxygen spectral lines.
