An Artificial Intelligence based approach to estimating time of arrival and bus occupancy for public transport systems in Africa
SSmart bus tracking and monitoring systems -An Artificial Intelligence based approach toestimating time of arrival and bus occupancy for public transport systems in Africa
A thesis submitted for the degree of
Bachelor of Science (BSc.)in Electrical and Electronic Engineering by Appau Ernest Kofi Mensah
Principal Supervisor: Mr. Emmanuel Addo a r X i v : . [ c s . C Y ] J a n epartment of Electrical and Electronic EngineeringCollege of EngineeringKNUST, Kumasi June, 2020ii
Creativity is just connecting things.” — Steve Jobs. bstract
This document entails a progressive report on the design and implementation ofa bus tracking and monitoring system . This report has its contents within the limitsof five chapters with each concisely exploring their various objectives. Chapter oneis the introductory chapter. It entails a brief description of a bus tracking andmonitoring system ,the need and the aims and objectives of this project. Chaptertwo consists the literature review of this project. This entails the critical analysis ofprevious related research and projects undertaken by other people. The merits anddemerits of the various implementations.Chapter three consists of theory and designconsiderations of the proposed system for Kwame Nkrumah University campus.Chapter four talks about the methods used to collect data and the approach andtechnology stack adopted to build the proposed system.Chapter five concludes thethesis and discusses the results of test and deployment of the proposed system onKwame Nkrumah University of Science and Technology campus. eclaration
We hereby declare that this project “Smartphone based bus tracking and monitoringsystem with estimated time of arrival and bus occupancy count using linear regressionmodel and Neural Networks” is our submission as the original work done by us throughresearch and under the supervision of Mr Emmanuel Addo for the reward of a degreein BSc Electrical/Electronic Engineering. All sources of information ad literature in thiswork has been referred.Name: Appau Ernest Kofi MensahSignature:Date: June, 2020. cknowledgements “Its the not the Destination, It’s the journey” - Ralph Waldo Emerson. Embarking on afour year journey back in April 2016 which has been filled with moments of joy,discoveryas well as the tough days filled with frustration, in the heat of all these roller coastermoments, I have come to realise life is a journey one cannot embark on alone but withthe help of others along the way.The lessons I have learnt through this journey are gemsand will forever cherish with it and grow. I never would have made it this far without thegreat advise and mentorship of these great people part of my journey over the years. Toall these people I would like to express my profound gratitude. ontents
List of Figures ixList of Tables x1 Introduction 1 ontents ontents viii ist of Figures ix ist of Tables x hapter 1Introduction The real-time update is very essential in the design and operation of an efficient bustracking and monitoring system. However, due to the lack of information on the accuratebus estimated time of arrival (ETA), current location and occupancy (congestion andnumber of seats available), students find a lot of issues using public transport systems onKwame Nkrumah University of Science and Technology campus. Vehicle Location andtracking systems, have been adopted by many companies such as Uber, Bolt, and transitagencies in major cities and university campuses which allows riders to track their transitvehicles in real-time. While the provision of real-time information, such as bus locationusing GPS coordinates, is relatively straightforward, predicting transit information, suchas when a bus will arrive at a particular bus stop and the occupancy, is significantlymore complex, because of the complexity of the inputs and the multivariate, non-linearand parametric nature. To predict travel time, in an accurate and timely manner, theconsideration of driving footprint unique to a particular driver and traffic is and otherparameters are essential. The buses on KNUST campus have helped general users and1 .1. Background students in their daily commute from their various central bus stop to their faculty andcollege areas on campus where they have their lectures and back. Due to the lack of abus monitoring and tracking system, students find it hard to get real-time updates onthe route, location, occupancy, estimated time of arrival of the buses which would enablethem to make decisions related to their commute on campus. The lack of such a systemalso creates this problem where the campus bus management team is unable to forecastthe future demand and use of the buses which would help in the future policies in makingprovision and allocating resources related to bus commute on KNUST campus.The study in this report focuses on the design and implementation of a bus trackingand monitoring system that can provide students with a real-time update on the route,location of a bus, estimated time of arrival of the buses at each stop using machine learningtechniques using regression models and provide the occupancy of a bus using a computervision-based convolutional neural network. This tracking and Monitoring system willconsist of an app for the driver which will track the bus using GPS and google maps andone for the students who want the real-time update of the bus’s location, estimated timeof arrival, and occupancy. There will be a microcontroller fitted with a camera on-boardthe bus which will use a pre-trained convolutional neural network architecture to providethe occupancy of a bus at certain time intervals. The web application is designed anddeveloped as an alternative of a graphical user interface to assist students in monitoringthe real-time location of the bus and plan their journey based on information providedsuch as bus routes, bus stop number and bus arrival time and bus occupancy.
1. The bus Tracking system is needed on campus to help students : • Get access the time of arrival of the bus at the various stops close to them toget to the bus stop on time to commute to and from class2 .1. Background • To get information about bus schedules so that they plan their commute oncampus for the day • To get alerts and monitor the arrival of the bus at certain dedicated bus stopson campus • To get access to information about bus seat availability and occupancy oncampus to make data-driven decisions about commute on campus.2. University Administration and transport department: • The bus tracking system is needed on campus to aid both the administration inmaking data-driven decisions about the convenience and other matters relatedto students’ well-being as far as a commute on campus is of concern. • Maintenance department need the bus monitoring system to aid them in pre-dictive maintenance of the buses on campus
Due to the lack of bus tracking system students were; • Late for lectures due to missing the buses when they arrived at the stops, and dueto the lack of a bus schedule. • Unable to plan their commute properly in a day due to the lack of such a system inplace • Unable to get knowledge about the occupancy of buses thus would always rush toboard overcrowded buses which poses a danger to all passengers on board, health-wise and safety-wise. 3 .2. Aim
Unfortunately, there were no efficient measures put in place. The busing system had notbeen around for very long thus it was a matter of adaptation. The maintenance depart-ment placed strict policies on drivers of campus bus to pick an acceptable number ofstudents on the buses which proved availed to nothing. Students board the overcrowdedbus and it became a culture amongst them. When we got into contact with the mainte-nance and transport department of the school, they had been testing out an upcomingsystem to ease the problem of the commute of students. • Our system will be able to provide students and staff that patronize campus buseswith the advantage of getting access to information about bus routes, locations,alerts as to when a bus arrives at a bus stop on campus. • Our system will help the university on making data-driven decisions and policiesfrom data mined from our system and can also help the maintenance departmentin predictive maintenance of buses
To design and implement a bus tracking and monitoring system that can help studentsget real-time updates of the planned bus routes, location of buses on a map, estimatedtime of arrival between bus stops and provide the level of occupancy(seats available) in abus to enable a student make informed decisions on the KNUST campus.4 .3. Objectives
1. Develop and optimize a machine learning regression model to help predict the esti-mated time of arrival of a bus on the KNUST campus based on parameters loggedfrom the driver’s app2. Develop and deploy a pre-trained convolutional neural network on a microcontrollercoupled with a camera to help determine the occupancy of buses3. Develop a mobile app to track and log the GPS coordinates of the bus drivers andother parameters using GPS and google maps4. Develop a mobile app and a web app as an alternative for students on the KNUSTcampus to get real-time updates of location, routing, estimated time of arrival andoccupancy (number of seats available) of the busses5 .3. Objectives hapter 2Literature Review In this chapter, we review and discuss the existing works related to our research objectives.
Many vehicle tracking systems make uses of a GPS tracking component. There are manydevice specifications and types based on system requirements and architecture specifica-tions. Some of the GPS tracking components are already built by manufacturers and canbe assembled using hardware-based components; microcontrollers, a GSM module, anda GPS shield. These three components are basic components needed to put together afairly efficient tracking unit to be installed in vehicles. The workflow after installationinvolves the administrator receiving logs (coordinates, timestamps, and other parameters)that are streamed and stored in a central database and used to track the current loca-tion of devices. Such an architecture provides an interface where assets can be trackedwithout the knowledge of a driver and would be suitable in the use case where the admin-istrator needs to track a few devices and assets without the knowledge of others. In thecase of fleet management, such an architecture is bound to face issues such as scalability,7 .2. Related Works cost of hardware, Network latency, device computation, and power constraints due to thefairly high number of vehicles and assets hence the word “fleet”. In our use case, ourproposed system deals with the issue of deployment, implementation, scalability, fastercomputations with no power constraints, and easily integrated into a large user base onthe KNUST campus. We intend to model our system after the very best in the transportarena which is a company called Uber which uses mobile-based apps for tracking and pro-viding other related services, and in the age where we find ourselves with improvementsin technology and the availability of computing devices that generate a lot of data, ourproposed system intends to develop a pipeline to make eta predictions based on machinelearning algorithms such as light trees from Microsoft and Cat boost algorithm recentlydeveloped by Yandex. In the following section, we review the related work done in thisfield and observe the strengths, weaknesses, how these observations will be factored intoour system to improve the efficiency to solve the issue of bus tracking and monitoringwith a commute on KNUST Campus.
In this paper, the authors in review built an android based app for the student and onefor a driver was used to track the location of the bus by sending the bus coordinates ona specific route to a central database hosted online. The got real-time updates of thebus location at regular intervals as well as the timeline schedule of the buses and used araspberry pi microcontroller coupled with a webcam to enable the counting of people ona specific bus in real-time. Based on their evaluation and tests they were able to achievethe aim of providing a real-time update of the location of the bus for students on campus.8 .2. Related WorksStrengths
1. They were able to achieve the aim of providing real-time location, coupled with agraphical user interface to prove updates of the schedule and movement of the buses2. An IOT based people counting module provided an add on feature to improve busmonitoring3. Their software-based approach makes their solution high scalable
Weaknesses
1. Unfortunately, their paper had little detail about the evaluation and implementationof the estimated time of arrival of the buses2. Their paper had little details about the performance evaluation of their image pro-cessing people counter and the architectures used to implement such a model3. Traffic was not factored into their estimated time of arrival
In this paper, the authors in review proposed system included a tracker made from anESPRESSO lite V.2 board, a WIFI module and GPS module which was embedded intoa bus to send real-time location data to a database, a web application to show the usersthe location of the buses and Estimated time of arrival of buses function based on thehaversine great circle formula. 9 .2. Related WorksStrengths
1. The Espresso v.2 board is fast enough to stream the location data to the centraldatabase2. They provided a function to estimate the time of arrival using the haversine greatcircle formula
Weaknesses
1. Their proposed estimated time of arrival function would not provide the accuratetime of arrival of buses2. The Wi-Fi-based model module would be useless and ineffective in the case wherethe is no WIFI reception in an area of their campus3. Due to the movement of the buses, the bus IOT Tracker would suffer physicaldamage and stop the transmission of data if the road network on campus has a lotof bumps4. Their system wouldn’t be able to scale in the case where there is an increase in thenumber of buses due to the cost of the hardware units of the GPS tracker
In this paper, the authors in the review used an Arduino based tracker coupled to a WIFImodule and a GPS based module was used. The Arduino based tracking unit transmitsthe coordinates of the bus location to a server and the location of the buses is displayedon a website which can be assessed on the phones and laptops of students10 .2. Related WorksStrengths
1. The Arduino Uno board meets the specifications of their system design to andconnections to log location coordinates to a server
Weaknesses
1. There was no proposed estimated time of arrival function or system2. The Wi-Fi-based model module would be useless and ineffective in the case wherethe is no WIFI reception in an area of their campus3. Due to the movement of the buses, the bus IOT Tracker would suffer physicaldamage and stop the transmission of data if the road network on campus has a lotof bumps
In this paper, the authors in review built an app for a student is used to request thelocation of a bus. The driver has an app that streams its location to a database. Thestudent signs up and his or her information is stored in a database. The used an androidSoftware development kit to develop the mobile app. The driver app-enabled him to selectwhich bus he or she is driving.
Strengths
1. The software design of their database enables the school management to keep trackof the number of students signed up onto the service11 .2. Related Works
2. Their proposed systems enable students to get information related to bus locationsand routes in real-time.3. The design of the driver’s app enables them to collect information on the driver’shabit which provides them the avenue to predict the eta in the future
Weaknesses
1. No provisions were made to predict the estimated time of arrival, and Bus occupancy2. Their system was not well modeled and would raise issues related to scalability
In this paper, the authors in the review used three layers to implement their system, ahardware layer, a communication layer, and an application layer. The hardware layerconsisted of a microcontroller connected to a GPRS /GSM modem, RFID reader, and aSIM28ML GPS module for transmitting location coordinates, RFID ID data, and usingthe GPRS/GSM modem in the communication layer. The application layer involved acloud server for storing the logged data, a graphical user interface for displaying thelocation of the school bus, and a prediction engine that made uses of Kalman filters topredict the estimated time of arrival of the buses.
Strengths
1. The proposed system catered for the estimated time of arrival of buses using Kalmanfilters2. Their system provides SMS alerts including other channels of notification of buslocations 12 .2. Related WorksWeaknesses
1. The performance metric of their Kalman filters can be improved with artificial neuralnetworks and other machine learning techniques.
In this paper, the authors in the review used a location tracking device made of a micro-controller, a GPS module, an AT and T sim card, a GPRS/GSM module, and a quad-bandantenna was used to track the location of the bus which was streamed to a database andaccessed by students from a mobile application.
Strengths
1. Their proposed system can track the location of the buses2. The sim-based module attached to the microcontroller is better than a WIFI module,in the sense that, it would help transmit the location coordinates even if there is noWIFI reception in the area
Weaknesses
1. No provisions were made for the estimated time of arrival and vehicle occupancycount2. Their hardware tracking device is prone to physical damage and failure due to bumpsif the road network on campus is not good.13 .2. Related Works
In this paper, the authors in the review used tracking hardware (made up of an ArduinoUno Microcontroller, a Sim 900 GSM/GPRS module, and a GPS shield) is placed on aminibus to log the coordinates of the bus into a database. It also has a web server thencalls the data and plots it on an embedded Google Map. The system administrator viewsthe location of the minibus, registers new drivers, and assigns buses to them.
Strengths
1. To provide the user with the location of the bus and the distance between the busand the user.
Weaknesses
1. The system does not provide any information on the estimated time of arrival ofthe minibus.2. The congestion level in each bus cannot be determined by the user. Hence, studentswaiting for the bus are usually disappointed especially when the arriving bus is full
In this paper, the authors in the review provided each college bus is provided with anandroid phone with a tracking application installed in them. A similar application isinstalled on the user’s phone. The android mobile tracks the location of the bus using14 .2. Related Works
GPS and gives the exact location of the bus. The GPRS receiver modem retrieves thelatitudes and longitudes from the sender. The location details such as bus number andits route are stored in the database. The system is based on a GPRS modem and is aweb application integrated with the mobile device to transfer the data and the studentcan view the report through the mobile application.
Strengths
1. The system provides information on the estimated time of arrival of each bus.2. It also verifies that a student has boarded the bus by sending SMS to their registeredmobile numbers.
Weaknesses
1. Traffic congestion was not factored in deriving the estimated arrival of the buses.2. The application is not online so the live location of the bus cannot be tracked.
In this paper, the authors in review decided to implement a system for buses using Wi-Fiand real-time tracking mobile application; where the buses arrive at the bus terminal, thebus’s Wi-Fi module connects to the router and sends the address of the bus (location ofthe bus in longitudes and latitudes) to the cloud and the data is retrieved from the cloudand displayed to the user via the mobile application.
Strengths
1. Real-Time tracking of the bus using google location (latitudes and longitudes)15 .2. Related WorksWeaknesses
1. There were connectivity limitations to the router at bus stops due to peak periods.2. There was always a lag in the real-time location because the buses only uploadedtheir location when at the bus stops.3. No estimated time of arrival (ETA)
In this paper, the authors in the review’s system were based on GPS technology whichenabled the college management team to keep a better eye on the activity of collegebuses and manage schedule as well as provide real-time bus locations for students. Theproject proposed the use of an android mobile phone application using JAVA programminglanguage.
Strengths
1. Their proposed system can track the location of the buses2. The system provides information on the estimated time of arrival of each bus.
Weaknesses
1. The congestion level in each bus cannot be determined by the user.2. There was no proposed estimated time of arrival function or system.16 hapter 3Theory and design considerations ofour proposed system
A general bus tracking system consists of a GPS based device for logging the location coor-dinates to a database, a graphical user interface to view the location of the bus, and othercomponents and layers ranging from the hardware to communicate and software-basedlayers. This system can be deployed with a wide range of technologies and architecturaldesigns which include a client-side model and a server-side model. The estimated timeof arrival prediction consists of a time series model based on machine learning. Thebus occupancy involves the use of artificial neural networks coupled with computer-visionlibraries. We explain the theory behind the various technology components in a bus track-ing and monitoring system, time series-based machine learning approaches, and computervision-based object detection edge devices. 17 .2. Overview of a Global Positioning system
GPS, the main component of every device tracking and mapping system is defined by JoelMcNamara (McNamara 2004) as a smart satellite system that can pinpoint a positionanywhere on planet Earth. GPS is a radio receiver measuring the distance from a givenlocation to satellites that orbit the Earth broadcasting radio signals. The GPS receiverneeds to get the location from a minimum of three satellite signals. Moreover, it requiresfour satellite signals to get a position in three dimensions (i.e., latitude, longitude, andelevation). GPS is used for navigation and location positioning by the military, thegovernment, and civilians; however, radio signals have been used for navigation since the1920s.
The distance between the position of the GPS satellite and the GPS receiver is calculatedby using Equation 1.1 (Corvallis Microtechnology 2000; McNamara 2004; Raju 2004; TTU2012). Distance =speed x time In other words, a GPS receiver determines the amount oftime it takes the radio signal (i.e., GPS signal) to travel from the GPS satellite to the GPSreceiver. The GPS signal travels at the speed of light (186 thousand miles per second).Both the GPS satellite and the GPS receiver generate an identical pseudo-random codesequence. When the GPS receiver receives this transmitted code, it determines how muchthe code needs to be shifted for the two code sequences to match. Therefore, the shift ismultiplied by the speed of light to determine the distance from the GPS satellite to theGPS receiver. GPS satellites are orbiting the Earth at an altitude of 11 thousand miles(Corvallis Microtechnology 2000; Raju 2004; TTU 2012). Assuming that the GPS receiverand the satellite clocks are precisely and continually synchronized, the GPS receiver usesthree satellites to triangulate a 3D position, then the GPS provides coordinates (X, Y,18 .3. How the location of a position is done with GPS
Z) for a calculated position. However, a GPS receiver needs four satellites to provide a3D position. Since the GPS receiver clock is not as accurate as of the atomic clocks inthe satellites, then a fourth variable T for time is determined in addition to the threevariables (X, Y, and Z). The Global positioning system was initially made for militarypurposes but as time passed by, it was made open for public use by the Americans. There2 major vendors that provide map services using GPS through application programminginterfaces and they are Google with google maps, Apple with map kit with google beingthe most popular and commonly used mapping system with GPS
The global positioning system can be distinguished into three segments that are thespace segment, control segment and user segment as shown in the diagram above. Thespace segments consist of the satellites in orbit around the earth at an altitude of 20,200km in space. Each satellite transmits a signal which contains a sine wave with carrierfrequencies, two digital codes, digital codes, and a navigation message which helps to tellthe location of the satellite to the earth. The control segment of the GPS is controlledby the U.S. Army. It consists of a worldwide network of tracking stations, with a MasterControl Station (MCS) located in the United States. The control segment aims to operateand monitor the GPS. The main objective of the control segment is to track the GPSsatellites to determine and predict satellite locations. The user segment includes allmilitary users of the secure GPS Precise Positioning Service, all civilian users, all GPSreceivers and processing software, and commercial and scientific users of the StandardPositioning Service. Currently, the GPS service is free with no direct charge19 .4. Artificial Intelligence and machine learning
GPS receivers are applied for fleet management in terrestrial systems (e.g., road and rail)to track the location of vehicles. GPS receivers can allow real-time tracking, detect whena vehicle is outside of the predefined defense, save fuel consumption costs by helpingthe driver to choose the optimal route, store up a certain number of tracking recordswhen a connection is lost, remotely power off a vehicle, control fuel consumption, andtemperature, detect when a vehicle is driven over the speed limit, monitor voices, and otheractivities. Moreover, GPS receivers are used to secure vehicles from theft by informingthe concerned users via an alert message
Recent years have seen significant advances in the potential and capabilities of artificialintelligence techniques. Various applications can be observed all around us where manypeople interact and AI-enabled systems such as image recognition systems in our socialmedia platform for face tagging, autonomous vehicles popular among them are self-drivingcars as well as natural language processing virtual assistants and recommender systemsbased on online services such as YouTube and Amazon.
Artificial intelligence is an umbrella term that refers to a suite of technologies in a com-puter system programmed to exhibit complex behavior similar to one that humans andanimals would display when faced with challenges in an environment. Artificial intelli-gence is under a bigger umbrella of computer science with an intersection of mathematicsand statistics. The various sections and fields under artificial intelligence include ma-chine learning which has deep learning embedded within. Data science is also a field20 .4. Artificial Intelligence and machine learning that intersects with artificial intelligence. Due to the availability of human and machine-generated data, this field coupled with artificial intelligence helps determine insights andmake predictions based on historical data.
Machine learning as the term goes is a subfield embedded within artificial intelligence andcomputer science that is concerned with building algorithms that can be useful to theprediction and classification of a phenomenon or process. It involves the processing ofsolving a problem by gathering a dataset and algorithmically building a statistical modelon that dataset. Machine learning can be supervised, unsupervised, and reinforcement.Supervised is a machine learning approach that involves a dataset that has a set of la-bels or outputs on which an algorithm would generate a statistical model based on amapping sequence. Supervised machine learning algorithms include classification modelsthat can help predict a category and regression models that can provide statistically esti-mated value based on a model generated on a dataset. Some classification models includelinear regression, support vector machines, gradient boosting and classification models in-clude Na¨ıve bays, k-nearest neighbor, logistic regression, and decision trees. Unsupervisedlearning involves generating models on a collection of datasets that have unlabeled exam-ples or results. Reinforcement learning involves the creation of an agent that traversesa computational environment based on rewards. A subfield of machine learning is deeplearning which is, the application of state of the art perception’s called neural networksto solve computational problems. Neural networks are fashioned after the architectureof the neurons in the human body which help humans in performing tasks among manyothers .deep learning has seen massive adoption in the field of computer-vison, naturallanguage processing among many others. The popular algorithms under deep learning arerecurrent neural networks used for solving text-based problems and convolutional neural21 .4. Artificial Intelligence and machine learning networks used for image processing use cases
An edge device is a term used for an internet of things microcontroller with sensors usedto collect data. It is a device that lives at the edge of a network and performs work orinference in the exact location. The traditional flow of data through a machine learningsystem involves a process where; Information is collected from the environment by adevice, the resulting data is sent via a network connection to a hosted backend serverwhich performs an inference or prediction based on a machine learning model and ifnecessary the server then sends the results back to the device or other devices subscribedto receive information on that inference. In the case where we can perform inference onthe device collecting the data itself, we can skip a lot of steps which provides a lot ofadded advantages as follows;
In our case we are checking for bus occupancy count, when our edge device counts thenumber of people using a machine learning model hosted on it, it can use tiny amountsof bandwidth to send back the count of the people without the need of having to streama video.
Sending data to a server involves a round trip delay which gets in the way when workingwith real-time data. This is no longer an issue in our case when using an edge device toperform inference, and in this case, the inference is superfast based on the architectureand specifications of the device. 22 .5. Our proposed solution for the bus tracking and monitoring problem3-Cost and reliability
Hosting a machine learning model on a server in the cloud comes with a cost when anendpoint is called to perform inference but with our model hosted on our edge device, wecut down cost. And by simplifying our backend server, we improve reliability.
When data stays on the device for inference, a user benefits from the increased privacyand security since personal information never leaves the edge device. This enables newprivacy-aware conscious applications that analyze metrics without sending data to thecloud.
Our proposed system of a bus tracking and monitoring system includes three sectionswhich are server-side section, client-side section, and monitoring section.
This includes a hosted cloud platform on a server that has the backend, the databaseto store several fields, and a frontend which is a website of a map interface that canbe accessed using a website address by any student or general user of the bus systemon campus. It can help the students and general users track the location of a bus andget information if the estimated time of arrival and bus occupancy. The server side alsoincludes the platform which will host the time ,sub-components include the following:23 .5. Our proposed solution for the bus tracking and monitoring problemDatabase
This is a firebase database from google which is based on a NoSQL document objectmodel that makes use of JavaScript object notation and can be used to stream real-timedynamic location logs from the tracking device onto the map as markers
Backend
This is the section hosted on the server that contains code that runs the logging of locationcoordinates from the database onto the map of the frontend and other functions such asthe estimated time of arrival and bus occupancy count. It is based on a JavaScriptframework called Node.js.
Frontend
This section includes code hosted on the server based on hypertext mark-up language,cascading style sheets, and JavaScript framework. It is the graphical user interface whichdepicts the map of KNUST campus with the various markers including the bus for trackingthe location of the bus on various routes
Server
It is the cloud software platform on which the various components such as the frontendare hosted on and connected to a network that can be accessed by a website address toview the graphical user interface. We will use a metered server provided by the googlecloud platform service to host our server.
Regression machine learning model
This is a model hosted on IBM Watson machine learning server which uses an automatedarchitecture to perform feature engineering, scaling and selection of various models, train24 .5. Our proposed solution for the bus tracking and monitoring problem them on the dataset provided tunes the various hyperparameters and provides variousscores of models with the best which are ranked based on the metrics such as the rootmean square error, mean average error and mean squared error among many others. Itgenerates an application programming interface that will be integrated into the mobileapplication of the students to predict the estimated time of arrival of the bus.
Drivers app
This app will log the location coordinates and other parameters to help users such asstudents track the bus and get information related to the estimated time of arrival ofthe bus and bus routes. This app is being built on an android studio software standarddevelopment kit from Google.
Student and general users’ app
This mobile application is built using the android studio.it will help students track bus,get real-time updates of bus routes and locations as well as get information related to theestimated time of arrival
Edge device
This device is an inference device which consists of a raspberry pi microcontroller whichis WIFI enabled, that is connected to a pi camera.it has a machine learning model hostedon it which would be used for inference (counting people on the bus and checking seatavailability) and contains a message layer for transmitting the statistical message of peo-ple count to a graphical user interface. The edge device is made up of the following25 .5. Our proposed solution for the bus tracking and monitoring problem components with their specifications and requirements for our proposed system pi cameraraspberry pi 3 micro-controller board
This model uses pre-trained neural networks from the open vino library provided by Inteland OpenCV, computer vision (CV) library filled with many different computer visionfunctions, and other useful image and video processing and handling capabilities to processand count the number of people in the bus.
Message and video transport protocolMQTT-message queuing telemetry transport
MQTT-message queuing telemetry transport A publisher-subscriber protocol often usedfor IoT devices due to its lightweight nature. The paho-MQTT library is a common wayof working with MQTT in Python. The publisher-subscriber protocol is a messagingarchitecture whereby it is made up of publishers, which send messages to a central bro-ker, without knowing of the subscribers themselves. These messages can be posted onsome given “topic”, which the subscribers can then listen to without having to know thepublisher itself, just the “topic”
FFMPEG-fast forward Mpeg
It’s a Software that can help convert or stream audio and video. In our proposed system,the related server software is used to stream to a web server, which can then be queriedby a Node server for viewing in a web browser.26 .6. Why we chose raspberry pi as our edge deviceNode.js server-
A web server built with Node.js that can handle HTTP requests and/or serve up a webpagefor viewing in a browser.
A lot of consideration was taken into mind in selecting a suitable microcontroller thatwould enable us to achieve the objective of bus occupancy count which are as follows:1. Power consumption • From the image above, it can be observed that the raspberry pi is the micro-controller with the moderate power consumption that suits the specificationsof a platform to support a bus occupancy count computer vision model2. Price of the microcontroller • From the image above, it can be observed that the raspberry pi is the micro-controller with the moderate power consumption that suits the specificationsof a platform to support a bus occupancy count computer vision model3. Processing power • It can be observed that the raspberry pi has a suitable processing power thatmeets our edge device specifications.4. Connection Interface and features • It can be observed that the raspberry pi has interfaces that can support con-nections for a camera for bus occupancy count. .27 .7. Why we chose firebase as our database platform
Firebase is a robust free tier and popular database platform that is easy to integrate withapps and software. Thus, it will aid us in building our proposed system28 hapter 4Methodology
This chapter expands more on the methods used in collecting data and the approach wetook towards building our bus tracking and monitoring system .
We visited the vehicle maintenance department of KNUST, spoke with the engineer incharge, who provided us with information on the schedules, routes, the number of buses,and drivers dedicated to these buses. We collected data based on the routes the bus wescheduled to move on. We had a total of two routes linking major destinations on theKNUST campus students commuted to and from every day for their lectures. • Commercial area to business school • Brunei Hostel to business School 29 .1. Data collection • Commercial area bus stop • main Library bus stop • Katanga Bus stop • Brunei Bus StopBased on the information collected from the vehicle and transport maintenancedepartment of the school, and based on the procedure used by Jisha et al, we each tooka dedicated bus and record data regarding the following fields which would help us inpreparing a machine learning model to estimate the time of arrival of the buses at thevarious bus stops.1. Routes2. Bus stops3. Time of departure from a bus stop4. Time of arrival at a bus stop5. Total time travel6. Total time spent waiting in traffic7. Total time traveled between various stops30 .2. Estimated Time of Arrival (ETA) using machine learning
We used IBM Watson studio which had a suite of machine learning tools to help usdetermine the best machine learning model to help us predict the estimated time ofarrival of the bus at a particular bus stop based on a time series and other factors thatinfluence the prediction of estimated to of arrival of the bus. We cleaned the data to makesure our model would not be introduced to inappropriate forms of characters or data thatwould cause it to either make our model underfit or overfit. After, we then uploadedour data to the studio and used the auto ml feature in the studio to determine the bestmachine learning model. Below is a diagram displaying the various stages in which automl finally settled on a Light regressor from the research team at microsoft
We collected video recordings of the occupancy in buses in their commute on campus toenable us to develop a neural network-based bus occupancy counter using the computervision library OpenCV and other modules.
We developed an android based app for both the driver of a bus and the students’ versionfor tracking. We incorporated a GPS software kit from google to enable us to track thecoordinates of the driver of dedicated bus whiles they commute on campus. Both appli-cations were built using android studio software. The bus counts and GPS coordinates31 .4. Android application, for tracking and monitoring buses were transmitted from the drivers’ app to the database in the cloud called firebase whichthen stored and help transmit the traced location of the drivers on the student versionto enable them to get notifications of buses the subscribe to and monitor the occupancyand movements of the various buses 32 .4. Android application, for tracking and monitoring buses hapter 5Results and Analysis After using auto ml to train our model, we got a few metrics back from IBM Watsonconsole to measure the effectiveness of our training, testing, and validation process onour data using the LGBM regressor. The metric of focus was the r squared value whichwas 0.83, thus approaching 1 indicates that our model has a high accuracy between theobserved value and predicted value. Hence we can use this machine learning model topredict the estimated time of arrival of our bus on campus. This model, unfortunately,will require retraining, due to the variable conditions that affect the estimated time ofarrival of bus day in day out on the KNUST campus. We were able to test our modelas well using a generated application programming interface provided by Watson console,and in most cases, we got an average of 2 minutes for commute between various bus stopson campus 34 .2. Android application for tracking buses performance
After developing the versions of the driver and the student’s app, we tested it on campusseveral times to check if we were able to track the location of the buses based on thedriver’s app, which was then displayed in the student’s app. Also, we tested out thevision model to check the bus occupancy count of the various buses. After all these tests,we were able to conclude that, the apps worked very well, including the trigger functionswe had set up in the cloud which provided notifications whenever a bus got in range of adedicated bus stop. Below are images of results from our tests.
In the area of bus occupancy count, we tested out the raspberry pi with the vision modelon many video streams including one containing students in a bus understudy commutingto their classes for lectures. Our model was able to count the number of faces in the videoframe with an accuracy of 0.7 due to the angle of the camera on the bus35 hapter 6Conclusion
In this thesis, we investigated the problem lack of bus tracking and onitoring systemson Kwame Nkrumah University of Science and Technology Campus.We have developeda smartphone basede bus tracking and monitoring system to address the issue faced byStudents on University campus. The tracking and monitoring system developed has beenbeen validated through test and deployment on campus . In our journey to see this projectthrough to success, we have been able to develop and test an app that can help studentsmonitor, get updates of bus occupancy, and check the proximity of time within which abus will arrive at a bus stop on the KNUST campus. We have also deployed it on Googleplay store for the patronage of students to test it out and eventually end up using it tohelp them on their commute on campus making it easier and faster. We also believe thatdata is key and in all, School authorities can use the data of bus occupancy counts tomake data-driven decisions as to whether students need more buses among many others.We believe our research into building a resilient system to ease the whole problem ofdecision-based commute on campus for students is a stepping stone for other researcherswho would dive deeper into building more efficient systems as the solution36 eferenceseferences