A standalone, self-hosted, fast, free and Open Source Artificial Intelligence microserver for any platform, any language. It can be installed locally, required no off-device or out of network data transfer, and is easy to use.
-
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 SenseAI as a focus for articles and exploration to make it fun and painless to learn AI programming.
-
We got sick of fighting versions and libraries and models and being blocked by tiny annoying things every step of the way. So we put put this together so we could save you the frustation. We'll take care of the housekeeping, you focus on the code.
-
We also got sick of needing to sign up to potentially expensive services for AI functionality. This is something we need, and by sharing maybe you can use it too, and hopefully add your own modules and improvements along the way.
- Download the latest version, install, and launch the shortcut to the server's dashboard on your desktop.
- On the dashboard, at the bottom, is a link to the demo playground. Open that and play!
- Clone the CodeProject SenseAI reposotory.
- Make sure you have Visual Studio Code or Visual Studio 2019+ installed.
- Run the setup script in /Installers/Dev
- Debug the front-end server application (see notes below, but it's easy)
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 SenseAI 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.
CodeProject SenseAI 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.
- Windowws
- Linux (Ubuntu)
- macOS
- Docker
It can detect stuff!
CodeProject SenseAI 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
- Pick out the most relevant sentences from text to generate a summary
We will be constantly expanding the feature list.
- To promote AI development and inspire the AI developer community to dive in and have a go. AI is here, it's in demand, and it's a huge paradigm change in the industry. Whether you like AI or not, developers owe it to themselves to experiment in and familiarise themselves with the technology. This is CodeProject SenseAI: a demonstration, a playground, a learning tool, 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 SenseAI comes from the contributions and improvements from our AI community.
This is a Beta release and so support is constrained solely to Windows 10+, 64bit, using CPU acceleration. Future releases will include other Operating Systems as well as GPU support.
To install CodeProject.SenseAI as a standalone service ready for integration with applications such as HomeAssist or BlueIris, download the latest installation package.
Double click the installer. This will install the server as a Windows Service. SenseAI Server and the backend analysis services will now be running, and will automatically restart each time your machine is restarted.
To explore CodeProject.SenseAI Click on the SensaAI playground link on the server dashboard. The server will, of course, need to be running for this test application to function. Sample images can be found in the TestData
folder under the C:\Program Files\CodeProject\SenseAI
folder
docker run -p 5000:5000 --name SenseAI-Server -d -v c:\ProgramData\CodeProject\SenseAI:/usr/share/CodeProject/SenseAI codeproject/senseai-server
docker run -p 5000:5000 --name SenseAI-Server -d -v /usr/share/CodeProject/SenseAI:/usr/share/CodeProject/SenseAI codeproject/senseai-server
docker run -p 5500:5000 --name SenseAI-Server -d -v /usr/share/CodeProject/SenseAI:/usr/share/CodeProject/SenseAI codeproject/senseai-server
For Docker, please visit http://localhost:5000/testdata.zip (after launching SenseAI server) to download some test images for use with the SenseAI playground
If you wish to debug or make enhancements to the code then you should install:
-
Visual Studio Code or Visual Studio 2019+. VS Code is available on Windows, macOS and Linux. Visual Studio is available on Windows and macOS. We've tested against both, but not against other IDEs at this point
-
Python. You may add Python support either via the Visual Studio Installer, through Visual Code Extensions, or by downloading python directly. However, this is not needed since Python will be installed automatically as part of the development environment setup script.
-
.NET 6 SDK Download the .NET SDK 6 here.
-
For the (Optional) WIX installers we do all our work within Visual Studio. For this you will need to a. Extensions -> Manage Extensions, search for Wix and install Wix toolset Visual Studio 2019 Extension b. Download the Wix Toolset Build tools by heading to the download page, clicking the download link, and then download the .exe installer from the GitHub page you're directed to. The current version is 3.11. c. Ensure you have .NET 3.5.1 (that's not a typo) installed. See the /Installers/Windows/.NET 3.5.1 directory for a link to the installer download.
You do not need to install support for creating the installers for general development.
-
For Windows simply ensure the .NET 6 SDK is installed.
-
For Ubuntu 21.10, 21.04 (inc. LTS), 18.04 (LTS) first install the .NET 6 packages
wget https://packages.microsoft.com/config/ubuntu/<UBUNTU-VERSION-HERE>/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb
where <UBUNTU-VERSION-HERE> is the version of Ubuntu (use
lbs_release -d
to find your current version). Note that for Ubuntu 21.10 you should use 21.04 due to the 21.10 packages not yet being available.To install the .NET 6 SDK on Ubuntu run
sudo apt-get update; \ sudo apt-get install -y apt-transport-https && \ sudo apt-get update && \ sudo apt-get install -y dotnet-sdk-6.0
See Install the .NET SDK or the .NET Runtime on Ubuntu for more information.
-
For macOS just use the standalone .NET SDK installers
You'll need the following extensions
-
You will need to install the C# Extension for WSL, even if you've already installed it for Windows.
Load up the SenseAI project in VS Code within Ubuntu by navigating to the SenseAI root folder in a Ubuntu window and typing "
code .
". Then head to the C# Extension page, choose install, and the extension should be installed. If you get a warning that there is an instance of VS Code already running, close VS code and hit the install button again. -
Also install the Remote WSL Extension for Visual Studio Code.
-
Clone the CodeProject.SenseAI repository from GitHub
-
run
/installers/Dev/setup_dev_env_win.bat
(for windows) orsudo bash setup_dev_env_linux.sh
(for Ubuntu or macOS). This will download required assets and setup the Python environment.
-
Open the main application folder in VS Code
-
Click the "Run and Debug" button on the left hand tab bar (the arrow)
-
From the dropdown at the top of the window, select Launch CodeProject.SenseAI
-
CLick the green arrow next to the dropdown
The dashboard webpage should launch after the code has built and the server has started.
-
You may wish to have the Python workflow enabled in Visual Studio. While not critical, it does help with debugging.
-
Open the solution in Visual Studio and build the entire solution
-
To run the Server and the demo application in DEBUG you can either
-
Start both the projects in debug mode by
- In Solution Explorer, open demos / .NET and right-click on CodeProject.SenseAI.Playground and choose Debug -> Start new instance.
- In Solution Explorer, open src / API / Server and right-click on FrontEnd and choose Debug -> Start new instance.
-
Configure Visual Studio to start multiple projects by
-
Now when you start with or without debugging, both the Server and demo projects with start. Also, this will be shown on the toolbar as shown below.
-
-
In Solution Explorer, open src / AnalysisLayer. Right click on DeepStack and choose
Open Folder in File Explorer
. Double click on the start.bat script. This script will ensure that the Python virtual environment is enabled and environment variables set.
At this point the Playground application should be indicting it has a connection to the API server, and the server should be dispatching requests to the backend Analysis layer.
YOLO ONNX models not found
When building you see:
error MSB3030: Could not copy the file "<path>\CodeProject.SenseAI.AnalysisLayer.Yolo\assets\yolov5m.onnx" because it was not found.
Ensure you've run the development setup scripts before attempting to build
Server startup failed
System.ComponentModel.Win32Exception (2): The system cannot find the file specified.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
Ensure you've run the development setup scripts before attempting to start the server
Port already in use
If you see:
Unable to start Kestrel.
System.IO.IOException: Failed to bind to address http://127.0.0.1:5000: address already in use.
Either you have CodeProject.SenseAI already running, or another application is using port 5000. Either shut down any application using port 5000, or change the port CodeProject.SenseAI uses. You can change the external port that CodeProject.SenseAI uses by editing the appsettings.json
file and changing the value of the PORT
variable. In the demo app there is a Port setting you will need to edit to match the new port.
The following features will be added over the coming weeks and months
- Better Linux / macOS development environment support
- Docker images
- A GUI management system
- GPU support
- More analysis services