Observations and simulations of Earth's bow shock and magnetosheath have revealed that the transition region hosts thin current sheets and highly twisted magnetic field structures, many of which undergo magnetic reconnection. These structures arise from turbulence and stream instabilities in the shock layer. In a recent study exploring the decay of these structures across a broad shock and solar wind parameter space [Gingell et al. 2023, Physics of Plasmas, 30, 0123902], we identified reconnected magnetic field structures by means of magnetic field line integration, classifying the two-dimensional simulation domain into regions of ‘open' and ‘closed' magnetic field topology. Here we use these classifications to train a convolutional neural network, which in turn is able to identify regions of ‘closed' magnetic field without knowledge of the broader spatial topology and time history of the surrounding plasma. Importantly, the trained model allows one to efficiently identify structures of interest in i) simulations with different shock and solar wind parameters, ii) three-dimensional simulations (where reconnection does not necessarily require truly ‘closed' topologies) and iii) in time series data from in situ spacecraft observations from Magnetospheric Multiscale. We explore the application of this model to ion kinetic-scale processes associated with the bow shock, magnetosheath and interplanetary shocks. We also discuss this technique more generally as a case study for using machine learning techniques to identify structures in spacecraft data given a phenomenon seen in plasma simulations.