Considering the issues of premature and slow convergence of the existing Particle Swarm Optimization (PSO) algorithms, a PSO algorithm incorporating Premature Detection mechanism and Opposite Random Walk strategy (PDORW-PSO) was proposed. Firstly, a modified Sigmoid function was designed by introducing a translation parameter to ensure that the output value of the function remained relatively small with small independent variable. Secondly, the times of the global extremum remained unchanged continuously was utilized as the independent variable for the modified Sigmoid function to calculate the probability of population premature. Finally, the particle positions were updated based on two randomly selected candidate solutions and the opposite solution of historical optimal particle solution, so as to enhance the population's ability to escape from local optima. Experimental results show that compared with the classical PSO algorithm and five improved PSO algorithms on eight classical test functions, PDORW-PSO achieves the best convergence accuracy and convergence speed among six comparison algorithms on five test functions. It can be seen that the convergence accuracy and convergence speed of PDORW-PSO are greatly improved compared with the comparison algorithms.