Windows Installer
找不到自定义模型
当 CodeProject.AI Server 安装时,它会附带两个不同的对象检测模块。这两个模块的工作方式相同,区别在于一个是用 Python 实现并支持 CUDA GPU,另一个是用 .NET 实现并支持嵌入式 Intel GPU。每个模块都附带一套可用的自定义模型。对于自定义对象检测,您需要
- 确保已启用对象检测(默认情况下已启用)
- 使用提供的自定义模型,或者 a. 将您自己的模型添加到标准的自定义模型文件夹(C:\Program Files\CodeProject\AI\modules\ObjectDetectionYolo\custom-models 或 C:\Program Files\CodeProject\AI\modules\ObjectDetectionNet\custom-models),如果使用 Windows 安装,或者 b. 指定一个包含模型的目录(适用于 Docker)
要指定不同的文件夹用于自定义模型,您可以:
- 在启动时设置
--Modules:ObjectDetectionYolo:EnvironmentVariables:CUSTOM_MODELS_DIR
参数,或 - 设置
Modules:ObjectDetectionYolo:EnvironmentVariables:CUSTOM_MODELS_DIR
环境变量,或 - 在 ObjectDetectionYolo 文件夹中的 modulesettings.json 文件中设置
CUSTOM_MODELS_DIR
值,或 - 设置全局覆盖(即将弃用!)变量
MODELSTORE-DETECTION
指向您的自定义对象文件夹,或 - (对于 Docker)将包含自定义模型的文件夹(例如 C:\MyCustomModels)映射到对象检测的自定义资产文件夹(/app/modules/ObjectDetectionYolo/custom-models)。例如:
docker run -p 32168:32168 --name CodeProject.AI-Server -d ^
--mount type=bind,source=C:\ProgramData\CodeProject\AI\docker\data,target=/etc/codeproject/ai ^
--mount type=bind,source=C:\MyCustomModels,target=/app/modules/ObjectDetectionYolo/custom-models,readonly
codeproject/ai-server
This mounts the *C:\MyCustomModels* directory on my local system and maps it to the */app/modules/ObjectDetectionYolo/custom-models* folder in the Docker container. Now, when CodeProject.AI Server is looking for the list of custom models, it will look in *C:\MyCustomModels* rather than */app/modules/ObjectDetectionYolo/custom-models*
See the [API Reference - CodeProject.AI Server](https://codeproject.org.cn/AI/docs/api/api_reference.html#custom-object-detector)
端口已被占用
如果您看到:
Unable to start Kestrel.
System.IO.IOException: Failed to bind to address http://127.0.0.1:5000: address
already in use.
要么 CodeProject.AI 已经在运行,要么另一个应用程序正在使用 5000 端口。
我们的第一个建议是不要再使用 5000 端口。这是一个保留端口,但并非所有操作系统都在积极使用它。我们更倾向于使用 32168 端口,因为它易于记忆,并且远离其他已用端口。
您可以通过编辑 appsettings.json 文件并更改 CPAI_PORT
变量的值来更改 CodeProject.AI 使用的外部端口。在演示应用程序中,有一个端口设置需要您进行编辑以匹配新端口。
如果不行,请关闭任何使用端口 5000 的应用程序(包括任何已安装的 CodeProject.AI Server 版本,如果您正尝试在 Visual Studio 的开发模式下运行)。
GPU 未被使用
请确保您已安装 NVidia CUDA 驱动程序
- 安装 CUDA 11.7 驱动程序
- 安装 CUDA 工具包 11.7。
- 下载并运行我们的 cuDNN 安装脚本。
CodeProject.AI Server 随机停止(通常在一天中的同一时间)
如果您发现 CodeProject.AI Server 每天随机离线一次(有时两次),或者发现像车牌识别器这样的某些模块每天都会关闭一次,则可能与备份软件存在冲突。为了确定是否是这种情况,请手动运行您的备份,看看 CodeProject.AI Server 是否离线。有趣的是,服务仍在运行,但显示为“离线”。这可能与特定的备份软件有关,例如 Acronis。
对于车牌识别器关闭,并且您正在为 CodeProject.AI Server 使用 GPU 并且运行的是 AMD GPU,请尝试启用对象检测(YOLOv5.NET)并禁用对象检测(YOLOv5.6.2)。后者仅支持较新的 NVidia GPU,而前者在 Windows 上使用 DirectX 或 WSL 访问 GPU,因此如果您的 DirectX 驱动程序已安装,它将支持您的 AMD GPU。
OSError: [WinError 1455] The paging file is too small for this operation to complete
简而言之,您的分页文件太小了。如果您已更改(减少)分页文件设置以节省磁盘空间,您可能需要增加其大小,为系统提供更多空间。如果不行,可能是因为您安装的 RAM 太少。我们建议当前版本至少需要 8GB。
服务器启动失败,出现“System.Management.ManagementException: Invalid class”错误
您将看到的错误是
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for
'CodeProject.AI.SDK.Common.SystemInfo' threw an exception.
---> System.Management.ManagementException: Invalid class
这是由于 WMI 存储库损坏。要修复损坏的 WMI,请执行以下操作
- 打开管理员命令提示符或 PowerShell 窗口
- 运行
winmgmt /verifyrepository
。如果存储库有问题,它将响应“repository is not consistent”。 - 如果存储库不一致,则需要修复。运行
winmmgmt /salvagerepository
- 再次运行
winmgmt /verifyrepository
。 - 如果它仍然报告“respository in not consistent”,那么您可能需要采取激进措施重置存储库。有关如何执行此操作以及涉及的风险的详细信息,请参阅下面的链接。
参见
模块启动失败
如果您拥有一般的硬件设置,那么每个模块可能需要更多的时间来启动,然后才能继续加载下一个模块。
在每个模块的文件夹中的 modulesettings.json 文件中,有一个设置 PostStartPauseSecs
。它指定了给定模块加载和加载下一个模块之间的暂停时间。如果您的模块未能正确加载,请将其设置为 3 到 5 秒。
FaceProcessing 的安装报告了一个 urllib3 错误,该错误可以忽略
在安装 FaceProcessing 时,会报告一个与 urllib3 相关的错误。此错误可以安全地忽略。我们正在考虑如何解决这个问题,但 FaceProcessing 在没有它的情况下也能正常工作。
22:58:56:ObjectDetectionYolo: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
22:58:56:ObjectDetectionYolo: botocore 1.29.142 requires urllib3<1.27,>=1.25.4, but you have urllib3 2.0.3 which is incompatible.
22:58:56:ObjectDetectionYolo: google-auth 2.19.0 requires urllib3<2.0, but you have urllib3 2.0.3 which is incompatible.
UsbDk 安装失败(用于 ObjectDetection(Coral))
如果您正在安装 Coral USB 所需的 UsbDk,Windows 上存在一个已知问题。错误看起来像这样:There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.(此 Windows Installer 程序包存在问题。作为安装一部分运行的程序未按预期完成。请联系您的支持人员或程序包供应商。)
要解决此问题,请将 MSI 解压到某个子目录,如下所示
打开管理员命令提示符。转到 usbdkcontroller.exe 所在的目录
重启
Windows 10 .NET Framework 更新(KB5034275)(KB5033918)(KB5034466)(KB5034582)影响 PowerShell,cuDNN
如果您最近进行了 Windows 10 更新,并且发现任何需要调用 PowerShell 的外部程序无法工作,并且 cuDNN 的脚本无法运行,这可能是最近的 Windows 10 更新问题。特别是这些更新
2024 年 1 月 9 日 - KB5034275 累积更新(适用于 .NET Framework 3.5、4.8 和 4.8.1 for Windows 10 Version 22H2)(KB5033918)或(KB5034466),以及 2024 年 1 月 23 日 - KB5034582 累积更新预览(适用于 .NET Framework 3.5、4.8 和 4.8.1 for Windows 10 Version 22H2)。
升级到这些更新的更高版本,或者可能卸载更新应该可以解决问题。
对象检测失败:无法为模型创建 YOLO 检测器
如果您尝试使用对象检测模块并遇到
请转到 C:\Program Files\CodeProject\AI\modules\ObjectDetectionYolo\assets。您应该会看到一组 .pt 文件。如果看不到,则表示您的安装程序失败了。
要解决此问题,您需要重新安装该模块。转到 CodeProject.AI Server 仪表板上的 **Install Modules**(安装模块)选项卡。找到您正在使用的对象检测模块,然后单击 **Uninstall**(卸载)。然后,一旦可用,单击 **Install**(安装)。
有关模块未启动、找不到包、某项失败或关机等错误
如果您在使用特定模块时遇到以下任何错误
Unable to load the model
Error trying to start
An error occurred trying to start process
ModuleNotFoundError: No module named
请转到 C:\Program Files\CodeProject\AI\modules[Module in question](C:\Program Files\CodeProject\AI\modules[问题模块])并查看 install.log。这可能表明安装失败或某项内容未能下载。如果是这种情况,您需要重新安装该模块。转到 CodeProject.AI Server 仪表板上的 **Install Modules**(安装模块)选项卡。找到该模块,然后单击 **Uninstall**(卸载)。然后,一旦可用,单击 **Install**(安装)。
ModuleNotFoundError: No module named 'PIL'
如果您看到此错误
这意味着引发错误的模块未完全安装,很可能是由于超时。
如果是这种情况,您需要重新安装该模块。转到 CodeProject.AI Server 仪表板上的 **Install Modules**(安装模块)选项卡。找到该模块,然后单击 **Uninstall**(卸载)。然后,一旦可用,单击 **Install**(安装)。
PaddlePaddle 安装问题/阻止域名
如果您看到此错误
虽然这并非仅限于 PaddlePaddle、光学字符识别模块或车牌识别器模块,但出现此类错误可能表明存在域名屏蔽。例如,PaddlePaddle 可能来自中国的域名,如果您屏蔽了中国的 IP,这些模块将无法安装。
要解决此问题,请暂时允许您正在限制的 IP,然后重新安装该模块。