The purpose of mobile robot path planning is to produce the optimal safe path. However, mobile robots have poor real-time obstacle avoidance in local path planning and longer paths in global path planning. In order to improve the accuracy of real-time obstacle avoidance prediction of local path planning, shorten the path length of global path planning, reduce the path planning time, and then obtain a better safe path, we propose a real-time obstacle avoidance decision model based on machine learning (ML) algorithms, an improved smooth rapidly exploring random tree (S-RRT) algorithm, and an improved hybrid genetic algorithm-ant colony optimization (HGA-ACO). Firstly, in local path planning, the machine learning algorithms are used to train the datasets, the real-time obstacle avoidance decision model is established, and cross validation is performed. Secondly, in global path planning, the greedy algorithm idea and B-spline curve are introduced into the RRT algorithm, redundant nodes are removed, and the reverse iteration is performed to generate a smooth path. Then, in path planning, the fitness function and genetic operation method of genetic algorithm are optimized, the pheromone update strategy and deadlock elimination strategy of ant colony algorithm are optimized, and the genetic-ant colony fusion strategy is used to fuse the two algorithms. Finally, the optimized path planning algorithm is used for simulation experiment. Comparative simulation experiments show that the random forest has the highest real-time obstacle avoidance prediction accuracy in local path planning, and the S-RRT algorithm can effectively shorten the total path length generated by the RRT algorithm in global path planning. The HGA-ACO algorithm can reduce the iteration number reasonably, reduce the search time effectively, and obtain the optimal solution in path planning.