This study employs a deep neural network (DNN) model to investigate nuclear level density (NLD) using experimental data obtained using the Oslo method. The work focusses on lanthanide nuclei and period-5 nuclei; the DNN model predictions are compared with experimental results. Also, we compare our results with the HFB \(+\) Cmb (Hartree–Fock–Bogoliubov plus combinatorial) model results retrieved from the RIPL3 data. The DNN model demonstrates higher performance, yielding root mean square (RMS) error values of 0.098 \(\textrm{MeV}^{-1}\) for lanthanides and 0.101 \(\hbox {MeV}^{-1}\) for period-5 nuclei across a comprehensive spectrum of excitation energies. The observed nuclear level densities at very low excitation energies display anomalous behaviour that may be attributed to the nuclear pairing and shell corrections. These phenomena become less pronounced at higher excitation energies, leading to a more uniform level density trend. Even–even nuclei experience significant effects from pairing at lower excitation energies, changing the level density pattern. The present study predicts NLD using the DNN model for selected isotopes where experimental data are unavailable.