Privacy Protection Using Peekingduck

”Data is the new oil” is a catchphrase that is reflective of modern times. As more data is being collected and shared, data privacy and protection becomes increasingly important, and governments around the world have been implementing regulations in response. In the European Union, the General Data Protection Regulation (GDPR) was adopted in 2016, while in Singapore, the Personal Data Protection Act (PDPA) came into effect in 2012.

Videos and images are also forms of data, and thus fall under such regulations. For example, Chapter 4 of Singapore’s PDPA states that consent is required from identifiable individuals who appear in photos or videos, before they can be used in some situations. As this can be impractical, Chapter 4 also mentions that if the identifiable features of the individuals are “masked”, then consent is not required. This process is sometimes known as “de-identification”.

De-identification of a single photo can be done easily with readily available tools such as MS Paint. But what if you need to de-identify thousands of videos? To manually do so, frame by frame, would be extremely time consuming and tedious! There are commercial solutions that promise to solve this (at a price), but at AI Singapore, we are now releasing our de-identification technology as open-source, completely free of charge!


PeekingDuck v1.1 to the Rescue

Two months ago, we released PeekingDuck, a Computer Vision (CV) inference framework with built-in modularity using the concept of “nodes”. In our latest v1.1 release, we added new nodes which tackle the problem of privacy protection by de-identifying faces of individuals and license plates of vehicles. PeekingDuck can be configured to de-identify a folder of saved videos or images, and can even run real-time on live CCTV feeds.

Original video (above), with face de-identification (below)
License plate de-identification

Under the hood, the first step is to use object detection models which predict bounding boxes around faces and vehicle license plates. We trained YOLOv4 and YOLOv4-tiny models on datasets of human faces and license plates, and also used a MTCNN model pre-trained on faces, creating our new model.yolo_face, model.yolo_license_plate, and model.mtcnn nodes.

The second step is to mosaic or blur the pixels within the bounding boxes using the draw.mosaic_bbox or draw.blur_bbox nodes. The level of mosaic or blur are configurable parameters which can be adjusted. If other forms of “masking” are required, such as blacking out the pixels, it is also possible to create your own custom node that does this.

Mosaic (left) vs blur (right)


Additional Features in v1.1

Aside from the privacy protection use cases above, we also included additional features in v1.1 of PeekingDuck. Firstly, our model.yolo_face node is able to distinguish between masked and un-masked faces, adding another use case to combat COVID-19, on top of our social distancing and group size checking use cases.

Face mask detection

We also responded to a feature request, to show a list of all available nodes via command-line interface. By running the command ‘peekingduck nodes’, the different types of nodes, their names, and URLs for more information will be shown, as depicted below. We find this feature useful as even ourselves lose track of the nodes and names sometimes. Additionally, we used colours and bold fonts to allow info messages, warnings and errors to be shown more clearly in logs.

Output from ‘peekingduck nodes’ command

Furthermore, Apple started releasing Macs with their proprietary M1 ARM-based chip in late 2020, a significant change from the previous Intel processors. Recognising that there will be more users of M1 Macbooks over time, we successfully tested PeekingDuck on a few M1 Macs and have provided an installation guide.


Moving Forward

As CV continues to have new developments, we are committed to maintaining and adding new features to PeekingDuck over time to ensure that it stays relevant. You are welcome to use our Community page to suggest potential problems that could be solved by CV, and we will consider building nodes to solve it, if viable. In the meantime, do install the latest version of PeekingDuck to try it out!


Find Out More

To find out more about PeekingDuck and start using it, check out our documentation below:

You are also welcome to join discussions and reach out to our team in our Community page.

Author