Back to blog
Segurança e Autenticação February 20, 2026

AreaFace: embedded facial recognition for public safety

Fábio Eduardo Cressoni Batistella

AreaFace: embedded facial recognition for public safety

AreaFace: The Science of Mathematical Certainty against the Fragility of Public Faith

The drizzle falling over Avenida Paulista that Tuesday afternoon was not the biggest problem facing traffic officer Marcos Silva. Beneath his waterproof hood, his eyes alternated between the chaotic flow of vehicles and the screen of a ruggedized smartphone. He needed to record a citation for a prohibited turn, a routine administrative act, yet one that carries with it an invisible, centuries-old weight in Brazilian law: public faith. Legally, what Marcos was writing there was the truth of the State. But in the practice of the street, that truth depended on a four-digit password typed by wet fingers on a greasy screen. A silent vulnerability that software engineering was about to expose and, at last, correct.

For Areatec, a leader in enforcement technology that processes more than fifty million transactions per month, that scene represented a profound conceptual discomfort. The company, shaped by the philosophy that the real world destroys laboratory theories, saw in traditional public faith a fragile legal shell. As engineers, the challenge was not to accept that the officer's word suffices because the law so determines. The real challenge was to prove, with the cold exactitude of mathematics, that this specific officer, at that exact millisecond, under that rain, was the unequivocal author of the public act.

The Myth of Public Faith and the Presumption of Legitimacy

In Brazilian administrative law, public faith is frequently invoked as an insurmountable shield. However, technical analysis reveals that the term is largely a concept imprecisely borrowed from notarial activity, regulated by Federal Law number 8,935 of 1994. What the traffic officer actually possesses, grounded in Article 280 of the Brazilian Traffic Code, is the attribute of the presumption of legitimacy and veracity of administrative acts. This is a pillar of the supremacy of the public interest over the private one, theorized by classical jurists such as Hely Lopes Meirelles 1. This presumption establishes that the act of the State is legal and true until proven otherwise.

Legal Concept Technical Attribute Evidentiary Force Burden of Proof
Public Faith Attribution of documentary authenticity Absolute in formal terms (notarial) On the challenger
Presumption of Legitimacy Conformity of the act with the law Relative (juris tantum) On the citizen (initially)
Presumption of Veracity Declaration of facts as true Relative (juris tantum) Dynamic in case of challenge

This procedural advantage relieves the public administration of having to prove, at the moment of citation, the occurrence of the fact. The second paragraph of Article 280 of the Brazilian Traffic Code materializes this dynamic by allowing the infraction to be proven through the simple declaration of the officer or by previously regulated technological means. However, contemporary jurists such as Maria Sylvia Zanella Di Pietro point out that this presumption is strictly relative, or juris tantum 2.

When the citizen challenges the citation in the administrative or judicial sphere, the principle of substantive truth requires the State to support the proceeding with robust evidence. If the citizen alleges that the officer was not at the location, or that their credentials were used by third parties, the unilateral presumption begins to crumble. The modern doctrine of Celso Antônio Bandeira de Mello argues that, in the face of a plausible challenge, a dynamic distribution of the burden of proof occurs 3. The administration cannot hide behind a fragile digital signature or a password that could have been shared. The State must prove the authorship of the act. And it was in this vacuum between legal presumption and physical certainty that Areatec decided to intervene.

The Chronological Evolution of Field Authentication

The journey to shield the authorship of the administrative act in the field passed through four distinct eras of information security, each revealing its own limitations under the relentless test of the street.

At the dawn of enforcement digitalization, authentication relied solely on static passwords. The officer typed a numeric code to sign the infraction notice. From a security standpoint, it was a scenario of extreme vulnerability. Passwords written in notebooks, shared among shift colleagues to speed up the work, or seen by third parties over the officers' shoulders were daily occurrences. The security criterion was virtually nil, and legal challenges to authorship were an imminent risk for municipalities.

Recognizing the fragility of the single-factor model, engineering advanced to the implementation of security devices tied to the password, two-factor authentication. The officer had to type their password and, simultaneously, the system validated the unique identifier of the registered mobile device's hardware. Although it mitigated remote credential theft, the model still failed at "physical sharing": nothing prevented an officer from handing over their already unlocked, working smartphone for another to operate in their name, violating the personal nature of the administrative act.

The next step was the transition to biometrics, specifically fingerprint reading. The security level finally seemed refined. The fingerprint is unique, non-transferable, and difficult to clone under normal conditions. However, the real world, the one Fabio Eduardo Cressoni Batistella often invokes to dismantle laboratory certainties, imposed its physical barrier. The traffic officer works under scorching sun, torrential rain, and suspended dust. Sweaty fingers, dirty with grease, or wet from the rain prevented capacitive reading by smartphone sensors. The false rejection rate soared, generating operational frustration and forcing officers to resort to the contingency mechanism: the old and insecure digital password.

There was also an insurmountable economic and logistical obstacle. The overwhelming majority of low-cost smartphones supplied by public administrations either lacked a fingerprint reader or featured sensors of very low precision. However, Areatec's engineers observed a universal hardware pattern: practically every device in operation on the market, from the most basic to the top of the line, had a front-facing selfie camera. The answer was right there, staring at the development team through the silicon lens. The natural next step was to move authentication to the officer's face. But the path between the idea and secure execution would be an engineering thriller.

The Quest for the Perfect Algorithm: The Dilemma of In-House Development

The first reaction of Areatec's Research and Development team was to seek a ready-to-integrate facial recognition solution in the global biometrics market. The goal was to accelerate the product's time to launch. They analyzed SDKs from biometrics industry giants, cloud solutions, and off-the-shelf libraries. However, as field stress tests advanced, commercial solutions began to fail systematically under the security scrutiny imposed by Areatec's engineering.

Many of the analyzed solutions required a constant internet connection to send images to central servers where inference was performed. In cellular signal shadow zones, common on the outskirts of large Brazilian cities, the system simply stopped. Other solutions, which claimed to work locally, consumed so much RAM and processing power that they made corporate smartphones overheat and freeze after just a few hours of use under the sun. The worst scenario, however, was vulnerability to simple fraud. Photos printed on paper, displayed on the screens of other phones, or even videos recorded of the legitimate officer managed to bypass the liveness detection algorithms of commercial solutions.

Faced with the risk of exposing the legal validity of millions of citations to security flaws, Areatec's technical leadership made the most difficult and bold decision: to develop the entire technology in-house. The project, named AreaFace, would not be a patchwork of external libraries, but a proprietary architecture written from scratch, designed specifically for the harsh conditions of street work.

Engineering under the Hood: C++ and TensorFlow at the Limit of Hardware

To build a facial recognition engine capable of running on low-cost smartphones, without internet, in less than two hundred milliseconds and with negligible battery consumption, the engineering team had to make radical architectural decisions. The first was to ban Python from the production runtime environment. Although Python is the hegemonic language for artificial intelligence research and model training, its execution on mobile devices introduces unacceptable latency due to interpreter overhead and garbage-collected memory management.

The solution was to write the entire inference engine in native C++, using the low-level API of TensorFlow Lite (currently under the evolution of the LiteRT specification) 4. The C++ code allowed millimeter-precise control of memory allocation on the heap, eliminating memory leaks and ensuring that the process footprint remained stable even after thousands of executions. Native compilation for ARM64 architectures used NEON optimizations for assembly instruction vectorization, allowing the matrix multiplication and accumulation mathematical operations of the neural networks to be executed directly in the registers of the phone's processor.

// Conceptual example of inference efficiency in native C++ using TensorFlow Lite
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include "tensorflow/lite/model.h"

class AreaFaceEngine {
private:
    std::unique_ptr<tflite::FlatBufferModel> model;
    std::unique_ptr<tflite::Interpreter> interpreter;
public:
    bool Initialize(const std::string& modelPath) {
        model = tflite::FlatBufferModel::BuildFromFile(modelPath.c_str());
        tflite::ops::builtin::BuiltinOpResolver resolver;
        tflite::InterpreterBuilder(*model, resolver)(&interpreter);

        // Static tensor allocation to avoid memory fragmentation in the field
        interpreter->AllocateTensors();
        return true;
    }

    float* ExtractEmbeddings(const uint8_t* alignedFaceBuffer) {
        float* inputTensor = interpreter->typed_input_tensor<float>(0);
        // Ultra-fast normalization pre-processing in C++
        for(int i = 0; i < 112 * 112 * 3; ++i) {
            inputTensor[i] = (alignedFaceBuffer[i] - 127.5f) / 128.0f;
        }
        interpreter->Invoke(); // Low-level inference (< 150ms on ARMv8)
        return interpreter->typed_output_tensor<float>(0);
    }
};

The neural network architecture selected and optimized by Areatec was based on the concepts of ArcFace (Additive Angular Margin Loss), refining the classic FaceNet models 5 6. While the original FaceNet, developed by Google in 2015, used the Triplet Loss function to project faces into a 128-dimensional Euclidean space, ArcFace optimized this process by introducing an additive angular margin directly into the Softmax loss function during training.

This approach forces the neural network to learn extremely discriminative facial representations, maximizing the variance between different classes (distinct people) and minimizing the intra-class variance (variations of the same person under different angles or lighting). The mathematical model of AreaFace maps the officer's face into a high-dimensional feature vector (embedding). The comparison between the face captured at the moment of the act and the face registered in Areatec's secure database is performed through the calculation of the cosine distance between the two vectors.

$$\text{Cosine Similarity} = \frac{\mathbf{A} \cdot \mathbf{B}}{|\mathbf{A}| |\mathbf{B}|} = \frac{\sum_{i=1}^{n} A_i B_i}{\sqrt{\sum_{i=1}^{n} A_i^2} \sqrt{\sum_{i=1}^{n} B_i^2}}$$

If the cosine similarity is above a strictly calibrated mathematical threshold (generally above 0.85 for high-security environments), the identity is confirmed. Otherwise, access is denied. Mathematical precision thus replaces the subjectivity of the human gaze and the fragility of passwords.

The Siege against Fraud: Extreme Shielding with Anti-Spoofing

Developing an algorithm capable of recognizing a face was only half the battle. The true engineering war of AreaFace was waged in liveness detection, the so-called anti-spoofing or Presentation Attack Detection (PAD), in compliance with the international guidelines of the ISO/IEC 30107 standard. A field facial recognition system that can be bypassed by a printed photograph or a video on a tablet is worse than a system without biometrics, because it generates a false sense of legal security.

The Areatec team developed a multi-layered approach to ensure that only a real, three-dimensional, living human face can sign a public act. The system combines passive and active liveness detection techniques that run simultaneously on the mobile device:

  1. Depth Estimation via Computer Vision: Using lightweight convolutional neural networks specialized in monocular geometry, AreaFace reconstructs an approximate three-dimensional depth map from the two-dimensional video feed of the front camera. A printed photo or a tablet screen presents a perfectly flat plane, whereas a real human face exhibits characteristic depth variations in the nose, eye sockets, and chin. If the standard deviation of the generated depth map is close to zero, the presentation attack is instantly detected.
  2. Skin Micro-Texture Analysis: Human skin has unique optical properties of light reflection, absorption, and scattering (subsurface scattering). Digital device screens, on the other hand, emit light through pixels organized in matrices, generating interference patterns known as the Moiré effect when recaptured by another camera. AreaFace analyzes the high-frequency spectrum of the image in search of these micro-patterns of optical noise and artificial paper textures, blocking fraud attempts with high-resolution photos or screens.
  3. Frequency Analysis in the Fourier Domain: The algorithm applies the Fast Fourier Transform (FFT) to critical regions of the face to analyze the distribution of spatial frequencies. Artificial surfaces such as paper or digital displays exhibit frequency signatures radically different from the complex and irregular topology of human dermis.
  4. Infrared Validation (when available): On devices that have infrared optical sensors (common in enforcement terminals embedded in the vehicles of the Olho Vivo Patrol fleet), AreaFace performs active spectral validation. Human dermis absorbs and reflects the infrared wavelength in a unique way, whereas silicone masks, latex, or paper prints shine or absorb light uniformly, exposing the forgery.
  5. Detection of Micro-Movements and Passive Vital Signs: The temporal analysis engine of AreaFace monitors micro-variations in color in the forehead and cheek region caused by pulsatile blood flow, a technique known as remote photoplethysmography (rPPG), in addition to detecting natural eye blinking and pupillary micro-adjustments to screen light variation.
Anti-Spoofing Technique Attack Vector Blocked Processing Hardware Requirement
Depth Estimation Printed photos, flat masks Local (Neural Network) Standard RGB Camera
Texture Analysis High-definition screens (replays) Local (Vision Filters) Standard RGB Camera
Fourier FFT High-fidelity prints Local (Mathematical) Standard RGB Camera
Infrared Validation 3D silicone/latex masks Local (Spectral) Dedicated IR Sensor
rPPG (Photoplethysmography) Real-time video deepfakes Local (Temporal Analysis) Standard RGB Camera

The Result: The Reversal of Proof and Mathematical Certainty

The impact of the AreaFace implementation on the Areatec ecosystem was immediate and profound. By integrating native facial recognition into the officers' field application, the company definitively closed the evidentiary siege of the administrative traffic proceeding.

When an officer digitally signs an infraction notice using AreaFace, the system does not generate merely a date and time record. It generates a locally signed cryptographic package containing the hash of the officer's facial embedding, the geographic coordinates validated by Provloc, and the immutable transaction record written to AreaChain.

If a cited driver appeals in court alleging any irregularity in the authorship of the act, the municipality no longer needs to depend exclusively on the legal fragility of the officer's presumption of legitimacy. The municipality's defense presents in court a cryptographic technical report of unquestionable mathematical exactitude. The probability that another person signed that act is less than one in a billion.

AreaFace transformed the old "public faith" — a legal fiction necessary for the functioning of the analog State — into an absolute mathematical certainty for the era of smart cities. On Fabio Eduardo Cressoni Batistella's desk, the project's final report carried a simple graph that nonetheless represented the victory of engineering over theory: the curve of false positives in the field had been flattened to zero. Computer science had, at last, shielded the authority of the law on the street.


Bibliographic References


Fábio Eduardo Cressoni Batistella


  1. MEIRELLES, Hely Lopes. Direito Administrativo Brasileiro. 30th ed. São Paulo: Malheiros, 2005. 

  2. DI PIETRO, Maria Sylvia Zanella. Curso de Direito Administrativo. 17th ed. São Paulo: Atlas, 2004. 

  3. BANDEIRA DE MELLO, Celso Antônio. Curso de Direito Administrativo. 15th ed. São Paulo: Malheiros, 2003. 

  4. GOOGLE. LiteRT: High-Performance On-Device Machine Learning Framework. Google AI Edge, 2026. Available at: https://ai.google.dev/edge/litert. Accessed: June 3, 2026. 

  5. SCHROFF, Florian; KALENICHENKO, Dmitry; PHILBIN, James. FaceNet: A Unified Embedding for Face Recognition and Clustering. Google Inc., CVPR, 2015. Available at: https://arxiv.org/abs/1503.03832. Accessed: June 3, 2026. 

  6. DENG, Jiankang; GUO, Jia; XUE, Niannan; ZAFEIRIOU, Stefanos. ArcFace: Additive Angular Margin Loss for Deep Face Recognition. CVPR, 2019. Available at: https://arxiv.org/abs/1801.07698. Accessed: June 3, 2026.