How we deployed an Artificial Intelligence (AI) solution quickly during Circuit Breaker

Rachel Shong
AI Practice GovTech
5 min readJun 14, 2021

Conceptualisation and Lead Architect: Abhishek Tandon (NParks)
AI Engineers: Bill Cai (GovTech), Muhammad Nazar (GovTech)
Project Management: Jean Ho (GovTech), Margaret Cheong (NParks), Zelig Lee (NParks)
Engagement Manager: Rachel Shong (GovTech)
Project manager and GIS: Rajendra Shelar (NParks)

Want to take a walk in the park but concerned about crowds? You should first visit the Safe Distance @ Parks portal. With more than 400,000 monthly website visits, the portal updates the public with live visitorship status in parks, gardens and nature reserves across Singapore. The live data is also used to supplement safe distancing efforts by the National Parks Board (NParks).

In this article, we explain how artificial intelligence (AI) is used to help provide this data.

Scoping the Problem

At the start of the Circuit Breaker, NParks enforced safe distancing measures at all its parks, gardens and nature reserves, including Park Connectors, Pulau Ubin and parks managed by town councils. This includes crowd estimation and park patrols at these green spaces, which can be laborious and tedious, especially for large public spaces. And this work is very much limited by manpower constraints.

To address this problem, NParks rapidly developed a Safe Distance @ Parks website within a short span of 3.5 days for the public to access the park visitorship status. Further to that, the team partnered with GovTech’s Data Science and AI Division (DSAID) which set up a squad of 1 AI Engineer, 1 DevOps Engineer and 1 Engagement manager to work out a solution to extract the visitor count from CCTV snapshots and automatically update the Safe Distance @ Parks portal in less than two weeks.

Given the urgency of the situation and limited manpower, the squad had to make key decisions based on reasonable assumptions to develop an AI-enabled solution prototype that could eventually be scaled.

System Design

Leveraging on Existing AI Models

The fundamental requirement of this solution is an AI-enabled people counting model. People counting was already a well-established computer vision use case.

We studied a range of available people counting AI models, from “Commercial Off-the-Shelf (COTS)” solutions to open-source pre-trained models.

We compared 3 people detection and counting algorithms:

  1. An open-source pre-trained Yolov3 model,
  2. A model provided natively by a Cloud Service Provider (CSP), and
  3. An in-house custom trained model repurposed for this use case.

We carried out a quick technical comparison on the AI models’ performance and ascertained the deployment cost option.

Eventually, we decided to adopt, fine-tune and integrate the AI model provided natively by the CSP into our solution. Due to the time-sensitivity of the project, we conducted manual and qualitative assessments.

The table below shows the comparisons:

Table 1: Comparisons of People Detection Algorithms

System Development

We adopted a system design that accepted image snapshots from cameras deployed by NParks, applied image analytics on received images, and sent the analysed count data and images to the backend API at the Safe Distance @ Parks portal.

The design of the system required 3 key integration points.

  1. Standardised protocol established to receive snapshots from deployed camera systems
    In order to integrate with a wide range of camera systems, we settled on using Secure File Transfer Protocol (SFTP) and Representational State Transfer (REST) APIs secured by Transport Layer Security (TLS) to receive images.
  2. Snapshot image sent to the native people counting service hosted by the CSP and the metadata response parsed
    Figure 1 below shows the inference results (output) in JSON format. We configured the image analytics service to provide only the inference results for people since we were only interested in people counting.
  3. API specifications of Safe Distance @ Parks portal followed to send people count information and images
    An example of the JSON involving the number of people count, the location id of the camera and the URL of the image snapshot is shown in Figure 2.
Figure 1: Sample output JSON file directly from the image analytics service
Figure 2: Sample output JSON file showing the consolidated people count

Elasticity and Agility with Government Commercial Cloud (GCC)

Since this implementation was based on iterative methodology, CCTV deployment was progressive. But as with all fundamental system design, we relied on elasticity of the Government Commercial Cloud (GCC) and deployed our solution there. Our familiarity with GCC gave us a significant head start to deploy the prototype and scale it up to address NParks needs.

Figure 3 below shows the architecture and data workflow for this use case. We intended to use this architecture design subsequently to integrate with other camera systems for use cases that require image analysis.

Figure 3: Architecture Diagram

The cloud-based architecture built on the GCC was designed to be entirely event-driven, meaning that producers (e.g. camera ingestion and analytics) can be decoupled fully from consumers (e.g. metadata export to Safe Distance @ Parks). This allows for:

  • Independent horizontal scaling of services;
  • Resilience of services; and
  • Rapid iteration of individual services without concerns about spill-over effects on other services.

In addition, our design made use of cloud-native products and services provided by the GCC CSP, including micro services and object storage services.

Our initial end-to-end deployment started with 5 cameras and was completed within two weeks. Subsequently, we continued to scale up to multiple parks and park connectors with high availability by December 2020.

Scaling and Sharing for Impact

With the implementation, the Safe Distance @ Parks portal received visitorship stats from some park locations, allowing officers to be more efficiently deployed for safe distancing measures. Safe Distance @ Parks website is helping citizens to make informed decisions before visiting parks or specific areas within big parks to avoid crowded areas.

Figure 4: Screenshot of Safe Distance @ Parks Portal

We have also put in automations on the platform to actively monitor the solution’s reliability. The automated processes we incorporated helped us detect and even pre-emptively resolve issues to reduce system downtime.
Today, this people counting solution developed for NParks is part of a suite of image and video analytics products provided by the Whole of Government (WOG) Video Analytics System (VAS) platform. Developed and operated by DSAID, the VAS is a centralised and scalable cloud-based video analytics platform that addresses different government VA use cases, such as the one here with NParks, with a lean development team.

Currently in pilot, VAS provides a strong base of cloud infrastructure, VA algorithms, and software products that enable DSAID to scale our impact many times relative to our team size. As one of the key early users of Pilot VAS, NParks’ use of the platform has and continues to supplement safe distancing work. We look forward to enabling more use cases with NParks and that of WOG agencies.

--

--