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 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 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 with 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 the the installation instructions for each.
- 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.
- 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 need to run as an Adminstrator. To do this, right-click on the Blue Iris start menu item and select Run as administrator.

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

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.

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.

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.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 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 CodeProject.AI's Face Recognition API. This is optional.

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
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 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 entirly 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 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 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.

Also note that the 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.
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.