Context. Stellar bars are a common morphological feature of spiral galaxies. While it is known that they can form in isolation, or be induced tidally, few studies have explored the production of stellar bars in galaxy merging. We look to investigate bar formation in galaxy merging using methods from deep learning to analyse our N-body simulations. Aims. The primary aim is to determine the constraints on the mass ratio and orientations of merging galaxies that are most conducive to bar formation. We further aim to explore whether it is possible to classify simulated barred spiral galaxies based on the mechanism of their formation. We test the feasibility of this new classification schema with simulated galaxies. Methods. Using a set of 29 400 images obtained from our simulations, we first trained a convolutional neural network to distinguish between barred and non-barred galaxies. We then tested the network on simulations with different mass ratios and spin angles. We adapted the core neural network architecture for use with our additional aims. Results. We find that a strong inverse relationship exists between the mass ratio and the number of bars produced. We also identify two distinct phases in the bar formation process; (1) the initial, tidally induced formation pre-merger and (2) the destruction and/or regeneration of the bar during and after the merger. Conclusions. Mergers with low mass ratios and closely-Aligned orientations are considerably more conducive to bar formation compared to equal-mass mergers. We demonstrate the flexibility of our deep learning approach by showing it is feasible to classify bars based on their formation mechanism.