Oracle AI & Data Science Blog
Learn AI, ML, and data science best practices

AI Use Cases for a Smart City built on Oracle Cloud Infrastructure

Corrado De bari
Cloud Architect - AI/ML specialist

This post was originally published on Medium

Smart Cities are an ideal field for applying Artificial Intelligence in order to simplify citizens' and administrators' lives.

A year ago, the Oracle Innovation Business Solution team in Rome, Italy, began working on a showcase demo to present, in an innovative way, Oracle Cloud-based solutions to feed a Smart City: the project code name was Proxima City.


Three of Proxima City showcase demos available world wide.


As part of this project, which has been replicated and visible into Oracle offices in more than 30 countries and will soon be available in the Oracle Customer Visit Centers, I have implemented a series of use cases that are using Deep Learning as an enabling factor. In this post, I will describe one of them.



The main Proxima City demo architecture is shown in the following figure. In Red are highlighted the modules I used for my AI-based use cases:


Proxima City Architecture


A common premise to all implementations: I’ve used Open Source framework for Deep Learning, in a very simple way in terms of provisioning on the OCI platform, leveraging the GPU shapes based on latest NVidia Volta V100, and VM images ready to run, available as Oracle Images in the catalog and certified for NVIDIA GPU CLOUD. This approach allows pulling pre-configured Docker containers packaged with frameworks I have decided to use to implement the use cases, and on which I’ve done Deep Neural Network (DNN) trainings.

To develop the Jupyter Notebooks in Python, I’ve used our newly launched OCI Data Science (read the press release here), which provided a cooperative development environment to prepare datasets and develop the DNN models.

But let’s talk about the first use case, Smart Parking. In the next posts, I’ll talk about these other use cases implemented:

  • Proactive Security
  • Smart Tourism
  • Road Maintenance


Smart Parking

Providing real-time info about parking lots' availability is a key factor to reducing traffic congestion and related pollution.


Parking Demo

As reported in “Gone Parkin’” by Donald Shoup (March 29, 2007 on The New York Times): ”Several studies have found that cruising for curb parking generates about 30 percent of the traffic in central business districts.” The International Parking Institute (IPI) 2012 “Emerging Trends in Parking” Study confirms this astonishing data: “It’s estimated that 30% of the traffic in any city is people in cars searching for parking," according to Allen Corry, CAPP Parking Services Director, Town of Greenwich, CT.

Finally, other studies prove how important it is to reduce time in parking searching. For example, in “Cruising for parking” by Donald C. Shoup, Department of Urban Planning at the University of California, Los Angeles, it is reported that "Between 1927 and 2001, studies of cruising in congested downtowns have found that it took between 3.5 and 14 min to find a curb space, and that between 8 and 74 percent of the traffic was cruising for parking.”

So, my idea it was to find a way to short-circuit demand of parking with the offering, targeting the parking areas not delimited by barriers, choosing the least invasive approach possible, minimizing cost, and avoiding putting any kind of sensors to detect car presence on each parking lot. The other key factor was to find a channel, as easy as possible, to transmit information about the availability of free parking lots to citizens.

The demo built is based on a normal remote camera sending images taken every n seconds through a RasperryPi, on which I run a simple python code to take pictures sending to the cloud. In a real scenario, this plays the role of a normal low-cost camera available on the market with minimum process capacity, put on an high pole.

Some customers have privacy violation risks concerns about sending images from a remote camera. These risks could be mitigated putting on the compute node attached to the camera a Python application with OpenCV leveraging its FaceRecognizer class to detect and blur faces, as well as blurring License Plates.

The picture taken is sent to the server on which a trained DNN detects the presence of a car in a parking lot.

I’ve addressed scenarios in which we have fixed, pre-defined parking lots. In this case, the image is segmented to crop the 6 lots of demo and classify one by one. The original image is overlapped with 6 boxes, red or green, as you can see in the figure:


Image with cars detection


You can see if it’s occupied or not, and a metadata occupation json file returned to the channel will provide the info: a chatbot.


Chatbot conversation through Facebook Messenger


In my case, I’ve used Oracle Digital Assistant, the OCI service that provides the platform and tools to build easily AI-powered assistants which are connected to the backend application that provide the parking lot status.

It uses artificial intelligence for natural language processing and understanding, to automate engagements with conversational interfaces that respond instantly, in my case Facebook Messenger. In the demo, citizens can interact in natural language to get several services, among which is parking availability.

As collateral, you can collect all data related to lots availability in an Oracle Autonomous Database in order to gain insights about critical issues in a particular time slot, so that you can plan better the offering in terms of parking of a real Smart City.

But let’s talk about the Deep Learning approach to detect in real time the free parking lots' availability. First, I had to choose the image dataset on which to train an existing DNN, or reuse straight a pre-trained DNN with car class inside.

The second option was rejected after a few tests, and the reason was that normally, in the class Car in the classical dataset like Imagenet or COCO, on which are trained DNN available for free, you can’t find pictures taken by top to down point-of-view, as we must have from a camera positioned in order to monitor a large parking site. Check it for yourself by browsing on COCO Dataset through its utility.

So, I have chosen to create a dataset based on car models and train it on an ImageNet pre-trained Convolutional Neural Network (InceptionV3) using Keras.

The dataset was composed by 2 classes:

  • Empty: 884 instances
  • Car: 1.195 instances

If you want to see how to proceed in terms of source code, refers to the Application chapter of Keras documentation.

I was surprised that after 3 epochs, the model reached an accuracy around 99%, more than I expected so quickly, and it tended to overfit with more training.

In my case was a demo to show the potential application of Deep Learning in common life use cases, but what about a real implementation?

There are datasets available to train a DNN on real cars images. One of the very interesting datasets I’ve found is the CNRPark+EXT. It includes more than 150K labeled images taken in 164 parking lots during different weather conditions.

Alternatively, by writing a simply binary labelling software, you could also label self-taken pictures on type of vehicles in your country, with a rate of one per second and reach 100K labelled images in less than 48 hours of work.

It has been really amazing to see thousands of people, to which I’ve done this demo in last year and half, all over EMEA, remains skeptics and move the cars by themselves to check if everything wasn't a fake! 

Stay tuned for more content about AI use cases for Smart Cities. 

To learn about AI and machine learning, visit the Oracle AI page. You can also try Oracle Cloud for free


The views expressed on this paper are my own and do not necessarily reflect the views of Oracle.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.