In passive sonar, the frequency spectrum of a sound radiated by underwater moving targets is composed of a broadband nonuniform background noise and narrowband discrete tonals. To detect the tonals, the background noise is estimated and removed. Using the existing algorithms that estimate the background noise, a week tonals are not detected. Because a freuqency line that is formed by tonals which are being extracted continuously is a feture of the target, we are nessesory to efficiently detect the tonals that compose the frequncy line. In this paper, we propose an efficient neural network that can remove automatically the background and detect the even errl tonals, and we extract the frequency line feature on the spectrogram by the proposed algorithm. The experimental results for a ship's radiated sound show a better performance in comparison with the existing TPM algorithm.