Face Recognition using Uipath

On , by

Overview#overview

Basically, Face recognition technology is used to identify or recognize the person using the digital image of the person. Face recognition is now widely used in many systems, even mobile phones are now equipped with face recognition. Mostly face recognition is used for security purposes like authentication.

In this case study, we will see how to implement face recognition with uipath. We’ll do it by logging in to an open-source CRM called dolibarr. We will use it for an inventory management system that orders the product if the stock depletes. Our bot will detect the user’s face and logs in the recognized user. Let’s see how to do it.

Process#process

In this process, we will be using the official uipath face recognition framework. Where there will be python code which we can customize according to our requirements. In the process.xaml file, we will do the necessary things that we need for the login to the dollibar account.

The Main.xaml file will look like the above image. In the config file, specify the file path where you have installed the python path. Now run the Main. XAML file, a dialog box pops up where it shows two buttons train and execute.

Click on the train button. Now it will ask for the login credentials of the machine you are using for security purposes. We will modify this part in the face recognition folder login.html file as well as in the workflow file. Then enter the username and password of the machine.

After a successful login, you can see yourself on the screen. By using the space button you can take a picture of yourself. Take a couple of images so that the bot can recognize you easily during execution. Once when you are done with taking pictures, close the window. If you want to use or press any other button, you can change it in the python file according to your requirement. We can also set a time interval for taking pictures without clicking anytime and close the window automatically.

After completing the training, the bot will be closed automatically. Now again run the main .xaml file and then click on the execute button. Then click on the space button once you appear on the screen. It will take a few minutes to detect the person. Close the window, by default it shows a message “This is where your custom process should be. Edit the Process.xaml workflow in order to customize it.”. Now go to process file to get rid of this message.

Login Process#login-process

After getting detected correctly, now we can do the login process. Go to your process file and add open browser activity. Specify the dollibar URL in the open browser activity. Then add type into activity inside open browser activity. Now we need to get the username of the detected user. In order to that, we need to make some changes in the python code.

Go to the framework folder, then go to the face recognition folder. Inside it, open the identify_face_image python file. Here is where we need to make some changes. The invoke python method returns an object, but we need the name in the form of a string. First, change the type argument to object to get python object property and then set result variable to object.

In the message box, change the result to result.tostring. Now go to the python file, remove the message in the last line and then store the message in a variable. Then at the last line enter the following.

return Success+" "+result_names

So this will return a success message and the username.

Now use regex to extract the username alone and ignore the success message.

Now we have got the username, go to your process file and then bind the username in the type into activity. Then add another type into activity to type the password in the password field. Use switch case for storing passwords according to the username. Finally, use click activity to click on the login button. That’s it we’re done.

Check out the bot in action below:

Share this article on Twitter or LinkedIn
Previous Blog Post: Ownership in Rust #RustWorthy Part 2
Subscribe to Sudo vs Root

Our newsletter rolls out every month. No fluff. Pure content.

Comments and Discussions
Skcript https://www.skcript.com/svr/face-recognition-using-uipath/ https://www.skcript.com/svrmedia/heroes/face-recognition-using-uipath@1.5x.png