  Rejecting cosmic rays (CRs) is essential for the scientific interpretation of
CCD-captured data, but detecting CRs in single-exposure images has remained
challenging. Conventional CR detectors require experimental parameter tuning
for different instruments, and recent deep learning methods only produce
instrument-specific models that suffer from performance loss on telescopes not
included in the training data. We present Cosmic-CoNN, a generic CR detector
deployed for 24 telescopes at the Las Cumbres Observatory, which is made
possible by the three contributions in this work: 1) We build a large and
diverse ground-based CR dataset leveraging thousands of images from a global
telescope network. 2) We propose a novel loss function and a neural network
optimized for telescope imaging data to train generic CR detection models. At
95% recall, our model achieves a precision of 93.70% on Las Cumbres imaging
data and maintains a consistent performance on new ground-based instruments
never used for training. Specifically, the Cosmic-CoNN model trained on the Las
Cumbres CR dataset maintains high precisions of 92.03% and 96.69% on Gemini
GMOS-N/S 1x1 and 2x2 binning images, respectively. 3) We build a suite of tools
including an interactive CR mask visualization and editing interface, console
commands, and Python APIs to make automatic, robust CR detection widely
accessible by the community of astronomers. Our dataset, open-source codebase,
and trained models are available at https://github.com/cy-xu/cosmic-conn.
