Introduction: Cambus - System of Data Collection on Urban Bus
Among the problems and difficulties known in public transport, the population lacks real time information and with the least assertiveness. The overcrowding of public transportation buses drives users away, who prefer to use their own vehicles, even though they are still in traffic for hours. If real-time information, such as the number of buses, is easily available to a user, he can choose whether to wait for the next bus or to get around by bus or use a vehicle of his own. The power of choice makes public transportation a more attractive option for the user.
Counting or estimating people indoors can be done in many ways, among which the most commonly employed are:
- Thermal images;
- Computer vision;
- Face counter;
Among the several difficulties to estimate people in an environment using computer vision, the main ones are:
- Occlusions of people;
- Inverting lighting;
- Static occlusion, that is, people behind objects;
- Camera angle to environment;
A challenge for this project is to know the correct angle of the camera that will best aid in the subtraction of the background of the image, as well as the variable luminosity during the day inside the bus.
The main objective of the proposal is to create a robust and configurable model to estimate overcrowding and make the results available to the population through smartphones.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
The material needed for the project is the next:
1 x Dragon Board 410c;
1 x USB camera;
1 x Smartphone Android;
Step 2: Install Linaro in Dragonboard 410c
Following the instructions on the link below to install Linaro 17.09 on the DragonBoard 410c. We recommend installing Linaro 17.09 for kernel support for GPS.
Step 3: Step 2: Install Libraries and Download Source Code From GitHub
Cambus has a modular architecture and code design. It's possible to code your own machine learning algorithm, change to other cloud service and create your own user applications.
To run the cambus project, first you need to download the source code from github (https://github.com/bmonteiro00/cambus). Install python(Cambus was mode to run on verison 2.7 and > 3.x) and the following libraries using 'pip'(sudo apt-get install python-pip). It will be needed to install a bunch of libraries in Linaro system(Also, It is recomended to create a virtual enviroment - pip install virtualenv - in order to isolate the Cambus system from the SO). Please, install the following libraries:
- pip install paho-mqtt
- pip install numpy
- pip install opencv-python
- pip install opencv-contrib-python
- pip install twilio
- pip install matplotlib
The main program was divided into classes:
- CamBus - the main class;
- Sensor - a class to obtain data such as GPS position, temperature, Co2.
- Counter - class with image processing algorithm.
Make sure if all libraries was installed and execute python CamBus_v1.py.
Step 4: Setting Up AWS IoT Core, DynamoDB
We used the AWS IoT core as an MQTT broker with TLS and X509 and NoSQL and DynamoDB to log data.You will have to create an account at https://aws.amazon.com/free.). Next, you will have following the steps below to create a thing and integrate with Dynamo:
Step 5: Setup Twilio and Dweet APIs
Step 6: Challenges
During our development many challenges we faced, starting from OpenCV techniques to AWS platform. We decided to code with Python in order to save time developing in C/C++. During our development only the basic Opencv methods such as:
These basic methods were not enough to reach a good quality in detecting people. Scenarios with shaky video ML(Machine Learning) was used. So, we decided to use the OpenCV machine learning library and we got another problem because to find a good data input for ML algorithm was a problem that we spent many days. We have used OpenCV SVM algorithm but not worked. We used OpenCV Naive Bayses and this one worked OK. We have tried to use Tensorflow and CNN neural networks, however we did not make it happen for now. CNN uses a lot of processing power, something that we didn’t have.Using OpenCV ML and the basics OpenCV methods helped us to reach a good rate of detecting people. Nevertheless, for each type of vídeo we have to adapt the parameters of OpenCV in order to reach a good rate of detecting people and avoid false positives.In the middle of these two months we evolved our first idea to do a center of data collection not only the number of passengers and GPS location. We decided to collection not data using others sensors like temperature and so on.We created a .ini file to parameterize the application and make it configurable. On Cambus.ini file you can configure the application in many ways.
Step 7: Results and Future Work
As you can see in the video, the counter is working accurately. The blue lines mark the input limit and the red line the output limit. In this case, a video was used to simulate because we could not deploy it to a bus.
Mind that some change has to be made to your condition about video size, camera angle, luminosity etc. Every type of video has to be it's own parameters adapation such as opencv kernel suctraction background and so on.
Please also change variables at cambus.ini, indicating MQTT broker and so on.
We consider in future implementations to add sensors, for example, temperature, humidity and CO2 in the system. The idea is to get data around the cities making them available to the community.
Following we enumerate next steps that you can to improve the project:
- Re-write the code using C/C++;
- Improve ML algorithm;
- Re-factor python code;
- Deployment into a bus;
We would like to thanks Embarcados and Qualcomm for all the support given.
Bruno Monteiro - firstname.lastname@example.org
Kleber Drobowok - email@example.com
Vinicius de Oliveira - firstname.lastname@example.org