CodeProject.AI Server is a locally installed, self-hosted, fast, free and Open Source Artificial Intelligence server for any platform, any language. No off-device or out of network data transfer, no messing around with dependencies, and able to be used from any platform, any language. Runs as a Windows Service or a Docker container.
![Image 1](https://www.codeproject.com/KB/Articles/5322557/object_detect-r-700.JPG)
Quick Links
CodeProject.AI Server: An Artificial Intelligence Server
For those who want to integrate AI functionality into their applications without writing the AI functionality or dealing with the insanely painful task of ensuring everything is setup correctly. CodeProject.AI Server manages your MLOps for you.
Think of CodeProject.AI Server like a database server: you install it, it runs in the background, and provides AI operations for any application via a simple API. The AI operations are handled by drop-in modules that can be easily created using any language, any stack, as long as that stack runs on the host machine. Python, .NET, node - whatever works for you.
CodeProject.AI server runs as a Windows service, under systemd in Linux, or on startup on macOS. Alternatively there are multiple Docker images for x64, arm64 and CUDA enabled systems. Any language that can make HTTP calls can access the service, and the server does not require an external internet connection. Your data stays in your network.
![Windows Image 2](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) | ![macOS Image 3](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) | ![Apple Silicon Image 4](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) | ![Ubuntu Image 5](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) | ![Ubuntu Image 6](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) | ![Raspberry Pi Image 7](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) | ![Raspberry Pi Image 8](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) | ![Jetson Nano Image 9](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) | ![Docker Image 10](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) |
Windows | macOS | macOS-arm64 | Ubuntu | Debian | Raspberry Pi | Orange Pi | Jetson Nano | Docker |
What Does It Do?
![Image 11](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
The CodeProject.AI Server's Dashboard
Currently CodeProject.AI Server contains AI modules that provide:
- Object Detection (Python and .NET versions that use YOLO, plus a Tensorflow-Lite module that's ultra-lightweight and great for Raspberry Pi and Coral USB sticks
- Face Detection and recognition
- Text processing such as sentiment analysis and summarization
- Image processing such as background removal, background blur, cartoon-isation and resolution enhancement
- Model training, including dataset acquisition, for YOLO object detection
How Do I Use It?
Install the server and start making calls to the API. It's that easy.
Guides, Help, FAQs
CodeProject.AI Server | Home Assistant | Blue Iris |
|
|
|
![Image 12](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
The CodeProject.AI Server's Explorer in action
Why We Built CodeProject.AI Server
-
AI programming is something every single developer should be aware of
We wanted a fun project we could use to help teach developers and get them involved in AI. We'll be using CodeProject.AI Server as a focus for articles and exploration to make it fun and painless to learn AI programming.
We want your contributions!
-
AI coding examples have too many moving parts
You need to install packages and languages and extensions to tools, and then updates and libraries (but version X, not version Y) and then you have to configure paths and...Oh, you want to run on Windows not Linux? In that case, you need to... It's all too hard. There was much yelling at CodeProject.
CodeProject.AI Server includes everything you need in a single installer. CodeProject.AI Server also provides an installation script that will setup your dev environment and get you debugging within a couple of clicks.
-
AI solutions often require the use of cloud services
If you trust the cloud provider, or understand the billing structure, or can be assured you aren't sending sensitive data or won't go over the free tier, this is fine. If you have a webcam inside your house, or can't work out how much AWS will charge, it's not so OK.
CodeProject.AI Server can be installed locally. Your machine, your network, no data needs to leave your device.
1: Running and Playing With the Features
- Install and Run
- For a Windows Service, download the latest version, install, and launch the shortcut to the server's dashboard on your desktop or open a browser to http://localhost:32168.
If you wish to take advantage of a CUDA enabled NVIDIA GPU, please ensure you have the CUDA drivers installed before you install CodeProject.AI. We recommend CUDA 11.8 if running Windows
- For a Docker Container for 64 Bit Linux, run:
docker run -p 32168:32168 --name CodeProject.AI -d codeproject/ai-server
For Docker GPU (supports NVIDIA CUDA), please use:
docker run --gpus all -p 32168:32168 --name CodeProject.AI -d codeproject/ai-server:cuda11_7
- On the dashboard, at the top, is a link to the demo playground. Open that and play!
2: Running and Debugging the Code
- Clone the CodeProject CodeProject.AI Server repository.
- Make sure you have Visual Studio Code or Visual Studio 2019+ installed.
- Run the setup script in /src
- Debug the front-end server application (see notes below, but it's easy).
3. Using CodeProject.AI Server in My Application
Here's an example of using the API for scene detection using a simple JavaScript call:
<html>
<body>
Detect the scene in this file: <input id="image" type="file" />
<input type="button" value="Detect Scene" onclick="detectScene(image)" />
<script>
function detectScene(fileChooser) {
var formData = new FormData();
formData.append('image', fileChooser.files[0]);
fetch('http://localhost:5000/v1/vision/detect/scene', {
method: "POST",
body: formData
})
.then(response => {
if (response.ok) response.json().then(data => {
console.log(`Scene is ${data.label}, ${data.confidence} confidence`)
});
});
}
</script>
</body>
</html>
You can include the CodeProject.AI Server installer (or just a link to the latest version of the installer) in your own apps and installers and voila, you have an AI enabled app.
See the API documentation for a complete rundown of functionality.
Notes on the installers
The native installers (Windows, Ubuntu and macOS) all install the server as a service. On Windows it's a Windows service, on Ubuntu it uses systemd, and on macOS it's simply a login item so will start each time you login.
For all platforms, open http://localhost:32168 to view the dashboard.
To uninstall, please take note of the instructions when you install. For reference:
Notes on CUDA and Nvidia Support
If you have a CUDA enabled Nvidia card, please then ensure you
- install the CUDA Drivers (We recommend CUDA 11.7 or CUDA 11.8 if running Windows)
- Install CUDA Toolkit 11.8.
- Download and run our cuDNN install script to install cuDNN 8.9.4.
Nvidia downloads and drivers are challenging! Please ensure you download a driver that is compatible with CUDA 11.7+, which generally means the CUDA driver version 516.94 or below. Version 522.x or above may not work. You may need to refer to the release notes for each driver to confirm.
Our Docker images are based on CUDA 11.7 (for legacy reasons) and 12.2. As long as you have a driver installed that can handle 11.7 or 12.2 then the docker image will interface with your drivers and work fine.
CUDA 12.2 brings a few challenges with code that uses PyTorch due to the move to Torch 2.0, so we tend to favour 11.7. Some older cards will not be compatible with CUDA 12, or even CUDA 11.7. If you are struggling with older cards that don't support CUDA 11.7 then post a comment and we'll try and help.
Since we are using CUDA 11.7+ (which has support for compute capability 3.7 and above), we can only support Nvidia CUDA cards that are equal to or better than a GK210 or Tesla K80 card. Please refer to this table of supported cards to determine if your card has compute capability 3.7 or above.
Newer cards such as the GTX 10xx, 20xx and 30xx series, RTX, MX series are fully supported.
AI is a memory intensive operation. Some cards with 2GB RAM or less may struggle in some situations. Using the dashboard, you can either disable modules you don't need, or disable GPU support entirely for one or more modules. This will free up memory and help get you back on track.
What Does It Include?
CodeProject.AI Server includes:
- A HTTP REST API Server. The server listens for requests from other apps, passes them to the backend analysis services for processing, and then passes the results back to the caller. It runs as a simple self-contained web service on your device.
- Backend Analysis services. The brains of the operation is in the analysis services sitting behind the front end API. All processing of data is done on the current machine. No calls to the cloud and no data leaving the device.
- The source code, naturally.
CodeProject.AI Server can currently
- Detect objects in images
- Detect faces in images
- Detect the type of scene represented in an image
- Recognise faces that have been registered with the service
- Perform detection on custom models
The development environment also provides modules that can
- Remove a background from an image
- Blur a background from an image
- Enhance the resolution of an image
- Pull out the most important sentences in text to generate a text summary
- Prove sentiment analysis on text
We will be constantly expanding the feature list.
Our Goals
- To promote AI development and inspire the AI developer community to dive in and have a go. Artificial Intelligence is a huge paradigm change in the industry and all developers owe it to themselves to experiment in and familiarize themselves with the technology. CodeProject.AI Server was built as a learning tool, a demonstration, and a library and service that can be used out of the box.
- To make AI development easy. It's not that AI development is that hard. It's that there are so, so many options. Our architecture is designed to allow any AI implementation to find a home in our system, and for our service to be callable from any language.
- To focus on core use-cases. We're deliberately not a solution for everyone. Instead, we're a solution for common day-to-day needs. We will be adding dozens of modules and scores of AI capabilities to our system, but our goal is always clarity and simplicity over a 100% solution.
- To tap the expertise of the Developer Community. We're not experts but we know a developer or two out there who are. The true power of CodeProject.AI Server comes from the contributions and improvements from our AI community.
License
CodeProject.AI Server is licensed under the Server-Side Public License.
Release Notes
What's New - 2.5
- Dynamic Explorer UI: Each module now supplies its own UI for the explorer
- Improved dashboard and explorer
- The module listing now shows module version history if you click the version number
- Explorer benchmark has been updated to use the custom models of the currently active object detection module
- The Info button on the dashboard now includes a status data dump from the module. For things like object detectors, it will include a dictionary of labels / counts so you can see what's being detected. For longer running modules such as training it will include the training status. This is here to enable better UI features in the future
- Updated module settings schema that includes module author and original project acknowledgement
- Installer fixes
- Improved Jetson support
- Lots of bug fixes, but specifically there was a script issue affecting module installs, and a modulesettings.json issue affecting the YOLOv5 6.2 module, as well as the SuperResolution module.
- Updated ALPR, OCR (PP-OCR4 support thanks to Mike Lud) and Coral Object Detection (multi-TPU support thanks to Seth Price) modules
- Pre-installed modules in Docker can now be uninstalled / reinstalled
- A new Sound Classifier module has been included
- 2.5.4: A separate status update from each module that decouples the stats for a module. This just cleans things up a little on the backend
- 2.5.4: Minor modulesettings.json schema update, which introduces the concept of model requirements.
- 2.5.5: Support for long running processes with accompanying stable difussion module.
Previous Versions
Release 2.4
- Mesh support Automatically offload inference work to other servers on your network based on inference speed. Zero config, and dashboard support to enable/disable.
- CUDA detection fixed
- Module self-test performed on installation
- YOLOv8 module added
- YOLOv5 .NET module fixes for GPU, and YOLOv5 3.1 GPU support fixed
- Python package and .NET installation issues fixed
- Better prompts for admin-only installs
- More logging output to help diagnose issues
- VC Redist hash error fixed
- General bug fixes.
- Breaking: modulesettings.json schema changed
Release 2.3
- A focus on improving the installation of modules at runtime. More error checks, faster re-install, better reporting, and manual fallbacks in situations where admin rights are needed
- A revamped SDK that removes much (or all, in some cases) of the boilerplate code needed in install scripts
- Fine grained support for different CUDA versions as well as systems such as Raspberry Pi, Orange Pi and Jetson
- Support for CUDA 12.2
- GPU support for PaddlePaddle (OCR and license plate readers benefit)
- CUDA 12.2 Docker image
- Lots of bug fixes in install scripts
- UI tweaks
- 2.3.4 ALPR now using GPU in Windows
- 2.3.4 Corrections to Linux/macOS installers
Release 2.2.0
This release is still in testing and is focussed mainly on the installation process
- An entirely new Windows installer offering more installation options and a smoother upgrade experience from here on.
- New macOS and Ubuntu native installers, for x64 and arm64 (including Raspberry Pi)
- A new installation SDK for making module installers far easier
- Improved installation feedback and self-checks
- Coral.AI support for Linux, macOS (version 11 and 12 only) and Windows
- Updates:
- 2.2.1 - 2.2.3 various installer fixes
- 2.2.4 - Fix to remove chunking in order to allow HTTP1.1 access to the API (Blue Iris fix)
Release 2.1.x Beta
- Improved Raspberry Pi support. A new, fast object detection module with support for the Coral.AI TPU, all within an Arm64 Docker image
- All modules can now be installed / uninstalled (rather than having some modules fixed and uninstallable).
- Installer is streamlined: Only the server is installed at installation time, and on first run, we install Object Detection (Python and .NET) and Face Processing (which can be uninstalled).
- Reworking of the Python module SDK. Modules are new child classes, not aggregators of our module runner.
- Reworking of the modulesettings file to make it simpler and have less replication
- Improved logging: quantity, quality, filtering and better information
- Addition of two modules:
ObjectDetectionTFLite
for Object Detection on Raspberry Pi using Coral, and Cartoonise for some fun - Improvements to half-precision support checks on CUDA cards
- Modules are now versioned and our module registry will now only show modules that fit your current server version.
- Various bug fixes
- Shared Python runtimes now in /runtimes.
- All modules moved from the /AnalysisLayer folder to the /modules folder
- Tested on CUDA 12
- Patch 2.1.11: YOLO training modulke now allows you to use your own dataset. YOLO 6.2 / Face Processing reverted back to Torch 1.13.
- Patch 2.1.10: Added YOLOv5 training module and support. Improved system info. Orange Pi and NVIDIA Jetson support. Added Triggers. Renamed VersionCompatibililty to ModuleReleases. Becoz speling.
- Patch 2.1.9: Increased and adjustable module install timeout and improved install logs. Fixes around resource contention in PyTorch, Fixes to resource usage reporting, improved Native Linux/WSL CUDA setup. Async fixes. Improvements to half-precision support.
- Patch 2.1.8: Reduced, drastically, the load on the system while getting CPU/GPU usage updates.
- Patch 2.1.7: Fixed a memory / resource leak that may have been causing server shutdowns
- Patch 2.1.6 and below: Installer fixes
Please see our CUDA Notes for information on setting up, and restrictions around, Nvidia cards and CUDA support.
If you are upgrading: when the dashboard launches, it might be necessary to force-reload (Ctrl+R on Windows) the dashboard to ensure you are viewing the latest version.
Release 2.0.x Beta
- 2.0.8: Improved analysis process management. Stamp out those errant memory hogging Python processes!
- 2.0.7: Improved logging, both file based and in the dashboard, module installer/uninstaller bug fixes
- 2.0.6: Corrected issues with downloadable modules installer
- Our new Module Registry: download and install modules at runtime via the dashboard
- Improved performance for the Object Detection modules
- Optional YOLO 3.1 Object Detection module for older GPUs
- Optimised RAM use
- Support for Raspberry Pi 4+. Code and run natively directly on the Raspberry Pi using VSCode natively
- Revamped dashboard
- New timing reporting for each API call
- New, simplified setup and install scripts
Release 1.6.x Beta
- Optimised RAM use
- Ability to enable / disable modules and GPU support via the dashboard
- REST settings API for updating settings on the fly
- Apple M1/M2 GPU support
- Workarounds for some Nvidia cards
- Async processes and logging for a performance boost
- Breaking: The
CustomObjectDetection
is now part of ObjectDetectionYolo
- Performance fix for CPU + video demo
- Patch 1.6.7: potential memory leak addressed
- Patch 1.6.8: image handling improvements on Linux, multi-thread ONNX on .NET
Release 1.5.6.2 Beta
- Docker nVidia GPU support
- Further performance improvements
- cuDNN install script to help with nVidia driver and toolkit installation
- Bug fixes
Release 1.5.6 Beta
- nVidia GPU support for Windows
- Perf improvements to Python modules
- Work on the Python SDK to make creating modules easier
- Dev installers now drastically simplified for those creating new modules
- Added
SuperResolution
as a demo module
Release 1.5 Beta
- Support for custom models
Release 1.3.x Beta
- Refactored and improved setup and module addition system
- Introduction of modulesettings.json files
- New analysis modules
Release 1.2.x Beta
- Support for Apple Silicon for development mode
- Native Windows installer
- Runs as Windows Service
- Run in a Docker Container
- Installs and builds using VSCode in Linux (Ubuntu), macOS and Windows, as well as Visual Studio on Windows
- General optimisation of the download payload sizes
Previous
- We started with a proof of concept on Windows 10+ only. Installs we via a simple BAT script, and the code is full of exciting sharp edges. A simple dashboard and playground are included. Analysis is currently Python code only.
- Version checks are enabled to alert users to new versions.
- A new .NET implementation scene detection using the YOLO model to ensure the codebase is platform and tech stack agnostic
- Blue Iris integration completed.