Basketball games, real-time adjustment of defense strategy according to the changes on the court can greatly improve the team's chance of success in defense and thus win the game. The development of artificial intelligence technology, especially computer vision, provides a technical basis for real-time tracking of players' positions and body postures. In this paper, a player posture estimation algorithm based on local spatial constraints is proposed based on motion tracking technology and deep learning technology. The algorithm is based on the general human body pose estimation algorithm, which locally constrains the picture based on the athlete detection frame, retains only the content related to the athlete in the picture, and then inputs the processed picture into the general human body pose estimation model for pose detection, and finally maps the detected pose back to the original picture to complete the estimation of the athlete's pose. The model is verified to be able to efficiently complete the real-time defensive strategy optimization task by using NBA game videos for testing.