The transient electromagnetic (TEM) method is widely used in shallow surface engineering geological surveys due to its advantages such as light weight, high efficiency, and strong resolution. However, interpretation and inversion of TEM data is a complicated process. The traditional algorithm of TEM inversion employs the "smoke ring" fast imaging method, which can only reflect the approximate morphology of the stratigraphic model, and the inversion accuracy is low. Therefore, this method cannot meet the requirements of high-precision inversion. In this paper, we present the particle swarm optimization (PSO) algorithm for TEM inversion. First of all, the response of the rectangular loop source TEM based on electric dipole integration was calculated and compared with the analytical solution results of the rectangular loop source and the accuracy of the algorithm was verified. Then, we introduced the solution process of the particle swarm optimization algorithm and analyzed the influence of particle swarm optimization algorithm parameter selection on the accuracy of the inversion result and the convergence speed. Next, a layered medium model was established. The particle swarm optimization algorithm and "smoke ring" fast imaging method were used to perform inversion calculation. The results show that the PSO algorithm has the advantages of high efficiency and accuracy. Finally, we examined the effectiveness of the particle swarm optimization algorithm for TEM data processing by inverting survey data from an Air-raid shelter on the campus of Chongqing University in China and comparing the results with those from the "smoke ring" fast imaging. The research works in this paper provide new methods and techniques for TEM data processing.INDEX TERMS Transient electromagnetic method; particle swarm optimization algorithm; fast imaging; inversion;