Skip to content

Configuring CodeProject.AI Modules

This will all be made easier soon

Our roadmap includes providing an easy to use UI that will provide the means to adjust a module's settings on the fly, making this section redundant. We expect to have this complete by end of August 2022.

Windows Installation or Docker?

For a native Windows Installation you have two options to customise a module's settings:

  1. Have the Windows Service manager pass settings to the module
  2. Edit the modulesettings.json file directly

For those using Docker, the method to customise a module is to add extra command line arguments to the command that launches the CodeProject.AI Docker container

Windows Native installation

Option 1: Restarting the CodeProject.AI service and supplying parameters

By default the Windows installer will install CodeProject.AI as a Windows Service that will start when Windows starts, and restart automatically on failure. If you wish to customise settings then you can opt to start the CodeProject.AI Server's service manually and pass command line parameters to override settings

First, stop the service from a terminal:

Command line
sc stop "CodeProject.AI Server"

Then restart the service, passing in the parameters you wish:

Command line
sc start "CodeProject.AI Server" --MODE=Low

This will restart the service and set the AI mode for Vision inference to "low".

Global Command line parameter overrides

For a list of parameters that can be set for each module, please refer to the API documentation for details.

There are, however, a list of common parameters that can be globally adjusted instead of needing to override them at an individual module level. These are:

Parameter Default Description
--PORT 5000 (windows) / 5500 (macOS) The port on which the server listens for requests
--MODE Medium The detection mode for vision operations. High, medium or low resolution inference
--DATA_DIR C:\ProgramData\CodeProject\AI (Windows)
/usr/share/CodePrpoject/AI (Linux)
~/Library/Application Support/CodeProject/AI (macOS)
The directory containing persisted data for face recognition
--MODELSTORE-DETECTION %MODULES_PATH%\\CustomDetection\\assets The directory containing the custom AI models
--VISION-FACE True Whether vision/face operations are enabled
--VISION-SCENE True Whether vision/scene operations are enabled
--VISION-DETECTION True Whether vision/detection operations are enabled
--CUDA_MODE True Whether CUDA support is to be enabled

Where %MODULES_PATH% is a macro that expands to be the absolute path to the analysis modules directory. By default this is C:\Program Files\CodeProject\AI\AnalysisLayer for a Windows install, and /app/AnalysisLayer for Docker.

For CodeProject.AI Server v1.5.7+, the following are also supported

Parameter Default Description
--MODELSTORE_DETECTION %MODULES_PATH%\\CustomDetection\\assets The directory containing the custom AI models
--VISION_FACE True Whether vision/face operations are enabled
--VISION_SCENE True Whether vision/scene operations are enabled
--VISION_DETECTION True Whether vision/detection operations are enabled

Option 2: Editing the modulesettings.json files

Proceed with caution

While configuring modules is very straightforward, if you make a mistake you may cause a module to no longer function correctly. Always make a backup of any files you modify just in case you need to undo your changes.

The modules included with CodeProject.AI are configued via the modulesettings.json files in the module's directory, typically located at C:\Program Files\CodeProject\AI\AnalysisLayer\<ModuleName>\modulesettings.json, where ModuleName is the name of the module.

There are variants of this file for each supported operating system, in the form modulesettings.<platform>.json, where platform will be windows, macos, macos-arm, linux or docker.

To read more about the modulesettings file, please refer to the developer's guide

To edit values simply open this file in a text editor such as Notepad or Notepad++, make your changes and then save the file. Please, please, please make a backup first.


Refer to the instructions for launching a Docker image.

The command to run the Docker image is

Command line
docker run -p 5000:5000 --name CodeProject.AI-Server -d -v c:\ProgramData\CodeProject\AI:/usr/share/CodeProject/AI codeproject/ai-server

To have the Docker manager pass settings to CodeProject.AI, use the -e setting=value option. For instance, to pass in MODE=Low you would use:

Command line
docker run -e MODE=Low -p 5000:5000 --name CodeProject.AI-Server ...

The settings that can be changed in Docker are the same that are avaiable in a native Windows installation. See the API documentation for module specific settings which are set using the form Modules:ModuleName:Setting=value like

Command line
docker run -e Modules:TextSummary:Activate=False -p 5000:5000 --name CodeProject.AI-Server ...
Also see the section Global Command Line Parameters for a list of global parameters that can be modified using the form --setting=value

Command line
docker run -e MODE=Low -p 5000:5000 --name CodeProject.AI-Server ...