Abstract—A standard traffic light schedule applies fixed timeintervals for the green lights. This might sometimes result intraffic congestion and blocking of roads. To overcome thisproblem this paper obtains an optimal solution for schedulingthe traffic light using machine learning technique. This papergives an overview of how to achieve a traffic light schedulewhich is more efficient in terms of number of vehicles stoppingat the red light in each direction, and more effective toreduce traffic congestion as compared to traditional schedulingmethods. This work presents an algorithm and a model toanalyze the traffic density at different times and predict theoptimal green time each directional traffic light should havesuch that the probability of a traffic congestion is reduced andorderly flow of vehicles on the road may be achieved. Thismodel decreases the number of vehicles stopping at the redlight at a given time by around 28%.Keywords – Intelligent Traffic Scheduling, Scheduling, Optimization, Linear Regression, Machine Learning1. IntroductionWith the increase in population and number of vehiclesper capita in cities around the world, road traffic control hascontinued to be a big problem for city planners. It is verydifficult for the cities to expand their road infrastructures.Even if it is possible to increase the number of roads, itis almost impossible to apply it in the central areas ofa city. Thus, they have to rely on various traffic controlmechanisms.This paper focuses on traffic lights without directionalsignals, i.e. traffic lights giving one green signal to onedirection, irrespective of the direction which the vehiclesturn to and irrespective of the lanes the vehicles are in. Itwill extended for directional traffic lights.Machine learning makes use of computational statisticsin order to improve and learn by its own. It predicts aboutthe amount of traffic that can be there at a particular intervalof time using the complete datasets.It is very important to have a proper and consistentdata in order to optimize the Traffic Scheduling. For thisto happen it is important to capture the amount of vehicleson the particular lane and for this purpose one can make theuse of highly efficient camera such as AIS-IV Camera. AISIV Camera is high resolution video traffic camera. It makesthe use of Autoscope machine vision processors along withAutoscope RackVision Terra and Autoscope RackVision Pro2. These camera usually has in built-in zoom lens andcolor imager with high sensitivity to ensure accurate vehicledetection at night. It minimizes streaking and blooming frombright light sources that could adversely affect detectionperformance.The AIS Camera creates a complete video vehicle detection system that is an alternative to other detectiontechnologies for many Intelligent Transportation Systems(ITS) applications; including intersection control, incidentdetection for bridges, tunnels, and highways, as well assurveillance applicationsThe radius for determination of number of vehicles isaround 100-120 metres from the centre of intersection forthis model.This model has two applications, one when adequateresources are available to count the current number ofvehicles on an intersection where the vehicle density andtime can be given as input to the model, and output will bethe green ratio. Another application is in the absence of suchresources, so the values of directional traffic can be takenfrom previous data and only current time will be requiredto obtain the green ratio.2. Related WorksStandard traffic lights fix the green light duration foreach direction. The duration of these lights are determinedon the basis of width of the roads, usual traffic on the roads,and type of the road. This method is efficient for handlingdaily traffic. But this model fails in places with unusualtraffic patterns.This model deals with change in traffic pattern every 15minutes. A sudden change in traffic can be easily handledwith this model.There are few works done in this field. In 1, Wirelesssensor networks are used to monitor real time traffic withthe help of wireless sensor networks. Their work only determines the number of vehicles, but does not consider timeas a factor. Though collecting real-time data for schedulingtraffic light might be accurate, but predicting the trafficdensity at different times will be more efficient.The paper 2 focuses on vehicular ad-hoc technology,which requires every vehicle in the influential radius ofthe traffic light must have a GPS, and should be ableto communicate with the system. The position, speed andvehicle density is calculated from each vehicle in the radius.This requires an existing infrastructure in all the vehicles.The Intelligent Traffic Light Scheduling using ML requirescameras and image recognition to calculate the number ofvehicles.The authors in 3 have calculated the average arrivalrate of vehicles using an algorithm. The arrival rate is basedon various factors including current number of vehicles ina queue. This model also does not consider the time as aparameter. The throughput can be increased if the expectednumber of vehicles at a given time are predicted beforehand.3. Proposed WorkIn this paper, the traffic is analyzed and a traffic lightschedule is developed for a four-way intersection. First, anoptimum green ratio is calculated for each direction foreach cycle of the traffic signal. An optimum green ratio isthe distribution of cycle time of the traffic signal is such away that the traffic density is approximately equal for eachdirection. A cycle time of a traffic light is the total time fortraffic light to complete its cycle of green lights for eachdirection. The obtained data along with traffic densities andtime are used to fit in a linear regression model. Then, thegreen ratios are predicted based on the input test data.3.1. Analysis of traffic patternsThe current traffic patterns of an intersection are analyzed. The average number of vehicles crossing the intersection in a day are plotted with respect to time.Figure 1. Time vs. North trafficFigure 2. Time vs. East TrafficFigure 3. Time vs. West TrafficFigure 4. Time vs. South TrafficFrom figures 1 to 4 it is clear that the maximumtraffic flow is around 8 am in the morning and 6 pm in theevening. The probability of traffic congestion is high duringthese peak hours. Efficient traffic scheduling is required themost around these times.3.2. Video Image Detection System Algorithms1 – Haar CasacadeHaar casacade basically which make the heavy use ofHaar Wavelets. In this basically we will make a databasewhich is composed of two sub databases – Negative andPositive Database. Positive database will contain the allthe images related to vehicles and their images related todifferent orientation of vehicles. Negative database containsthe any other images which are not related to vehicle. andthen we construct the feature vector out of it2 – Motion Based Multiple Object TrackingDetection of moving objects and motion-based trackingare important components of many computer vision applications, including activity recognition, traffic monitoring,and automotive safety. The problem of motion-based objecttracking can be divided into two parts: 1. Detecting movingobjects in each frame 2. Associating the defections corresponding to the same object over time The detection of moving objects uses a background subtraction algorithm basedon Gaussian mixture models. Morphological operations areapplied to the resulting foreground mask to eliminate noise.Finally, blob analysis detects groups of connected pixels,which are likely to correspond to moving objects. The association of detections to the same object is based solely onmotion. The motion of each track is estimated by a Kalmanfilter. The filter is used to predict the track’s location ineach frame, and determine the likelihood of each detectionbeing assigned to each track. Track maintenance becomes animportant aspect of this example. In any given frame, somedetections may be assigned to tracks, while other detectionsand tracks may remain unassigned. The assigned tracks areupdated using the corresponding detections. The unassignedtracks are marked invisible. An unassigned detection beginsa new track. Each track keeps count of the number ofconsecutive frames, where it remained unassigned. If thecount exceeds a specified threshold, the example assumesthat the object left the field of view and it deletes the track.3 – Object Tracking and Motion EstimationMotion estimationis the process of determiningmotionvectorsthat describe the transformation from one 2D imageto another; usually from adjacentframesin a video sequence.It is anill-posed problemas the motion is in three dimensionsbut the images are a projection of the 3D scene onto a 2Dplane. The motion vectors may relate to the whole image(global motion estimation) or specific parts, such as rectangular blocks, arbitrary shaped patches or even perpixel. Themotion vectors may be represented by a translational modelor many other models that can approximate the motion ofa real video camera, such as rotation and translation in allthree dimensions and zoom.4 – Speeded up robust featuresIn computer vision, speeded up robust features (SURF)is a patented local feature detector and descriptor. It can beused for tasks such as object recognition, image registration,classification or 3D reconstruction. It is partly inspiredby the scale-invariant feature transform (SIFT) descriptor.The standard version of SURF is several times faster thanSIFT and claimed by its authors to be more robust againstdifferent image transformations than SIFT. 83.3. ArchitectureFigure 5. Arhitectural Diagram of the modelFigure 6. Arhitectural Diagram of the model3.4. Algorithm to calculate Green RatioA simulation program was developed in Python to practically simulate and apply the changes of signal timings andits effect on the traffic on each road. Assume the frequenciesat which the vehicles arrive at the intersection from all fourdirections be nfreq, efreq, wfreq and sfreq respectively. Theabove mentioned simulator will increment the respectivevariables based on these frequencies.Assume the total cycle time as ‘T’, number of lanesas ‘N’, the time required for a vehicle to cross the stopline as ‘t’. Here, it is assumed that the number of vehiclesare equally distributed on the number of lanes for a givendirection.Let nratio, eratio, sratio and wratio be the green ratiosof north, east, west and south direction traffic lights respectively. Initially, all four values are set to 0.25, indicating thatall the directions will have equal share of green light.The given scenario is simulated for one traffic light cycle. After which the direction with most number of vehiclesis obtained. The green ratio of this direction is raised slightlyby a value of ‘d’. To maintain the sum of ratios as 1, a valueof d/3 has to be subtracted from all other ratios, thus slightlydecreasing the green time for that direction. For example,after the first cycle if west direction has the most traffic, itsgreen ratio will be wratio = 0.25+d and other ratios will benratio = 0.25-(d/3), eratio = 0.25-(d/3) and sratio = 0.25-(d/3).But if the traffic from one direction is extremely high, theratio for that direction may reach 1, disabling the green lightfor all other directions. To overcome this problem, someconstraints needed to be added while changing the ratio.Let l and u be the lower and upper bounds if the ratios.Before updating a ratio, it is checked whether the updationwill cause the ratio to be higher than u or lower than b. Ifit is, then the ratio remains unchanged and program skipsto the next traffic cycle, else the ratio is updated.For the program we used, the values of variables are asfollows:-T = 120 seconds 3N = 3, the roads have three lanesd = 0.03t = 0.25 4The more number of iterations the above program runson, the more accurate are the ratios. Once the optimum greenratios are obtained for each direction, they can be appliedin the Linear Regression Model.3.5. Model – Linear RegressionThe representation is a linear equation that combines aspecific set of input values (x) the solution to which is thepredicted output for that set of input values (y). As such,both the input values (x) and the output value are numeric.The linear equation assigns one scale factor to each inputvalue or column, called a coefficient and represented by thecapital Greek letter Beta (B). One additional coefficient isalso added, giving the line an additional degree of freedom(e.g. moving up and down on a two-dimensional plot) andis often called the intercept or the bias coefficient. Forexample, in a simple regression problem (a single x anda single y), the form of the model would be: y = B0 +B1*x In higher dimensions when we have more than oneinput (x), the line is called a plane or a hyper-plane.Therepresentation therefore is the form of the equation andthe specific values used for the coefficients (e.g. B0 andB1 in the above example). It is common to talk about thecomplexity of a regression model like linear regression.This refers to the number of coefficients used in the model.When a coefficient becomes zero, it effectively removes theinfluence of the input variable on the model and thereforefrom the prediction made from the model (0 * x = 0). Thisbecomes relevant if you look at regularization methods thatchange the learning algorithm to reduce the complexity ofregression models by putting pressure on the absolute sizeof the coefficients, driving some to zero. 73.6. Comparative AnalysisComparative analysis is done to compare the traditionaltraffic light scheduling with this model. For the comparisonbetween the two, the traffic in north direction is monitoredat regular intervals of 5 seconds. At a given time 7:15 AMFigure 7. Comparison for north direction traffic between traditional andnew modelWe obtained the traffic data of 45th St. & Main Ave.,Fargo, North Dakota, US. We used the website 2 to obtainthe datasets which contained monthly average values oftraffic from each direction of the intersection at a 15 min.interval.The downfalls in the graph represent the green time fornorth direction. The average values for both the graphs are:-For Equal Ratio Distribution = 4.930232558 vehiclesFor Predicted Ratio = 3.558139535 vehiclesThis is around 28% decrement in the number of vehiclesstopping at the red light. It can be concluded that thismodel is more efficient than the traditional model with equaldistribution.Figure 8. Map showing correlations between traffic from different directionsand timeThe above figure shows how much the traffic from eachdirection are correlated to each other and to the time.4. ConclusionThis paper has highlighted the need of a new trafficscheduling method. When the obtained linear regressionmodel was applied on a test data, the accuracy of predictionof green ratio was in the range of 55% to 60%. It wasfound that this model is better than the traditional schedulingmodel on the basis of avoiding traffic congestion. Thismodel decreases the number of vehicles stopping at the redlight at a given time by around 28%.5. References1 Evarist Nabaasa1 and Tonny E Bulega, Schedulingand optimization of traffic lights on a T-Junction using aWireless Sensor Network, International Journal of ScientificKnowledge,Vol.3, No.3, July 2013.2 Maram Bani Younes and Azzedine Boukerche,”An Intelligent Traffic Light scheduling algorithm throughVANETs”, 10th IEEE International Workshop on Performance and Management of Wireless and Mobile Networks,P2MNET 2014, Edmonton, Canada3 Zuraida Abal Abas, Lim Ee-Theng, Ahmad FadzliNizam Abdul Rahman, Zaheera Zainal Abidin and AbdulSamad Shibghatullah, “Enhanced Scheduling Traffic LightModel using Discrete Event Simulation for Improved Signal Timing Analysis”, ARPN Journal of Engineering andApplied Sciences, VOL. 10, NO. 18, OCTOBER 20154 NDSU The Upper Great PlainsTransportation Institute (UGPTI) ,http://www.atacenter.org/programs/ops/trafficvol/5 Signal Timing,http://cce.oregonstate.edu/sites/cce.oregonstate.edu/files/pw sigtime.pdf6 Signal Timing Design,http://www.webpages.uidaho.edu/niatt labmanual/Chapters/signaltimingdesign/professionalpractice/CycleLengthDetermination.htm7 https://machinelearningmastery.com/linearregression-for-machine-learning/8 Guohui Zhang, Ryan P. Avery, Yinhai Wang, “AVideo-based Vehicle Detection and Classification System forReal-time Traffic Data Collection Using Uncalibrated VideoCameras ”