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 of 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.
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.
My folder path is C:\Blue Iris\New. This is where the snapshot is stored.
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.
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.
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.
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....
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.
Perfect! Email notifications are working. Hit OK to exit the email profile, then OK again to exit the Blue Iris settings.
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.
Then click the + icon to add a new alert. A dropdown loads. From there, select Send email.
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
Before proceeding, open CodeProject.AI Server in your browser by inputting http://localhost:32168/, or 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.
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.
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.