# ema-ai-plugin-template **Repository Path**: ematech/ema-ai-plugin-template ## Basic Information - **Project Name**: ema-ai-plugin-template - **Description**: 该仓库为深元边缘计算系统的算法插件模板工程,专用于视频和图像结构化分析场景。它提供了完整的开发框架和容器化打包能力,支持算法以标准插件形式交付部署。 - **Primary Language**: C++ - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-06 - **Last Updated**: 2026-09-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 自定义算法插件模型工程 ## 简介 plugin-template 是一个算法插件模板工程,专门用于视频和图像结构化分析场景。它提供了完整的开发框架和容器化打包能力,支持算法以标准插件形式交付部署。 ## 支持的硬件和操作系统 - 支持的开发平台:x86 - 支持的操作系统:ubuntu18.04,ubuntu20.04 - 支持的部署硬件:EA500I(Ascend310B1) ## 安装开发环境 编译工具链都基于容器镜像方式使用,所以宿主机前提必须要安装 `docker` 工具。 ### 加载编译镜像 通过[网盘](https://pan.baidu.com/s/1bFGIJS-ZSgdfk3qfjsI1Jw?pwd=24d2)下载编译容器镜像,下载完成完成后放在宿主机任一目录,使用如下命令加载即可。 ```shell docker load -i alpine-arm64.tar docker load -i qemu-user-static.tar.tar docker load -i renderjs_server.tar docker load -i ascend310-toolchain.tar ``` 启动` renderjs` 服务器。 ```shell docker run --net=host --restart always --name ai-paas-cloud-plugin -v /home/data/sqlite:/data/sqlite -p 48080:80 -d harbor.ai.corp.ema-tech.com/ai/pass/cloud/plugin:2.0.12 ``` 至此工具链的环境搭建完成。 ## 工程编译 ### 工程编译 ```shell # 全量编译,会清理后全部重编,慢但彻底(适合打包镜像时使用) ./docker_compile.sh -p ascend310-gcc10.3.0-sdk7.0.rc1:latest -e "./build.sh r ascend310b1" # 增加编译,只编译修改过的文件,速度快(适合代码调试时使用) ./docker_compile.sh -p ascend310-gcc10.3.0-sdk7.0.rc1:latest -e "./build.sh ascend310b1" ``` ### 插件镜像打包命令 镜像打包命令 ```shell ./docker_compile.sh -p ascend310-gcc10.3.0-sdk7.0.rc1:latest -b docker -e ./deployment/exec.py --id --stage --encrypt_type --platform ``` - `--id`: 算法 id 前缀 - `--stage`: 软件版本阶段 - `--encrypt_type`: 加密方式 - `--platform`: 平台 `--id`表示算法 `id` 前缀,算法 `id` 定义详情请参考[开发指南](https://gitee.com/ematech/ai-plugin-template/blob/master/docs/%E5%BC%80%E5%8F%91%E6%8C%87%E5%8D%97.md)的 `id` 定义规范。 | 算法插件 | id | | ---------- | -------- | | 打电话检测 | 99000001 | | 口罩检测 | 99000002 | | ... | ... | `--stage` 表示软件阶段,选项如下。 - release - beta - test `--type` 表示加密类别,选项如下,自定义算法插件只支持 docker 。 - docker - nerdctl `--platform` 代表平台代号 | platform | code | | ---------------- | ----------- | | 昇腾 ascend310b1 | ascend310b1 | ### 插件镜像打包例子 ```shell # 打电话检测算法插件镜像打包例子 ./docker_compile.sh -p ascend310-gcc10.3.0-sdk7.0.rc1:latest -b docker -e "./deployment/exec.py --id 99000001 --platform ascend310b1 --stage test --encrypt_type docker" # 口罩检测算法插件镜像打包例子 ./docker_compile.sh -p ascend310-gcc10.3.0-sdk7.0.rc1:latest -b docker -e "./deployment/exec.py --id 99000002 --platform ascend310b1 --stage test --encrypt_type docker" # 行人检测算法插件镜像打包例子 ./docker_compile.sh -p ascend310-gcc10.3.0-sdk7.0.rc1:latest -b docker -e "./deployment/exec.py --id 99000003 --platform ascend310b1 --stage test --encrypt_type docker" # 行人检测算法插件镜像打包例子(v2版本接口) ./docker_compile.sh -p ascend310-gcc10.3.0-sdk7.0.rc1:latest -b docker -e "./deployment/exec.py --id 99000004 --platform ascend310b1 --stage test --encrypt_type docker" # 跌倒检测算法插件镜像打包例子 ./docker_compile.sh -p ascend310-gcc10.3.0-sdk7.0.rc1:latest -b docker -e "./deployment/exec.py --id 99000005 --platform ascend310b1 --stage test --encrypt_type docker" # 打架检测算法插件镜像打包例子 ./docker_compile.sh -p ascend310-gcc10.3.0-sdk7.0.rc1:latest -b docker -e "./deployment/exec.py --id 99000006 --platform ascend310b1 --stage test --encrypt_type docker" ``` 执行如上命令,会在 ` install/package/ascend310b1` 目录下生成 `ai_paas_plugin_99000001-010060_xxx.tar` 名字的算法插件镜像包,这些生成的算法插件镜像包可以去部署升级使用。 ## 开发指南 - 若希望快速熟悉算法插件开发流程,可参阅[快速插件开发指南](./docs/快速插件开发指南.md)。 - 如需了解具体原理、代码细节等,请参考[开发指南](./docs/开发指南.md)。