AI: Servers
About
Agent DVR integrates fully with AI servers like DeepStack AI, CodeProject AI, PlateRecognizer.com, Claude and OpenAI (Chat GPT) to add smart alert filtering, object recognition, scene recognition and intelligent event control.
In addition to DeepStack and CodeProject AI, you can also use other AI servers that support the same API:
- https://codeproject.github.io/ Cross Platform GPU/ CPU based AI Processing Server
- https://docs.platerecognizer.com/ License Plate Recognition Server (Web based API)
- https://github.com/runningman84/docker-coral-rest-server - Tensorflow-lite models on an RPi (or Linux/ Mac) with acceleration from Coral USB stick
- https://github.com/robmarkcole/coral-pi-rest-server/ - Tensorflow-lite models on a Coral usb accelerator via a Flask app
- https://github.com/xnorpx/blue-candle - Super small object recognition server
Setting up AI
To set up AI Servers, click on the icon at the top left of the main Agent DVR UI. Then click on Settings under Configuration, select AI Servers from the dropdown menu, and click Configure.
Agent DVR integrates with CodeProject.AI for various AI features including object recognition, face recognition, ALPR (Automatic License Plate Recognition), and super resolution (enhance). PlateRecognizer.com is also supported as an ALPR provider. CodeProject.AI is open source, free, and compatible with most platforms.
To start, install an AI server for your platform and connect Agent DVR to it by clicking the Configure button and then Add.
You can add as many AI servers to Agent DVR as needed. Cameras in Agent DVR can be configured to use different AI servers for each function, or you can use one AI server for all tasks.
Configuring your Server
- Name: Name your server, e.g., Cat Catcher.
- AI Server URL: Enter the URL of your AI server, e.g., http://localhost:32168/
- API Key: Enter your key if set up (optional).
- Timeout: The timeout in seconds for server requests.
- Retry delay: The time in seconds before retrying a failed request to this server.
Click OK to save your settings.
Using OpenAI
To set up OpenAI ("Chat GPT") to answer questions about what's happening in your video feed, navigate to Server Settings - AI Servers and select "Open AI" under Ask AI.
- URL: Enter the URL for the service. The default is "https://api.openai.com/v1/chat/completions".
- OpenAI API Key: After registering with OpenAI, go to the API Keys Page and generate a new secret key. Copy and paste this key into the specified field.
- Model: Specify the model to be used. The default is gpt-4o. OpenAI may remove or change this at a later time.
- Max Tokens: This sets the maximum token usage per request. If you encounter issues, check the logs at /logs.html as it could be related to token usage.
Once OpenAI is configured, refer to Ask AI for instructions on how to use it for answering general questions about what's happening in your camera feed.
Using Claude
To set up Claude AI to answer questions about what's happening in your video feed, navigate to Server Settings - AI Servers and select "Claude" under Ask AI.
- URL: Enter the URL to the service. Default is "https://api.anthropic.com/v1/messages".
- Claude API Key: After signing up for Claude, visit the API Keys Page and create a new secret key. Copy and Paste this key into the field.
- Version: Specify the version to use. The default is 2023-06-01 This may be removed or changed at some point by Anthropic.
- Model: Specify the model to use. The default at time of writing is claude-3-sonnet-20240229.
- Max Tokens: This controls the maximum token spend per request. Check the logs at /logs.html if you have issues as it might be related to token spend.
Once Claude is configured see Ask AI for how to use it to recognise general scenarios in your camera feed.
Using Gemini
To set up Gemini to answer questions about what's happening in your video feed, navigate to Server Settings - AI Servers and select "Gemini" under Ask AI.
- URL: Enter the URL to the service. Default is "https://generativelanguage.googleapis.com".
- Gemini API Key: After signing up for Gemini, visit the API Keys Page and create a new secret key. Copy and Paste this key into the field.
- Version: Specify the version to use. The default is v1beta This may be removed or changed at some point by Google.
- Model: Specify the model to use. The default at time of writing is gemini-1.5-flash.
- Max Tokens: This controls the maximum token spend per request. Check the logs at /logs.html if you have issues as it might be related to token spend.
Once Gemini is configured see Ask AI for how to use it to recognise general scenarios in your camera feed.
Using PlateRecognizer.com
To configure LPR (ANPR or License Plate Recognition) in Agent DVR, go to Server Settings - AI Settings and enter the details under Plate Recognizer. Sign up for a Free Trial at Plate Recognizer. No credit card required.
- URL: Enter the URL to the service. Default is "https://api.platerecognizer.com/v1/plate-reader/", or use your own server if hosting your own instance.
- Token: After signing up for Plate Recognizer, visit the Account Page and copy the API Token.
- Regions: Leave blank for default or enter a CSV list of regions.
- Config: Enter additional configuration values from the docs if needed.
Managing AI Modules
In the AI server list (referenced above), you have options to configure, test, edit, and remove AI servers. Click on the configure button to display the modules available or installed on the selected server.
Agent DVR retrieves the current module list from your server and offers a user interface for installing, uninstalling, configuring, and testing each module. Support is provided for all default CodeProject.UI modules, although Agent DVR only utilizes a subset of these.
To utilize ALPR (Automatic License Plate Recognition), Super Resolution, or Face Recognition in Agent DVR, you will need to install the respective module from this page. Typically, default settings suffice for these modules, but you can configure them by clicking on the icon under each module.