In a dynamical system, the transition between reactants and products is typically mediated by an energy barrier whose properties determine the corresponding pathways and rates. The latter is the flux through a dividing surface (DS) between the two corresponding regions, and it is exact only if it is free of recrossings. For time-independent barriers, the DS can be attached to the top of the corresponding saddle point of the potential energy surface, and in time-dependent systems, the DS is a moving object. The precise determination of these direct reaction rates, e.g., using transition state theory, requires the actual construction of a DS for a given saddle geometry, which is in general a demanding methodical and computational task, especially in high-dimensional systems. In this paper, we demonstrate how such time-dependent, global, and recrossing-free DSs can be constructed using neural networks. In our approach, the neural network uses the bath coordinates and time as input, and it is trained in a way that its output provides the position of the DS along the reaction coordinate. An advantage of this procedure is that, once the neural network is trained, the complete information about the dynamical phase space separation is stored in the network's parameters, and a precise distinction between reactants and products can be made for all possible system configurations, all times, and with little computational effort. We demonstrate this general method for two- and three-dimensional systems and explain its straightforward extension to even more degrees of freedom.