To process magnetic anomaly data, appropriate parameters for field separation, denoising, and Euler deconvolution have to be manually selected. The traditional workflow is inefficient and cannot fulfill the rapid detection of submarine cables due to the complex processing and manual parameter tuning. This study presents an end-to-end deep learning approach for the identification and positioning of submarine cables based on magnetic anomalies. The proposed approach effectively establishes a direct mapping correlation between the magnetic field data and the position of the submarine cable. Synthetic tests suggest that our method has a better performance in terms of positioning accuracy than the conventional Euler method. Our results for the field data are comparable to those obtained using conventional techniques. Furthermore, the proposed method achieves an optimal solution by employing clustering technique and selecting the solution with the maximum confidence, which avoids spurious solutions associated with traditional methods. The proposed method can directly determine the position of the submarine cables using the raw magnetic field data. Contrary to the traditional processing workflow, field separation and denoising are not necessary in this novel approach, resulting in higher processing efficiency and a simpler processing process.