Upcoming large-area narrow band photometric surveys, such as J-PAS, will enable us to observe a large number of galaxies simultaneously and efficiently. However, it will be challenging to analyse the spatially-resolved stellar populations of galaxies from such big data to investigate galaxy formation and evolutionary history. We have applied a convolutional neural network (CNN) technique, which is known to be computationally inexpensive once it is trained, to retrieve the metallicity and age from J-PAS-like narrow band images. The CNN was trained using mock J-PAS data created from the CALIFA IFU survey and the age and metallicity at each data point, which are derived using full spectral fitting to the CALIFA spectra. We demonstrate that our CNN model can consistently recover age and metallicity from each J-PAS-like spectral energy distribution. The radial gradients of the age and metallicity for galaxies are also recovered accurately, irrespective of their morphology. However, it is demonstrated that the diversity of the dataset used to train the neural networks has a dramatic effect on the recovery of galactic stellar population parameters. Hence, future applications of CNNs to constrain stellar populations will rely on the availability of quality spectroscopic data from samples covering a wide range of population parameters.