We’re excited to announce our Global Partner Program! Visit our Partner page to learn more.

Machine Learning for Smart City Traffic Management

"Using wireless connectivity and machine learning, real-time data will reduce the billions of dollars in costs stemming from road congestion."

Cities around the world are experiencing ongoing population growth. As people move in, municipal infrastructure is stressed. IoT-based smart city solutions are helping cities promote modern economic development, improve city infrastructure, increase environmental awareness, and optimize usage of public resources. Using machine learning at the edge, cities can tackle one of the most expensive and impactful side effects of rapid growth: increased road congestion.

When building proof-of-concept or prototype IoT devices it is important to spend most of your time on features that solve the challenges at hand, not utility functionality. Blues Wireless Notecard is the simplest, and most cost-effective way to add connectivity to IoT devices. Simply plug Notecard into your existing hardware and it will connect your device to the cellular network automatically, ready to transmit and receive data.

Using the Notecard, you can build an edge device using machine learning and image recognition with only 100 lines of code.

Download PDF
 
View Hackster Project
 
Get Source Code
 

Urban Area Congestion

tomtom
TomTom

As of 2020, 56% of the global population lived in urban areas, and that number was even higher in the developed world (79%). Urbanization presents unique challenges to city planners and politicians, as increasing populations stress municipal infrastructure and services. One of the most visible impacts of a growing population is the increase in traffic. According to the TomTom Traffic Index, in 2021 New York City had the highest congestion level in the United States at 35%. This means that a 30-minute trip during peak hours will take 35% more time than it would during the city’s off-hours. This translates to an additional 10.5 minutes of extra travel time for every 30 minutes of driving.

Aside from the individual frustration that traffic jams cause, there are myriad impacts to the community. Road congestion has economic, environmental, and human costs:

  • Commuter: time, fuel, quality of life, vehicle maintenance
  • Safety: crashes, emergency response times
  • Freight: supply chain delays, fuel, shipping costs
  • Environmental & Public Health: CO2, fuel, death and illness
  • Economic Competitiveness: access to jobs, airport delays

Traffic congestion interferes with emergency vehicles, increases the number of accidents, increases air pollution, and affects productivity – and these all have dollar signs attached. This places economic strain on cities and states in the hundreds of billions of dollars:

 

congestion table

So how can these issues be addressed? Often through public-private partnerships, deploying connected devices can provide data needed to solve the challenges unique to an area. Thoughtful implementation of IoT systems is transforming cities around the world into smart cities.

 

Smart City Traffic Management with the IoT

In smart cities, IoT solutions collect and transmit data to optimize infrastructure and services. This empowers local governments to better engage citizens, manage services, and save tax dollars. Networks of sensor-enabled devices collect data on energy usage, traffic volume and patterns, pollution levels, and other events which are analyzed and used to understand usage and predict patterns. Uses of IoT in smart city management include:

  • Smart Traffic - IoT systems can use machine learning and CCTV cameras to monitor and regulate traffic by changing traffic lights based on the volume of vehicles.
  • Smart Parking - Enabling real-time parking availability reduces congestion and increases satisfaction of public parking resources.
  • Smart Streetlights - Smart streetlights can auto-adjust dimness to save energy and can listen for breaking glass (from accidents or break-ins) or gunshots and call for law enforcement.
  • Smart Sanitation - From street sweeping to waste collection, there are countless ways that a city can utilize IoT devices and sensor data to better manage how cleanliness is maintained.
  • Smart Emergency Response - Cameras and sensors capture and share video, audio, and vehicle location, giving first responders and dispatchers real-time data for training and planning. Smart cameras can see accidents and trigger emergency response.
smart city

As the technology becomes more ubiquitous, cities are using the IoT to improve livability and drive economic growth, and there is massive investment in these efforts. Last year, the University of Michigan received $20 million from government and corporate partners to implement 20+ smart intersections in Ann Arbor. Using cellular connectivity, the systems gather and transmit real-time data to connected cars to manage traffic flow and reduce congestion, leading to significant savings.

According to a Juniper Research study, smart traffic management systems could save cities $277 billion by 2025 through reducing emissions and congestion. The report predicts over 95% of savings will be made by reducing traffic congestion. North America and Europe are anticipated to account for over 75% of all savings due to increasing investment in smart traffic management and high vehicle usage.

Building an Image Classification IoT Device

Measuring traffic density requires a way to detect vehicles, assess their speed, and track vehicles traveling through monitored zones. Image processing generally requires heavy data processing, specifically when you get into recording and transmitting image files in real time. To build a traffic management device for smart city deployment, you need more efficient and less costly image processing.

Follow this project if you are looking to create a IoT device prototype that uses machine learning at the edge for low bandwidth image classification. The device uses a Pi camera and predefined image classification models to identify what’s recorded. Data is pumped to a cloud service using the Blues Wireless cellular Notecard System on a Module, and established SMS alerts are routed through Twilio.

The Notecard is the quickest and easiest way to add cellular connectivity to this device, and it comes with 500 MB of data usable over 10 years. You can find the complete project assembly instructions on Hackster and the full source code on GitHub.

Hackster: https://www.hackster.io/rob-lauer/remote-birding-with-tensorflow-lite-and-raspberry-pi-8c4fcc

GitHub: https://github.com/rdlauer/pibird

Price: $348.00

Project Time: 4 hours

Lines of Code: 100

Languages: Python

The main parts of this project are:

  1. Assemble the hardware for a motion-activated image detection edge device.
  2. Build, tune, and deploy an image classification model.
  3. Send results to the cloud.
  4. Create a route to receive text message alerts when readings fall out of normal range. (Optional)

smart-city-archecture-diagram

 

Using Machine Learning at the Edge

Machine learning models generate inferences based on known data. In this case, you’ll be training the model to create an inference about the things you want it to recognize, and thus the images you want to capture.

By using Blues Wireless, your inferencing model results can be pumped to any cloud app with lightweight, secure image data. Blues Wireless provides edge-to-cloud IoT infrastructure, with hardware, firmware, and cloud communication components, and can be embedded into any device:

  • Notecard: A tiny 30mm x 35mm System on a Module (SoM), the Notecard is a cellular and GPS-enabled device-to-cloud secure data-pump that comes with 500 MB of data and 10 years of cellular starting at $49.
  • Notecarrier: To make integration in an existing project easier, Blues Wireless provides host boards called Notecarriers. For this project, use the Notecarrier Pi HAT and put it between the PiJuice Hat and Raspberry Pi.
  • Notehub.io: On the cloud side, the Notecard ships preconfigured to communicate with Notehub, which enables secure data flow from device-to-cloud. Notecards are assigned to a project in Notehub. Notehub can then route data from these projects to your cloud of choice or integrate with third-party services like Twilio.

With the PIR sensor triggered, the device is activated to snap a picture. You’ll start by activating the camera and specifying where in the file system you want the captured image to be saved.

tensor-flow

Then, specify the location of the machine learning model and label map used to map the results from the model to an actual image target name (in this project, a bird name). Carrying on, you’ll set a confidence threshold and follow these next steps:

  • Encapsulate your model by initializing the TensorFlow interpreter.
  • Open the camera and adjust light settings.
  • Snap a picture and save it to the file system.
  • Run the image classification function and allow TensorFlow Lite to analyze the image.
  • If the confidence of the match is greater than the established threshold, the image is sent to the cloud.

Applications of This Project

Traffic management has increasingly become complex as urban populations increase. Machine learning at the edge can improve accuracy and efficiency in the measurement, prediction, and prevention of road congestion. When today’s city planners are working to incorporate sophisticated systems to transform their citizens’ lives, they should also consider how this collected data is reliably and securely delivered to their cloud. It only makes sense to use a cellular IoT solution using the Blues Wireless Notecard.

In addition to smart city traffic management, there are diverse use cases for this type of device, including:

  • People counting for retail
  • Construction site safety compliance
  • Parking deck management
  • Environmental disaster hazmat response
  • Severe weather alerting and response
  • Facial recognition for counterterrorism efforts

Ready to Discuss Your Project With Us?

Blues Wireless makes it easy to make connected devices. In the article above, you’ve seen how little effort it takes to build an initial proof-of-concept device that reports sensor data over the cellular network. In some cases, it’s best to start with one of our proof-of-concept applications, then swap out sensors or cloud apps until you get what you want. In others, it would be best to take a different tact entirely.

We can help. Our team of experts will discuss your project idea with you and help you find the shortest path to a proof-of-concept device so you can get your product or device connected to your cloud.

Frequently Asked Questions

We’re making IoT quick and easy.

Start your IoT journey with us!

Subscribe to our newsletter

Expert tips, exciting projects, and IoT insights delivered every month