Click here to Skip to main content
15,672,482 members
Articles / Artificial Intelligence
Posted 3 Mar 2023


5 bookmarked

A Guide to Detection of an Unknown Face with CodeProject.AI Server and Blue Iris

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
3 Mar 2023CPOL6 min read
In this article I use CodeProject.AI Server and Blue Iris to detect an unknown person and send an email notification with a picture when that happens.

Image 1

In my article, CodeProject.AI Server, Blue Iris and Face Recognition I demonstrate how to set up a facial profile in CodeProject.AI Server and Blue Iris, and how to have that facial profile recognized. I feel like a lot articles, videos, and tutorials walk through this exact scenario: This is the face I want recognized, and here's how I get the software recognize it. But someone on the article forum asked, "I live alone and don't really need to be notified about myself, how would I set this up to get a notification when a stranger shows up?"

This seemed like an extremely practical scenario, so this is how you use CodeProject.AI Server and Blue Iris to detect an unknown person and send an email notification with a picture when that happens.

My Setup

Setting Up Facial Recognition in Blue Iris

If there are some faces you want Blue Iris to recognize, that aren't unknown faces, here's how you set up facial recognition in Blue Iris. In addition, I'll demonstrate how to set up Blue Iris to detect an unknown person as well.

The first step is to take a snapshot of the face you want to profile. By turning on Facial recognition in Blue Iris, you need to add a Face profile so CodeProject.AI Server has something to recognize.

Image 2

Make sure the camera is on, look at it directly on, then on the camera settings panel, click the snapshot button. This saves a snapshot to the folder that stores recordings. There are four folders that store recordings, which can be modified in the Clips and archiving tab in the Blue Iris settings.

Image 3

My folder path is C:\Blue Iris\New. This is where the snapshot is stored.

Image 4

Now go to the AI tab in the main Blue Iris Settings, and check the box for Facial recognition. Then click the Faces... button to create a face profile. From here, click the + symbol, then go to the New folder to select the snapshot, then hit Open. For me, this added the snapshot as face1.

Image 5

Select face1, click the Edit button (the pencil icon), rename the face to whatever you want (in my case, "Sean"), then hit OK to exit the faces profile window, then OK again to exit the Blue Iris settings.

Image 6

Now go to the Trigger tab in the camera settings, then hit Artificial Intelligence to launch the camera's AI settings. In the To confirm box, input the name of the face profile just created. In my case, this is "Sean". In addition, when a face is not recognized in Blue Iris, it is classified as "unknown". So in order to detect the faces of people we don't know, we need to put "unknown" in the To confirm box as well, separated by a comma (and no space). Hit OK to exit the AI settings, then OK to exit the camera settings.

Setting up Blue Iris Alerts

The next step is to set up the email server. Go to the Blue Iris main settings, then the Emails servers tab. Hit the + symbol to enter the email settings.

Image 7

There are multiple options here, including AOL Mail, Gmail, Yahoo, and Zoho. Choosing one of the presets automatically fills in the Server address. You can also choose User defined, but you'll need to know the server address for that option. Enter a description for the email profile. In my case, I have a throwaway Gmail account I use to test some thing for CodeProject, so from the Preset dropdown I select Gmail, and my Description is "Gmail CodeProject". Unlike some of the other SMTP servers, Gmail requires Oauth authentication, so input the Gmail address in Login field, the password for your Gmail account, then hit OAuth....

Image 8

Click the Sign in with Google button then follow the instructions.

Next, input the From email (I use the same email to which the alert is going). Then hit Test.

Image 9

Perfect! Email notifications are working. Hit OK to exit the email profile, then OK again to exit the Blue Iris settings.

Image 10

Now it's time to set up the alerts. Go to the camera settings, and the Alerts tab. I actually left all the main settings in the alerts menu default. From here, click On Alert.

Image 11

Then click the + icon to add a new alert. A dropdown loads. From there, select Send email.

Image 12

In the Required AI objects field, input "unknown". Then make sure the Outgoing (SMTP) server has the profile selected. In my case, "Gmail CodeProject."

In the Recipient(s) field, input the email address that will receive the alert. Then make the subject and body of the email whatever you wish. Hit OK to exit the email configuration alert settings, OK to exit the Action set menu, and OK to accept the camera settings.

Note: If you want to detect your known face as well (in my case, "Sean"), repeat the Configure Email alert process, but instead of putting "unknown" in the Required AI objects field, put "Sean". However, if the intent is to 'only' detect unknown faces, this process is not necessary.

Detecting an Unknown Face and Getting an Alert

Image 13

Before proceeding, open CodeProject.AI Server in your browser by inputting http://localhost:32168/, or from the From the AI tab in the Blue Iris main settings, click Open AI control panel to open CodeProject.AI Server in your browser. Make sure that Face Processing is enabled in CodeProject.AI Server. Feel free to switch off every other process since we're only using Face Processing. Do this by clicking on the three dots on a process and selecting Stop.

Image 14

All right, let's detect some unknown people! It will just be me at bad angles, but it will demonstrate the concept well enough. Make sure the camera is on, then move around in front of it. For fun, I waved my hand in front of my face like John Cena.

Now let's check Gmail for the notification.

Image 15

Bingo! Blue Iris sent an email alert with the exact subject I input, with a snapshot of the unknown face that entered the camera's frame.

And that's it. That's how you set up CodeProject.AI Server and Blue Iris to detect an unknown face, and trigger an action based on that recognition. If you look at the potential actions in the Action set menu, there are a lot of options for actions, like a mobile push notification, a web request or MQTT message, an SMS message, a phone call, an FTP image upload, etc., but we'll use one of these in a future article. For now, thanks for reading and if you have any questions, please feel free to ask them in the article forum below. You never know, your question might lead to an article that will help other people with the same problem.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Technical Writer CodeProject
Canada Canada
Sean Ewington is the Content Manager for CodeProject.

His background in programming is primarily C++ and HTML, but has experience in other, "unsavoury" languages.

He loves movies, and likes to say inconceivable often, even if it does not mean what he thinks it means.

Comments and Discussions

QuestionSave Unknown Face local folder Pin
Alex Irimie8-Mar-23 1:36
Alex Irimie8-Mar-23 1:36 
AnswerRe: Save Unknown Face local folder Pin
Sean Ewington20-Mar-23 9:13
staffSean Ewington20-Mar-23 9:13 
GeneralRe: Save Unknown Face local folder Pin
Alex Irimie20-Mar-23 9:25
Alex Irimie20-Mar-23 9:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.