Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Learn how to develop a Serverless Face Recognit...

Avatar for Wasif Wasif
November 15, 2021

Learn how to develop a Serverless Face Recognition App with Azure Functions and Cognitive Services

Avatar for Wasif

Wasif

November 15, 2021

Other Decks in Technology

Transcript

  1. Presentation Title 1 Learn how to develop a Serverless Face

    Recognition App with Azure Functions and Cognitive Services Shaikh Wasif Emerging Tech Architect Digital Office November 2021 Deck URL: https://bit.ly/3kCS7AN
  2. 2 Agenda • Serverless Overview • Serverless hands-on coding •

    Face Recognition Overview • Azure Cognitive Services Overview • Build the serverless face recognition app
  3. 4 History of Web-App Deployment With Cloud 2.0, containers and

    container orchestrators, introduced deployment of containerized web-apps on the cloud. Bare-metal servers Cloud 1.0 VM VM Cloud 2.0 Containers Containers Traditionally web-apps would be deployed on a bare-metal server on-premise or provided by a hosting service. This server would be a physical machine running a web server like Apache, NGINX, etc. on which the web-app would be deployed. Then came Cloud 1.0, which allowed us to move our workloads to cloud providers’ data-centers. This meant deploying our web-app on VMs provided by the cloud service.
  4. 5 1. Basics of Serverless What is Serverless? Serverless refers

    to the concept of building and running applications that do not require server management. There’s no need for a traditional always-on server component. Can be broadly categorized into BaaS and FaaS. Backend-as-a-Service (BaaS) is a cloud service model in which developers outsource all the behind-the- scenes aspects of a web or mobile application so that they only have to write and maintain the frontend. Function-as-a-Service (FaaS) is about running backend code without managing your own server systems or your own long-lived server applications Serverless computing does not mean that we no longer use servers to host and run code; nor does it mean that operations engineers are no longer required. Rather, it refers to the idea that consumers of serverless computing no longer need to spend time and resources on server provisioning, maintenance, updates, scaling, and capacity planning. Instead, all of these tasks and capabilities are handled by a serverless platform and are completely abstracted away from the developers and IT/operations teams. As a result, developers focus on writing their applications’ business logic.
  5. 6 1. Basics of Serverless Function-as-a-Service (FaaS) A - cloud-native

    platform For - short-running, stateless computation And - event-driven applications Which - scales up and down instantly & automatically And - charges for actual usage at a millisecond granularity No servers to provision or manage Scales with usage Pay for what you use Built-in scalability, availability, security and reliability
  6. 7 1. Basics of Serverless What triggers FaaS execution? Code

    is run in response to events Services Events Functions API Gateway Storage Database API Call File uploaded Database updated Your code Your business logic
  7. 8 2. Platforms Cloud Computing Services OpenStack Azure VM AWS

    EC2 GCE Infrastructure- as-a-Service IaaS Kubernetes AKS ECS GKE Container-as-a- Service CaaS OpenShift Heroku AZ App Service GAE Platform-as-a- Service PaaS Fission Azure Functions AWS Lambda GCF Function-as-a- Service FaaS DropBox Salesforce SAP Office 365 Software-as-a- Service SaaS
  8. 9 2. Platforms Azure Services Azure VM (IaaS) AKS (CaaS)

    Azure App Services (PaaS) Azure Functions (FaaS) Decreasing concern of provisioning and management Increasing focus on business logic
  9. 10 2. Platforms FaaS Platforms Google Cloud Functions Azure Functions

    AWS Lambda Kubernetes IBM Cloud Functions Knative -Kubernetes OpenShift Serverless Cloud On-Premise
  10. 12 3. Pros & Cons Pros Cons • Save time

    and money on managing servers • Pay for what you use • Increased scalability, security and reliability • Improved developer productivity • Decreased management responsibilities • Convenient integrations • Cold starts • Compute time • VPC/Network issues • Application size • Vendor lock-in • Complex debugging
  11. 14 3. Pros & Cons Faas is good for Faas

    is not good for • Stateless event-drive tasks • Tasks that can be broken into small independent units of work • Tasks that have infrequent or unpredictable usage patterns • Background work or system to system communication. • Stateful tasks • Long running tasks • Computationally intensive • Streaming
  12. 15 4. Real-world use-cases Around half of the BBC’s website

    is rendered with AWS Lambda. They perform over 100 million serverless function invocations per day. Lego uses 200+ AWS Lambda functions to transform its legacy website. Architecture for Email notification with signed URL for vouchers
  13. 16 Serverless Hands-on Coding 1. Pre-requisites – Azure Subscription, VS

    Code, NodeJS 2. Azure Function Hello World API GET/POST 3. Test locally 4. Deploy on Azure HTTP GET / POST
  14. 17 Face Recognition Overview 1. Face Recognition Technology 2. Process

    3. Performance Evaluation 4. NIST FRVT report
  15. 18 1. Face Recognition Technology What is Face Recognition Technology?

    Facial recognition technology is a set of algorithms that work together to identify people in a video or a static image. Face recognition is one of Computer Vision Technology’s capabilities based on algorithms known as neural networks. This technology aims to find, recognize, and distinguish faces. Create face templates by extracting face landmarks based on their facial features (geometry): spacing of the eyes, bridge of the nose, the contour of the lips, ears, chin, etc. Tests by the National Institute of Standards and Technology (NIST) say that as of April of 2020, the best face identification algorithm boasted an error rate of just 0.08%. That's a big improvement from 2014, when the best algorithm had an error rate of 4.1%.
  16. 19 2. Process How does face recognition work? Face recognition

    is one of Computer Vision Technology’s capabilities based on algorithms known as neural networks. This technology aims to find, The FRT algorithm consists of two stages: identification and verification. Typically, the sequence of the algorithm’s actions is as follows: 1. Face detection. The algorithm highlights the person’s face in the image. 2. Facial features detection. The algorithm calculates the anthropometric points. The system finds features of the face that define individual characteristics. Previously, the main reference point for algorithms was the eyes, but as FRT evolves, at least 68 points on the face are considered nowadays. 3. Face normalization. The FRT system does additional image transformations (head tilt removal, face color correction, etc.) to obtain a clear frontal image. 4. Feature extraction and descriptor computation. A descriptor is calculated — a set of characteristics that describe a face regardless of extraneous factors (age, hairstyle, makeup). Comparing different descriptors makes it possible to assess whether two received facial images refer to the same person. 5. Verification. The resulting digital template is compared with the known faces in the database to complete the identification process.
  17. 20 3. Performance Evaluation How could you measure the accuracy

    of a biometric system? One way could be to check biometric performance figures reported by vendors. They often come in a form similar to this: FRR 1% @ FAR 1 / 10,000 By applying a varying score threshold to the similarity scores, pairs of FNMR and FMR can be calculated. FMR – False Match Rate Proportion of impostor attempts that are falsely declared to match a template of another object. FNMR – False NonMatch Rate Proportion of genuine attempts that are falsely declared not to match a template of the same object. EER – Equal Error Rate The point where the proportion of False Matches is the same as False Non- Matches (FNMR = FMR). FRR 1% @ FAR 1 / 10,000 means that – When the system operates in a mode where one out of ten thousand impostor attempts is (falsely) considered a match, one per cent of the genuine attempts would fail (be falsely considered nonmatches).
  18. 22 Azure Cognitive Services Overview What is Azure Cognitive Services?

    Azure Cognitive Services brings APIs for AI solutions Provides APIs for Speech, Language, Vision and Decision After creating a Cognitive Service resource in the Azure portal, you'll get an endpoint and a key for authenticating your applications. Integration can be done using REST APIs or client library SDKs From faces to objects, allow your apps to understand images and video Hear and speak to your users by filtering noise, identifying speakers, and understanding intent Process text and learn how to recognize what users want Make smarter decisions faster
  19. 23 Azure Cognitive Services Overview Azure Face Service The Azure

    Face service provides AI algorithms that detect, recognize, and analyze human faces in images. Facial recognition software is important in many different scenarios, such as identity verification, touchless access control, and face blurring for privacy. Verification is also a "one-to-one" matching of a face in an image to a single face from a secure repository or photo to verify they are the same individual. Verification can be used for Identity Verification, such as a banking app that enables users to open a credit account remotely by taking a selfie and taking a picture of a photo ID to verify their identity. Face identification can address "one-to-many" matching of one face in an image to a set of faces in a secure repository. Match candidates are returned based on how closely their face data matches the query face. This scenario is used in granting building or airport access to a certain group of people or verifying the user of a device. Detect faces and their attributes within an image Check if two faces belong to the same person Find similar faces within a set of faces Organize many faces into groups Search face belongs to which person
  20. 24 Build the serverless face recognition app 1. Pre-requisites –

    Azure Subscription, VS Code, NodeJS 2. Create serverless-app resource group 3. Create Azure Cognitive Services resource 4. Create Azure Storage Account resource 5. Create Azure Function 6. Deploy on Azure Develop a serverless function which leverages Azure Cognitive Services’ face recognition capabilities to identify duplicate customers using their face and send an email notification.
  21. 25 Solution Architecture 1. User uploads face image on the

    blob storage 2. Blob storage triggers an event for ingest function 3. Ingest function creates an entry in the table storage and adds a message on the identification queue 4. A new message on identification queue triggers the face function 5. Face function performs face detection, adds the face to the group, trains and performs identification. If a duplicate face is found, then it creates an entry on table storage and adds a message on the notification queue 6. A new message on notification queue triggers the email function 7. Email function sends an email that a duplicate face has been found Ingest function Face function Email function Identification queue Notification queue Blob storage User Table storage Face API Email API
  22. 26 References 1. https://github.com/cncf/wg-serverless/blob/master/whitepapers/serverless- overview/cncf_serverless_whitepaper_v1.0.pdf 2. https://landscape.cncf.io/serverless 3. https://martinfowler.com/articles/serverless.html 4.

    https://docs.microsoft.com/en-us/azure/architecture/example-scenario/ai/news-feed-ingestion-and-near-real- time-analysis 5. https://speakerdeck.com/danilop/how-lego-dot-com-accelerates-innovation-with-serverless 6. https://speakerdeck.com/danilop/the-serverless-journey-of-shop-dot-lego-dot-com 7. https://docs.microsoft.com/en-us/azure/azure-functions/ 8. https://docs.microsoft.com/en-us/azure/cognitive-services/ 9. https://docs.microsoft.com/en-us/azure/cognitive-services/face/ 10. https://aws.amazon.com/lambda/ 11. https://www.serverless.com/ 12. https://services.google.com/fh/files/misc/state-of-devops-2021.pdf 13. https://medium.com/bbc-design-engineering/moving-bbc-online-to-the-cloud-afdfb7c072ff 14. https://www.serverlesschats.com/73/ 15. https://blog.tomilkieway.com/72k-1/ 16. https://mikhail.io/serverless/coldstarts/ 17. https://www.csis.org/blogs/technology-policy-blog/how-accurate-are-facial-recognition-systems-%E2%80%93- and-why-does-it-matter 18. https://pages.nist.gov/frvt/html/frvt11.html 19. https://pages.nist.gov/frvt/html/frvt1N.html 20. Book: Learning Serverless: Design, Develop, and Deploy with Confidence