What I did during the hackathon
Before introducing my project, I want to make it clear what I did during the duration of this hackathon. Before starting, I went to the intro zoom meeting where I was wondering if I could use a previous project for this hackathon. They said yes, but I will have to make some significant changes to it. I want to highlight what I have done during this hackathon:
- make the machine learning model
- make the web app
- make the presentation/video
- validated everything to data, that was previously collected
I also want to mention that I have not submitted this project for any other hackathon.
When my dad travels to work for his job, he often complains about the dizziness and asthma effects he experiences after his long rides. After doing some research into the matter, I found out the pollutants from other vehicles in traffic and CO2 buildup contributes to these problems.
Every day, hundreds of millions of vehicle occupants globally are exposed to unhealthy levels of traffic-related pollution which, according to the Environmental Protection Agency or EPA, causes serious health issues, such as pulmonary and cardiovascular diseases. At the same time, shutting off outside air to prevent pollutants from entering the vehicle cabin causes a hazardous buildup of CO2 levels due to exhaling of vehicle occupants causing sleepiness and nausea; thus creating a very unsafe situation. In recent years, even the Society of Automotive Engineers (SAE) has raised concerns over dangerous levels of CO2 in vehicle cabin space resulting from shutting off outside air to earn U.S. EPA fuel economy credit and vehicle airtight construction.
To mitigate this issue, currently there are few automotive air quality products that use air quality sensors to prevent traffic-related pollutants from entering the cabin. These products however are rarely used due to high cost, combined with lack of public awareness. Additionally, they don't address the problem of CO2 buildup.
What it does
The goal of this project is to develop a “sensorless” zero-cost app that automatically controls (or tells the user to change controls) the recirculation mode in vehicles to provide healthy vehicle cabin air to vehicle occupants by minimizing intake of traffic-related pollution from outside and simultaneously maintaining healthy levels of CO2 in-vehicle cabin air.
How I built it
I first created a custom build sensing device. The pollutants and CO2 levels were measured using a custom sensing device created for this research. The results from this custom build sensing were used to achieve the "sensorless" solution I aimed for, as I was able to use it to generate computer-simulated models based on other inputs, such as the number of vehicle occupants and time since last ventilation (to calculate CO2 levels) and the number of vehicles in traffic and size of bounding boxes (to calculate the traffic condition).
Machine learning technology was used to detect vehicles in traffic. First, it extracts features from vehicle images using spatial binning, color space and YUV filters, and histogram of oriented gradients or HOG. Next, a Support Vector Machines (SVM) classifier is trained to recognize vehicle features while ignoring non-vehicle features with an accuracy of 99.3%. Finally, a bounding box is placed around the vehicles detected using multiple sized sliding windows, refined windows, and heatmap.
After a machine learning model to detect vehicles in traffic was created, I validated it using the results of traffic-related pollution from the sensing device to define how the number of vehicles and the size of their bounding boxes will affect the traffic condition. Once the traffic condition was defined, it was combined with the results of the CO2 computer-generated model (which was also validated with CO2 data from the sensing device) to define in what situation the recirculation mode would be. This is all further explained in the attached slides and video.
With all of this, it was time to implement it into an app. I was able to relatively easily make a web app in Python using streamlit. It is able to take the required user input, capture images, display data in real-time, and inform the user to switch to the right recirculation mode in order to have the best in-vehicle air quality.
Note: This website is not publically available on a URL, as streamlit requires that they must review it before I can publish it. As I made the machine learning model and website during the hackathon duration, it has not allowed for enough time for the people working at streamlit to review the project. However, it can be locally run, and all of the files are available in Github. As there is no possible way for all of this to run on a smartphone device (intended device), as there is no means of uploading models, running python code, etc. on a mobile device, right now, it will have to be run on a laptop (once the website is reviewed and published, it will be able to run on a smartphone device as well). Because it is impractical to see how to code works by actually driving around with a laptop on the dashboard, taking pictures, and telling the user the required recirculation mode, I have made the code so that it can run of test images provided in the Github repo. Another thing to note is that the speed parameter will always be 0, as the laptop is stationary (unless the user starts running around with it lol).
Challenges I ran into
Some challenges I ran into was that there were way too many false positives when I was detecting vehicles with machine learning model. I fixed this by adding a threshold parameter. Additionally, I found it hard to process real-time video through my model. As my code does not require continuous video as input, I simply took a picture every second and processed that, allowing for my code to still function. I also found it challenging to validate my machine learning model and computed generated CO2 levels, but with a bit of hard work, I finally did it with the sensor data. My final challenge was building the app. My initial intent was to build a smartphone app that could run all my code, as that would be the most practical thing to do (would not require internet). However, after repeated tries, it seems that using python to create apps is still in its very early stages and can not be done. For this reason, I decided to make a web app instead to achieve the same function, but I am looking forward to building a smartphone app as well.
Accomplishments that I'm proud of
I am really proud of how my whole project turned out. Everything works together fluently, and I was able to incorporate all the functions I wanted my project to have.
What I learned
Through this project, I learned a lot about how to work with machine learning. It really surprises me how they are so many ways that it can be implemented and used! I also learned how to make a web app in Python.
What's next for Smart Ventilation For Vehicles
I really want to make this available on a smartphone app, and I hope to be able to do this in the future.