Click here to Skip to main content
15,946,342 members
Articles / Artificial Intelligence / Tensorflow

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 50.8K   6   7
Integrating CodeProject.AI Server with the Blue Iris video security and webcam system
Using CodeProject.AI Server with Blue Iris. Updated for running CodeProject.AI Server in a Docker Container
This article is valid for BLue Iris 5.4 and below and CodeProject.AI Server 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.AI Server, 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.AI Server 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

CodeProject.AI Server is based on the concept of aggregating the best ideas from the AI community and presenting them in an 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 CodeProject.AI 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 CodeProject.AI 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 will show how to configure Blue Iris to use CodeProject.AI 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 to 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 respectively. Not bad for a robust and easy-to-use security system that keeps all your data local.
  2. Install CodeProject.AI Server. The installer and installation instructions can be found at CodeProject.AI Server: AI the easy way.

Configuring Blue Iris

Blue Iris needs to run as an Administrator. 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 settings 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 CodeProject.AI. You could also use 'localhost' for the IP. If you plan to run CodeProject.AI 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 CodeProject.AI in a different way as Blue Iris is expecting to run a different executable than CodeProject.AI.Server.exe. Don't worry, I will be showing you how to run CodeProject.AI as a Windows Service.
  • You probably want to check the Default object detection checkbox so that Blue Iris can use CodeProject.AI to detect an object. The default Blue Iris setting is to detect persons, cars, trucks, buses, bicycles, and boats and fire alerts when they enter the camera's view.
  • Checking the Facial Recognition checkbox will enable recognizing people in Blue Iris using CodeProject.AI's Face Recognition API. This is optional.

AI Settings Panel

Starting CodeProject.AI Server

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

1. Running as a Windows Service

If you installed CodeProject.AI 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 CodeProject.AI Server 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 32168:32168 --name CodeProject.AI-Server -d 
-v c:\ProgramData\CodeProject\AI:/usr/share/CodeProject/AI codeproject/ai-server

Explanation:

  • 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 CodeProject.AI-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\AI:/usr/share/CodeProject/AI maps the internal directory :/usr/share/CodeProject/AI to the c:\ProgramData\CodeProject\AI 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 entirely different path such as /usr/share/CodeProject/AI.

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

On Windows, to copy the images to the C:\TestData folder, execute the command:

docker cp CodeProject.AI-Server:/app/demos/TestData c:\

On Linux, to copy the images to ~TestData, execute the command:

docker cp CodeProject.AI-Server:/app/demos/TestData ~/TestData

CodeProject CodeProject.AI Server in Action

Below is a screengrab of Blue Iris with CodeProject.AI Server 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 CodeProject.AI 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 CodeProject.AI Server (in this case, 192.158.1.30:5000) and Blue Iris will route the requests appropriately.

Wrapping Up

Congratulations! You are now running CodeProject.AI Server 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)


Written By
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

 
QuestionNecessary to uninstall Deepstack initially? Pin
Franc 1593668427-Feb-23 9:11
Franc 1593668427-Feb-23 9:11 
QuestionDocker required? Pin
Member 1590169122-Jan-23 7:00
Member 1590169122-Jan-23 7:00 
QuestionHow to use this with Blue Iris Pin
Joseph Anthony 202218-Oct-22 18:22
Joseph Anthony 202218-Oct-22 18:22 
QuestionBlueiris to record only when object is detected Pin
Zeeshan Yousuf 202222-Aug-22 4:14
Zeeshan Yousuf 202222-Aug-22 4:14 
AnswerRe: Blueiris to record only when object is detected Pin
wilsotc19-Nov-23 6:03
wilsotc19-Nov-23 6:03 
QuestionFacial Rec in Blue Iris not using the programmed faces from AI Explorer Pin
K. B. D.6-Jul-22 6:41
K. B. D.6-Jul-22 6:41 
AnswerRe: Facial Rec in Blue Iris not using the programmed faces from AI Explorer Pin
K. B. D.22-Oct-22 7:21
K. B. D.22-Oct-22 7:21 

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.