In the railway container yard, there are few mature intelligent lifting prevention solutions available for train flatbed loading and unloading operations due to the poor detection accuracy or speed of traditional detection methods. This paper designs a train Flatbed Twist Rail (F-TR) lock anti-lifting detection method based on an improved BP neural network. The system collects weight and laser distance measurement data from the four locks of the hoist, establishes a flatbed lifting detection model based on the BP neural network, and optimizes the model's performance by incorporating a momentum factor and adaptive learning rate during weight adjustment. In practical tests, this system demonstrates a high detection rate and fast detection speed, offering intelligent safety protection for automated rail mounted gantry in the railway container yard.