Click here to Skip to main content
15,393,864 members
Articles / Artificial Intelligence / Tensorflow
Article
Posted 31 Jan 2022

Stats

8K views
5 bookmarked

Using CodeProject.AI Server with Blue Iris

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
31 Jan 2022CPOL7 min read
Integrating CodeProject.AI Server with the Blue Iris video security and webcam system.
Using CodeProject.AI Server with Blue Iris. Updated for running CodeProject SenseAI Server in a Docker Container,
This article is valid for BLue Iris 5.4 and below and CodeProject senseAI (now CodeProject.AI) 1.3. A new version of this article is underway

Introduction

Artificial Intelligence is becoming ubiquitous, but has always seemed to be Yet Another Technology To Learn in a world where there are too many things we need to stay on top of. This is why we are developing CodeProject SenseAI, with a goal to make using AI easier for the average user. The first Beta was released on January 16, 2022 and we're actively adding features, improvements and integrations every week.

This article is specific to CodeProject SenseAI v1.1 Beta. This is a tech preview and so has some rough edges, but we'd rather bring you along for the ride rather than hold off until things are perfect!

A Very, Very Brief Backgrounder

SenseAI is based on the concept of aggregating the best ideas from the AI community and presenting them in a easy to use package. We take care of worrying about frameworks, compiler and interpreter versions, library mismatches, models, setup, download and all the annoying things that can make something fun become a chore.

For a consumer this means a single downloadable installer that Just Works. For a developer it means a single API (via the SenseAI Server) that you program against. The more modules and ideas we aggregate the more features we expose, but always through the same simple API and the same installer.

Using CodeProject.AI Server in The Real World

Because the SenseAI Server's Web Api is compatible with DeepStack (given that DeepStack was the first module we integrated), we were careful to ensure that it was a drop-in replacement for those who have already integrated DeepStack into their apps.

One such integration is with Blue Iris. Blue Iris is a Video Security and Web Camera system for those looking to manage multiple web cameras. With the integration, Blue Iris can detect objects and faces, and react to these in a number of ways, including alerts and emails.

This article with show how to configure Blue Iris to use CodeProject SenseAI Server as its vision AI service.

Preparation

The first step is to get the various pieces of software installed. I'm not going to walk you through these steps, rather I will point you the the installation instructions for each.

  1. Install Blue Iris if not already installed. Download and run the installer found at Blue Iris Downloads. You will be able to run with a Demo License for 15 days before you must buy a single or multi camera license. Don't worry, it is very inexpensive and a one-time expense, $35 or $70 respecively. Not bad for a robust and easy to use security system that keeps all your data local.
  2. Install CodeProject.SenseAI Server. The installer and installation instructions can be found at CodeProject SenseAI Server: AI the easy way.

Configuring Blue Iris

Blue Iris need to run as an Adminstrator. To do this, right-click on the Blue Iris start menu item and select Run as administrator.

Start Blue Iris

If you do not have a license you will see the following:

Blue Iris No License Screen

You can select to register by clicking Next, or continue with the demo license by clicking Demo. I am running in demo mode for the instance I am using to test the integration. You should now see the Blue Iris software running.

Blue Iris Main Screen

If you haven't already configured your cameras for use with Blue Iris, you will need to do this now. Click on the Cameras tab. I will not go into this process here, but it is detailed in the included help documentation in the Cameras section. Click on the ? in the menu bar and then select Help Documentation to view the help.

You can configure Blue Iris by clicking on the gear icon on the upper left menu bar. This will bring up the Blue Iris Settings panel.

Blue Iris Settings Panel

Click on the AI tab. This will open up the AI Settings Panel as shown below. Because we are replacing DeepStack, the information you need to worry about is in the DeepStack section. The setting should be as shown

  • check the Use DeepStack Server checkbox and set the IP/Port to '127.0.0.1' and 5000. These are the default values for SenseAI. You could also use 'localhost' for the IP. If you plan to run SenseAI on another server or port, adjust these values to reflect the server and port you are using.
  • clear the Auto start/stop checkbox. We have to start SenseAI in a different way as Blue Iris is expecting to run different executable than CodeProject.SenseAI.Server.exe. Don't worry, I will be showing you how to run SenseAI as a Windows Service.
  • You probably want to check the Default object detection checkbox so that Blue Iris can use SenseAI to detect object. The default Blue Iris setting is to detect persons, cars ,trucks ,buses,bicycles,and boats and fire alerts when they enter the cameras view.
  • checking the Facial Recognition checkbox will enable recognizing people in Blue Iris using SenseAI's Face Recognition API. This is optional.

AI Settings Panel

Starting SenseAI

In order for Blue Iris to use the AI functionality of CodeProject SenseAI, it must be running.

1. Running as a Windows Service

If you installed CodeProject SenseAI Server using the latest Windows Installer package, then the server will be installed as a Windows Service exposing its API on port 5000.  This Service will start on system restart or if the server crashes, but I doubt you will see this happen.

You don't need to do anything else.

2. Almost as easy: Running SenseAI in a Docker Container

In order to run the Docker container, your system will need to have Docker installed and running.  See Get Started with Docker | Docker for details on this. Then, execute the command

docker run -p 5000:5000 --name SenseAI-Server -d –restart=always -v c:\ProgramData\CodeProject\SenseAI:/usr/share/CodeProject/SenseAI codeproject/senseai-server

Explaination:

  • docker run is the command to run a docker container
  • -p 5000:5000 maps the container’s internal and expose port 5000 to the host port 5000
  • --name SenseAI-Server gives the container a name
  • -d says run the container disconnected (in the background, and does leave you at a command prompt in the container)
  • –restart=always says run the container on Docker Engine/Desktop startup and to restart the container if it exits due to an error.
  • -v c:\ProgramData\CodeProject\SenseAI:/usr/share/CodeProject/SenseAI maps the internal directory:/usr/share/CodeProject/SenseAI to the c:\ProgramData\CodeProject\SenseAI directory on the host machine. You can specify a different directory.  This means that the data will persist over container restarts and updates.  It can also be shared between multiple containers. Of course, on a Linux server this would need to be an entirly different path such as /usr/share/CodeProject/SenseAI.

The container has some test images in the folder /app/demos/TestData.  To get a copy of these on you host file system use the Docker cp command

On Windows, to copy the images to the C:\TestData folder execute the command
docker cp SenseAI-Server:/app/demos/TestData c:\ 

On Linux, to copy the images to ~TestData execute the command
docker cp SenseAI-Server:/app/demos/TestData ~/TestData

CodeProject SenseAI in action

Below is a screengrab of Blue Iris with SenseAI acting as the AI provider. Notice on the left hand side a list of motion events, an image, and the object that was detected along with a confidence level. A car in the driveway, a person at the front door.

AI Settings Panel

Also note that the SenseAI server, in this case, is running on a different machine than the Blue Iris software. Just enter the server and port of the machine running SenseAI (in this case 192.158.1.30:5000) and Blue Iris will route the requests appropriately.

Wrapping up

Congratulations. You are now running SenseAI as the Vision AI provider in Blue Iris. Please give it a spin. We are eager to get feedback to help us improve this product.

License

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

Share

About the Author

Matthew Dennis
Software Developer (Senior) CodeProject
Canada Canada
As Senior Architect, Matthew is responsible for the Architecture, Design, and Coding of the CodeProject software as well as Manager of the Infrastructure that runs the web site.

Matthew works on improving the performance and experience of the Code Project site for users, clients, and administrators.

Matthew has more years of software development, QA and architecture experience under his belt than he likes to admit. He graduated from the University of Waterloo with a B.Sc. in Electrical Engineering. He started out developing micro-processor based hardware and software including compilers and operating systems.
His current focus is on .NET web development including jQuery, Webforms, MVC, AJAX, and patterns and practices for creating better websites.
He is the author of the Munq IOC, the fastest ASP.NET focused IOC Container.
His non-programming passions include golf, pool, curling, reading and building stuff for the house.

Comments and Discussions

 
QuestionFacial Rec in Blue Iris not using the programmed faces from AI Explorer Pin
K. B. D.6-Jul-22 6:41
MemberK. B. D.6-Jul-22 6:41 

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.