Intelligent traffic lights are an important part of intelligent transportation systems. In this paper, the Bayesian network theory is used to establish a traffic light independent intelligent decision model based on dynamic Bayesian network. According to the real-time dynamic information of traffic conditions, the proposed dynamic Bayesian network approximate reasoning algorithm is used to realize online reasoning and determine the best traffic light time. The algorithm combines the time window with the improved forward-backward algorithm. By adjusting the time window width of the algorithm, the evidence information can be used to maximize online reasoning. Compared with the existing time window based on interface algorithm, it's proved that the reasoning algorithm proposed is more efficient. The research results of this paper have important practical significance in solving the traffic congestion problem and reducing the waiting time of people at the intersection of traffic lights.