Face Recognition Program Using Python

  • > First method will send image as attachment to recipient mail id and for doing this we first have to install “email” library using “pip” command and then import EmailMessage() method from it. We have added other details like subject, to, from and body of the mail to be sent along with image as attachment. As we know that image is nothing but a binary file that we have opened using “open()” and then read it. We have used os module in order to retrieve values environmental variables using “environ()” function that we have created in our system. Now, for connecting to SMTP mail server using SSL connection that works on port no. 465, we have to first install and import module called “smtplib” module and then use “SMTP_SSL()” function and specify mail server to which you want to connect along with its port no as arguments to this function. After that, send message using “send_message()” function.
  • > Second method will send whatsapp message to number that we will provide as input using “getpass()” function that comes under getpass module. But, in order to send whatsapp message to our friend, we have to first install one library called “pywhatkit” using “pip” command and use function called “sendwhatmsg_instantly()” which will open whatsapp web and send message specified as argument to recipient instantly.
  • > Third method will send SMS to specified phone number and for this, we have used one of AWS service called “AWS SNS” which is Simple Notification Service, a highly available, durable, secure, fully managed pub/sub messaging service that reliably deliver messages to the recipient’s phone no. specified. For, this we have to first register our phone no in this service. But, if you want to do this process using CLI, then for this we have to download and install AWSCLI software, then create one IAM user and run “aws configure” command to login using this user credentials by providing Access key and secret access key of this user. You can refer below article for this->
  • > Fourth method will send message to my telegram channel and for doing this I have created one file in which HTTP API url of the telegram bot that we have created is located. This URL consists of Chat id of sender, token of bot we created and text message we want to send to telegram channel. So, we have imported this file along with requests module in order to request a response from the server or URL using “get()” method.
  • > Now, if confidence score is less than specified value or we can say if it detect some other face apart from that face using which we have trained model, then it will create and launch EC2 instance and EBS volume in AWS console and also attach this volume to our instance. We can use AWS CLI commands for doing this but in our case, we have used provisioning tool called “Terraform” that we can install from URL:-

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store