  In this work, we propose two convolutional neural network classifiers for
detecting contaminants in astronomical images. Once trained, our classifiers
are able to identify various contaminants, such as cosmic rays, hot and bad
pixels, persistence effects, satellite or plane trails, residual fringe
patterns, nebulous features, saturated pixels, diffraction spikes, and tracking
errors in images. They encompass a broad range of ambient conditions, such as
seeing, image sampling, detector type, optics, and stellar density. The first
classifier, MaxiM ask , performs semantic segmentation and generates bad pixel
maps for each contaminant, based on the probability that each pixel belongs to
a given contaminant class. The second classifier, MaxiTrack , classifies entire
images and mosaics, by computing the probability for the focal plane to be
affected by tracking errors. We gathered training and testing data from real
data originating from various modern charged-coupled devices and near-infrared
cameras, that are augmented with image simulations. We quantified the
performance of both classifiers and show that M axi M ask achieves
state-of-the-art performance for the identification of cosmic ray hits. Thanks
to a built-in Bayesian update mechanism, both classifiers can be tuned to meet
specific science goals in various observational contexts.
