Solving the eigenvalue problem for differential equations in inhomogeneous media poses a significant challenge across diverse scientific fields. While classical finite difference methods and finite element methods have produced numerous outcomes, they heavily rely on discretizing the computational domain, which can introduce complexities and limitations. In this study, we present an unsupervised neural network approach tailored for finding eigenpairs in Sturm-Liouville eigenvalue problems within inhomogeneous media. Our method introduces eigenvalues as trainable parameters, crafts a novel cost function, incorporates an adaptive hyper-parameter tuning strategy, and sequentially trains the eigenpairs. The simplicity, accuracy, and interpretability of our approach significantly expand its applicability across various domains. The method we present in this paper can easily tackle boundary value conditions with derivatives, resulting in orthogonal eigenfunctions. This is a very important advantage of deep learning methods that has not yet been noticed. Quantitative estimation of eigenpairs is given for the Sturm-Liouville eigenvalue problems. Furthermore, we extend the proposed methodology to tackle two-dimensional cases, periodic scenarios, demonstrating its versatility and broad potential. For more information see https://ejde.math.txstate.edu/Volumes/2024/53/abstr.html