Computer simulation studies of multi-phase systems rely on the accurate identification of local molecular structures and arrangements in order to extract useful insights. Local order parameters, such as Steinhardt parameters, are widely used for this identification task; however, the parameters are often tailored to specific local structural geometries and generalize poorly to new structures and distorted or under-coordinated bonding environments. Motivated by the desire to simplify the process and improve the accuracy, we introduce DeepIce, a novel deep neural network designed to identify ice and water molecules, which can be generalized to new structures where multiple bonding environments are present. DeepIce demonstrates that the characteristics of a crystalline or liquid molecule can be classified using as input simply the Cartesian coordinates of the nearest neighbors without compromising the accuracy. The network is flexible and capable of inferring rotational invariance, and produces a high predictive accuracy compared to the Steinhardt approach, the tetrahedral order parameter and polyhedral template matching in the detection of the phase of molecules in premelted ice surfaces.