From 4e3f62e0f59fae7845915bcfe2ea1eb5fc8ca74e Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 11 Oct 2024 07:05:17 +0000 Subject: [PATCH 001/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/BertTextClassification/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/BertTextClassification/README.md | 222 ----------------------- 1 file changed, 222 deletions(-) delete mode 100644 contrib/BertTextClassification/README.md diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md deleted file mode 100644 index 877a73156..000000000 --- a/contrib/BertTextClassification/README.md +++ /dev/null @@ -1,222 +0,0 @@ -# 文本分类 - -## 1. 介绍 - -文本分类插件基于 MindXSDK 开发,在晟腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 -该模型支持5个新闻类别:体育、健康、军事、教育、汽车。 - -### 1.1 支持的产品 - -本项目以昇腾Atlas310卡为主要的硬件平台。 - -### 1.2 支持的版本 - -支持的SDK版本为2.0.4。 -支持的CANN版本为5.0.4。 - -### 1.3 软件方案介绍 - -基于MindX SDK的文本分类业务流程为:待分类文本通过预处理,将文本根据字典vocab.txt进行编码,组成numpy形式的向量,将向量通过 appsrc 插件输入,然后由模型推理插件mxpi_tensorinfer得到每种类别的得分,再通过后处理插件mxpi_classpostprocessor将模型输出的结果处理,最后得到该文本的类别。本系统的各模块及功能描述如表1.1所示: - - -表1.1 系统方案各子系统功能描述: - -| 序号 | 子系统 | 功能描述 | -| ---- | ------ | ------------ | -| 1 | 文本输入 | 读取输入文本 | -| 2 | 文本编码 | 根据字典对输入文本编码 | -| 3 | 模型推理 | 对文本编码后的张量进行推理 | -| 5 | 后处理 | 从模型推理结果中寻找对应的分类标签 | -| 7 | 保存结果 | 将分类结果保存文件| - -### 1.4 代码目录结构与说明 - -本工程名称为文本分类,工程目录如下图所示: - -``` -. -│ build.sh -│ README.md -│ tree.txt -│ -├─mxBase -│ │ build.sh -│ │ CMakeLists.txt -│ │ main.cpp -│ │ -│ ├─BertClassification -│ │ BertClassification.cpp -│ │ BertClassification.h -│ │ -│ ├─data -│ │ vocab.txt -│ │ -│ ├─model -│ │ bert_text_classification_labels.names -│ │ -│ ├─out -│ │ prediction_label.txt -│ │ -│ └─test -│ Test.cpp -│ Test.h -│ -└─sdk - │ build.sh - │ flowChart.png - │ main.py - │ run.sh - │ tokenizer.py - │ - ├─config - │ bert_text_classification_aipp_tf.cfg - │ bert_text_classification_labels.names - │ - ├─data - │ vocab.txt - │ - ├─model - │ bert_text_classification_aipp_tf.cfg - │ bert_text_classification_labels.names - │ model_conversion.sh - │ - ├─out - │ prediction_label.txt - │ - ├─pipeline - │ BertTextClassification.pipeline - │ - └─test - test.py - test.sh - test_input.py -``` -### 1.5 技术实现流程图 - -![image](sdk/flowChart.png) - - -## 2 环境依赖 - -推荐系统为ubuntu 18.04,环境依赖软件和版本如下表: - -| 软件名称 | 版本 | -| -------- | ------ | -| cmake | 3.10.2 | -| mxVision | 2.0.4 | -| python | 3.9.2 | - -确保环境中正确安装mxVision SDK。 - -在编译运行项目前,需要设置环境变量: - -``` -export MX_SDK_HOME=${SDK安装路径}/mxVision -export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/driver/lib64:${LD_LIBRARY_PATH} -export PYTHONPATH=${MX_SDK_HOME}/python:${PYTHONPATH} - -export install_path=/usr/local/Ascend/ascend-toolkit/latest -export PATH=/usr/local/python3.9.2/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH -export LD_LIBRARY_PATH=${install_path}/atc/lib64:$LD_LIBRARY_PATH -export ASCEND_OPP_PATH=${install_path}/opp -``` - -- 环境变量介绍 - -``` -MX_SDK_HOME:MindX SDK mxVision的根安装路径,用于包含MindX SDK提供的所有库和头文件。 -LD_LIBRARY_PATH:提供了MindX SDK已开发的插件和相关的库信息。 -install_path:ascend-toolkit的安装路径。 -PATH:添加python的执行路径和atc转换工具的执行路径。 -LD_LIBRARY_PATH:添加ascend-toolkit和MindX SDK提供的库目录路径。 -ASCEND_OPP_PATH:atc转换工具需要的目录。 -``` - -## 3 模型转换 - -**步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb -下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 - -**步骤2** 执行以下命令使用atc命令进行模型转换: - -cd $HOME/models/bert_text_classification - -atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" - -**步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: - -``` -cp ./bert_text_classification.om $HOME/sdk/model/ -cp ./bert_text_classification.om $HOME/mxBase/model/ -``` - -**步骤4** 执行成功后终端输出为: - -``` -ATC start working now, please wait for a moment. -ATC run success, welcome to the next use. -``` - -## 4 编译与运行 - -**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 - -**步骤2** 按照第 2 小节 环境依赖 中的步骤设置环境变量。 - -**步骤3** 按照第 3 小节 模型转换 中的步骤获得 om 模型文件。 - -**步骤4** 将本项目代码的文件路径中出现的 ${SDK目录} 替换成自己SDK的存放目录,下面是需要替换的代码。 - -``` -mxBase目录下的CMakeList.txt中的第13行代码: -set(MX_SDK_HOME ${SDK目录}) - -sdk/pipeline目录下BertTextClassification.pipeline文件中的第26行: -"postProcessLibPath": "${SDK目录}/lib/modelpostprocessors/libresnet50postprocess.so" -``` - -**步骤5** pipeline项目运行在sdk目录下执行命令: - -``` -python3 main.py -``` - -命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 - -**步骤6** mxBase项目在mxBase目录中,执行以下代码进行编译。 - -``` -mkdir build -cd build -cmake .. -make -``` - -编译完成后,将可执行文件 mxBase_text_classification 移动到mxBase目录下,执行下面代码运行 - -``` -./mxBase_text_classification ./data/sample.txt -``` - -执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 - -## 5 精度测试 - -**步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 - -**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件分别放在sdk/data目录和mxBase/data目录。 - -**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 - -``` -python3 test.py -``` - -**步骤4** mxBase项目中,将mxBase目录下main.cpp中main方法的全部代码注释,替换为下面代码后执行(即main函数中仅包含以下代码),得到mxBase的精度测试结果。 - -``` -Test::test_accuracy(); -``` - -## 6 其他问题 -1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From 5eb59c934835cf448ab3a8aed13fd1ea37f1fe4d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 11 Oct 2024 07:05:49 +0000 Subject: [PATCH 002/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 223 +++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 contrib/BertTextClassification/README.md diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md new file mode 100644 index 000000000..13562df60 --- /dev/null +++ b/contrib/BertTextClassification/README.md @@ -0,0 +1,223 @@ +# 文本分类 + +## 1. 介绍 + +### 1.1 简介 +文本分类插件基于 MindXSDK 开发,在晟腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 +该模型支持5个新闻类别:体育、健康、军事、教育、汽车。 + +### 1.2 支持的产品 + +本项目以昇腾Atlas310卡为主要的硬件平台。 + +### 1.3 支持的版本 + +推荐系统为ubuntu 18.04。 + +表1.1 环境依赖软件和版本: + +| 软件名称 | 版本 | +| -------- | ------ | +| cmake | 3.10.2 | +| mxVision | 2.0.4 | +| python | 3.9.2 | +| CANN | 5.0.4 | + +### 1.4 软件方案介绍 + +基于MindX SDK的文本分类业务流程为:待分类文本通过预处理,将文本根据字典vocab.txt进行编码,组成numpy形式的向量,将向量通过 appsrc 插件输入,然后由模型推理插件mxpi_tensorinfer得到每种类别的得分,再通过后处理插件mxpi_classpostprocessor将模型输出的结果处理,最后得到该文本的类别。本系统的各模块及功能描述如表1.2所示: + + +表1.2 系统方案各子系统功能描述: + +| 序号 | 子系统 | 功能描述 | +| ---- | ------ | ------------ | +| 1 | 文本输入 | 读取输入文本 | +| 2 | 文本编码 | 根据字典对输入文本编码 | +| 3 | 模型推理 | 对文本编码后的张量进行推理 | +| 4 | 后处理 | 从模型推理结果中寻找对应的分类标签 | +| 5 | 保存结果 | 将分类结果保存文件| + +### 1.5 代码目录结构与说明 + +本工程名称为文本分类,工程目录如下图所示: + +``` +. +│ build.sh +│ README.md +│ tree.txt +│ +├─mxBase +│ │ build.sh +│ │ CMakeLists.txt +│ │ main.cpp +│ │ +│ ├─BertClassification +│ │ BertClassification.cpp +│ │ BertClassification.h +│ │ +│ ├─data +│ │ vocab.txt +│ │ +│ ├─model +│ │ bert_text_classification_labels.names +│ │ +│ ├─out +│ │ prediction_label.txt +│ │ +│ └─test +│ Test.cpp +│ Test.h +│ +└─sdk + │ build.sh + │ flowChart.png + │ main.py + │ run.sh + │ tokenizer.py + │ + ├─config + │ bert_text_classification_aipp_tf.cfg + │ bert_text_classification_labels.names + │ + ├─data + │ vocab.txt + │ + ├─model + │ bert_text_classification_aipp_tf.cfg + │ bert_text_classification_labels.names + │ model_conversion.sh + │ + ├─out + │ prediction_label.txt + │ + ├─pipeline + │ BertTextClassification.pipeline + │ + └─test + test.py + test.sh + test_input.py +``` +### 1.5 技术实现流程图 + +![image](sdk/flowChart.png) + + +## 2 设置环境变量 + +确保环境中正确安装mxVision SDK。 + +在编译运行项目前,需要设置环境变量: + +``` +export MX_SDK_HOME=${SDK安装路径}/mxVision +export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/driver/lib64:${LD_LIBRARY_PATH} +export PYTHONPATH=${MX_SDK_HOME}/python:${PYTHONPATH} + +export install_path=/usr/local/Ascend/ascend-toolkit/latest +export PATH=/usr/local/python3.9.2/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH +export LD_LIBRARY_PATH=${install_path}/atc/lib64:$LD_LIBRARY_PATH +export ASCEND_OPP_PATH=${install_path}/opp +``` + +- 环境变量介绍 + +``` +MX_SDK_HOME:MindX SDK mxVision的根安装路径,用于包含MindX SDK提供的所有库和头文件。 +LD_LIBRARY_PATH:提供了MindX SDK已开发的插件和相关的库信息。 +install_path:ascend-toolkit的安装路径。 +PATH:添加python的执行路径和atc转换工具的执行路径。 +LD_LIBRARY_PATH:添加ascend-toolkit和MindX SDK提供的库目录路径。 +ASCEND_OPP_PATH:atc转换工具需要的目录。 +``` + +## 3 准备模型 + +**步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb +下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 + +**步骤2** 执行以下命令使用atc命令进行模型转换: + +cd $HOME/models/bert_text_classification + +atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" + +**步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: + +``` +cp ./bert_text_classification.om $HOME/sdk/model/ +cp ./bert_text_classification.om $HOME/mxBase/model/ +``` + +**步骤4** 执行成功后终端输出为: + +``` +ATC start working now, please wait for a moment. +ATC run success, welcome to the next use. +``` + +## 4 编译与运行 + +**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 + +**步骤2** 按照第 2 小节 环境依赖 中的步骤设置环境变量。 + +**步骤3** 按照第 3 小节 模型转换 中的步骤获得 om 模型文件。 + +**步骤4** 将本项目代码的文件路径中出现的 ${SDK目录} 替换成自己SDK的存放目录,下面是需要替换的代码。 + +``` +mxBase目录下的CMakeList.txt中的第13行代码: +set(MX_SDK_HOME ${SDK目录}) + +sdk/pipeline目录下BertTextClassification.pipeline文件中的第26行: +"postProcessLibPath": "${SDK目录}/lib/modelpostprocessors/libresnet50postprocess.so" +``` + +**步骤5** pipeline项目运行在sdk目录下执行命令: + +``` +python3 main.py +``` + +命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 + +**步骤6** mxBase项目在mxBase目录中,执行以下代码进行编译。 + +``` +mkdir build +cd build +cmake .. +make +``` + +编译完成后,将可执行文件 mxBase_text_classification 移动到mxBase目录下,执行下面代码运行 + +``` +./mxBase_text_classification ./data/sample.txt +``` + +执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 + +## 5 精度测试 + +**步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 + +**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件分别放在sdk/data目录和mxBase/data目录。 + +**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 + +``` +python3 test.py +``` + +**步骤4** mxBase项目中,将mxBase目录下main.cpp中main方法的全部代码注释,替换为下面代码(即main函数中仅包含以下代码),然后重新编译并运行,得到mxBase的精度测试结果。 + +``` +Test::test_accuracy(); +``` + +## 6 其他问题 +1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From aa170cfafb240d55d5f71ae01ba00fd9275089b3 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 11 Oct 2024 07:09:15 +0000 Subject: [PATCH 003/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/BertTextClassification/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/BertTextClassification/README.md | 223 ----------------------- 1 file changed, 223 deletions(-) delete mode 100644 contrib/BertTextClassification/README.md diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md deleted file mode 100644 index 13562df60..000000000 --- a/contrib/BertTextClassification/README.md +++ /dev/null @@ -1,223 +0,0 @@ -# 文本分类 - -## 1. 介绍 - -### 1.1 简介 -文本分类插件基于 MindXSDK 开发,在晟腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 -该模型支持5个新闻类别:体育、健康、军事、教育、汽车。 - -### 1.2 支持的产品 - -本项目以昇腾Atlas310卡为主要的硬件平台。 - -### 1.3 支持的版本 - -推荐系统为ubuntu 18.04。 - -表1.1 环境依赖软件和版本: - -| 软件名称 | 版本 | -| -------- | ------ | -| cmake | 3.10.2 | -| mxVision | 2.0.4 | -| python | 3.9.2 | -| CANN | 5.0.4 | - -### 1.4 软件方案介绍 - -基于MindX SDK的文本分类业务流程为:待分类文本通过预处理,将文本根据字典vocab.txt进行编码,组成numpy形式的向量,将向量通过 appsrc 插件输入,然后由模型推理插件mxpi_tensorinfer得到每种类别的得分,再通过后处理插件mxpi_classpostprocessor将模型输出的结果处理,最后得到该文本的类别。本系统的各模块及功能描述如表1.2所示: - - -表1.2 系统方案各子系统功能描述: - -| 序号 | 子系统 | 功能描述 | -| ---- | ------ | ------------ | -| 1 | 文本输入 | 读取输入文本 | -| 2 | 文本编码 | 根据字典对输入文本编码 | -| 3 | 模型推理 | 对文本编码后的张量进行推理 | -| 4 | 后处理 | 从模型推理结果中寻找对应的分类标签 | -| 5 | 保存结果 | 将分类结果保存文件| - -### 1.5 代码目录结构与说明 - -本工程名称为文本分类,工程目录如下图所示: - -``` -. -│ build.sh -│ README.md -│ tree.txt -│ -├─mxBase -│ │ build.sh -│ │ CMakeLists.txt -│ │ main.cpp -│ │ -│ ├─BertClassification -│ │ BertClassification.cpp -│ │ BertClassification.h -│ │ -│ ├─data -│ │ vocab.txt -│ │ -│ ├─model -│ │ bert_text_classification_labels.names -│ │ -│ ├─out -│ │ prediction_label.txt -│ │ -│ └─test -│ Test.cpp -│ Test.h -│ -└─sdk - │ build.sh - │ flowChart.png - │ main.py - │ run.sh - │ tokenizer.py - │ - ├─config - │ bert_text_classification_aipp_tf.cfg - │ bert_text_classification_labels.names - │ - ├─data - │ vocab.txt - │ - ├─model - │ bert_text_classification_aipp_tf.cfg - │ bert_text_classification_labels.names - │ model_conversion.sh - │ - ├─out - │ prediction_label.txt - │ - ├─pipeline - │ BertTextClassification.pipeline - │ - └─test - test.py - test.sh - test_input.py -``` -### 1.5 技术实现流程图 - -![image](sdk/flowChart.png) - - -## 2 设置环境变量 - -确保环境中正确安装mxVision SDK。 - -在编译运行项目前,需要设置环境变量: - -``` -export MX_SDK_HOME=${SDK安装路径}/mxVision -export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/driver/lib64:${LD_LIBRARY_PATH} -export PYTHONPATH=${MX_SDK_HOME}/python:${PYTHONPATH} - -export install_path=/usr/local/Ascend/ascend-toolkit/latest -export PATH=/usr/local/python3.9.2/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH -export LD_LIBRARY_PATH=${install_path}/atc/lib64:$LD_LIBRARY_PATH -export ASCEND_OPP_PATH=${install_path}/opp -``` - -- 环境变量介绍 - -``` -MX_SDK_HOME:MindX SDK mxVision的根安装路径,用于包含MindX SDK提供的所有库和头文件。 -LD_LIBRARY_PATH:提供了MindX SDK已开发的插件和相关的库信息。 -install_path:ascend-toolkit的安装路径。 -PATH:添加python的执行路径和atc转换工具的执行路径。 -LD_LIBRARY_PATH:添加ascend-toolkit和MindX SDK提供的库目录路径。 -ASCEND_OPP_PATH:atc转换工具需要的目录。 -``` - -## 3 准备模型 - -**步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb -下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 - -**步骤2** 执行以下命令使用atc命令进行模型转换: - -cd $HOME/models/bert_text_classification - -atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" - -**步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: - -``` -cp ./bert_text_classification.om $HOME/sdk/model/ -cp ./bert_text_classification.om $HOME/mxBase/model/ -``` - -**步骤4** 执行成功后终端输出为: - -``` -ATC start working now, please wait for a moment. -ATC run success, welcome to the next use. -``` - -## 4 编译与运行 - -**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 - -**步骤2** 按照第 2 小节 环境依赖 中的步骤设置环境变量。 - -**步骤3** 按照第 3 小节 模型转换 中的步骤获得 om 模型文件。 - -**步骤4** 将本项目代码的文件路径中出现的 ${SDK目录} 替换成自己SDK的存放目录,下面是需要替换的代码。 - -``` -mxBase目录下的CMakeList.txt中的第13行代码: -set(MX_SDK_HOME ${SDK目录}) - -sdk/pipeline目录下BertTextClassification.pipeline文件中的第26行: -"postProcessLibPath": "${SDK目录}/lib/modelpostprocessors/libresnet50postprocess.so" -``` - -**步骤5** pipeline项目运行在sdk目录下执行命令: - -``` -python3 main.py -``` - -命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 - -**步骤6** mxBase项目在mxBase目录中,执行以下代码进行编译。 - -``` -mkdir build -cd build -cmake .. -make -``` - -编译完成后,将可执行文件 mxBase_text_classification 移动到mxBase目录下,执行下面代码运行 - -``` -./mxBase_text_classification ./data/sample.txt -``` - -执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 - -## 5 精度测试 - -**步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 - -**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件分别放在sdk/data目录和mxBase/data目录。 - -**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 - -``` -python3 test.py -``` - -**步骤4** mxBase项目中,将mxBase目录下main.cpp中main方法的全部代码注释,替换为下面代码(即main函数中仅包含以下代码),然后重新编译并运行,得到mxBase的精度测试结果。 - -``` -Test::test_accuracy(); -``` - -## 6 其他问题 -1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From 30494a121a5eefa1b7b0d5a1489fb69643b204a0 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 11 Oct 2024 07:10:13 +0000 Subject: [PATCH 004/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 223 +++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 contrib/BertTextClassification/README.md diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md new file mode 100644 index 000000000..119c12544 --- /dev/null +++ b/contrib/BertTextClassification/README.md @@ -0,0 +1,223 @@ +# 文本分类 + +## 1. 介绍 + +### 1.1 简介 +文本分类插件基于 MindXSDK 开发,在晟腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 +该模型支持5个新闻类别:体育、健康、军事、教育、汽车。 + +### 1.2 支持的产品 + +本项目以昇腾Atlas310卡为主要的硬件平台。 + +### 1.3 支持的版本 + +推荐系统为ubuntu 18.04。 + +表1.1 环境依赖软件和版本: + +| 软件名称 | 版本 | +| -------- | ------ | +| cmake | 3.10.2 | +| mxVision | 2.0.4 | +| python | 3.9.2 | +| CANN | 5.0.4 | + +### 1.4 软件方案介绍 + +基于MindX SDK的文本分类业务流程为:待分类文本通过预处理,将文本根据字典vocab.txt进行编码,组成numpy形式的向量,将向量通过 appsrc 插件输入,然后由模型推理插件mxpi_tensorinfer得到每种类别的得分,再通过后处理插件mxpi_classpostprocessor将模型输出的结果处理,最后得到该文本的类别。本系统的各模块及功能描述如表1.2所示: + + +表1.2 系统方案各子系统功能描述: + +| 序号 | 子系统 | 功能描述 | +| ---- | ------ | ------------ | +| 1 | 文本输入 | 读取输入文本 | +| 2 | 文本编码 | 根据字典对输入文本编码 | +| 3 | 模型推理 | 对文本编码后的张量进行推理 | +| 4 | 后处理 | 从模型推理结果中寻找对应的分类标签 | +| 5 | 保存结果 | 将分类结果保存文件| + +### 1.5 代码目录结构与说明 + +本工程名称为文本分类,工程目录如下图所示: + +``` +. +│ build.sh +│ README.md +│ tree.txt +│ +├─mxBase +│ │ build.sh +│ │ CMakeLists.txt +│ │ main.cpp +│ │ +│ ├─BertClassification +│ │ BertClassification.cpp +│ │ BertClassification.h +│ │ +│ ├─data +│ │ vocab.txt +│ │ +│ ├─model +│ │ bert_text_classification_labels.names +│ │ +│ ├─out +│ │ prediction_label.txt +│ │ +│ └─test +│ Test.cpp +│ Test.h +│ +└─sdk + │ build.sh + │ flowChart.png + │ main.py + │ run.sh + │ tokenizer.py + │ + ├─config + │ bert_text_classification_aipp_tf.cfg + │ bert_text_classification_labels.names + │ + ├─data + │ vocab.txt + │ + ├─model + │ bert_text_classification_aipp_tf.cfg + │ bert_text_classification_labels.names + │ model_conversion.sh + │ + ├─out + │ prediction_label.txt + │ + ├─pipeline + │ BertTextClassification.pipeline + │ + └─test + test.py + test.sh + test_input.py +``` +### 1.6 技术实现流程图 + +![image](sdk/flowChart.png) + + +## 2 设置环境变量 + +确保环境中正确安装mxVision SDK。 + +在编译运行项目前,需要设置环境变量: + +``` +export MX_SDK_HOME=${SDK安装路径}/mxVision +export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/driver/lib64:${LD_LIBRARY_PATH} +export PYTHONPATH=${MX_SDK_HOME}/python:${PYTHONPATH} + +export install_path=/usr/local/Ascend/ascend-toolkit/latest +export PATH=/usr/local/python3.9.2/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH +export LD_LIBRARY_PATH=${install_path}/atc/lib64:$LD_LIBRARY_PATH +export ASCEND_OPP_PATH=${install_path}/opp +``` + +- 环境变量介绍 + +``` +MX_SDK_HOME:MindX SDK mxVision的根安装路径,用于包含MindX SDK提供的所有库和头文件。 +LD_LIBRARY_PATH:提供了MindX SDK已开发的插件和相关的库信息。 +install_path:ascend-toolkit的安装路径。 +PATH:添加python的执行路径和atc转换工具的执行路径。 +LD_LIBRARY_PATH:添加ascend-toolkit和MindX SDK提供的库目录路径。 +ASCEND_OPP_PATH:atc转换工具需要的目录。 +``` + +## 3 准备模型 + +**步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb +下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 + +**步骤2** 执行以下命令使用atc命令进行模型转换: + +cd $HOME/models/bert_text_classification + +atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" + +**步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: + +``` +cp ./bert_text_classification.om $HOME/sdk/model/ +cp ./bert_text_classification.om $HOME/mxBase/model/ +``` + +**步骤4** 执行成功后终端输出为: + +``` +ATC start working now, please wait for a moment. +ATC run success, welcome to the next use. +``` + +## 4 编译与运行 + +**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 + +**步骤2** 按照第 2 小节 环境依赖 中的步骤设置环境变量。 + +**步骤3** 按照第 3 小节 模型转换 中的步骤获得 om 模型文件。 + +**步骤4** 将本项目代码的文件路径中出现的 ${SDK目录} 替换成自己SDK的存放目录,下面是需要替换的代码。 + +``` +mxBase目录下的CMakeList.txt中的第13行代码: +set(MX_SDK_HOME ${SDK目录}) + +sdk/pipeline目录下BertTextClassification.pipeline文件中的第26行: +"postProcessLibPath": "${SDK目录}/lib/modelpostprocessors/libresnet50postprocess.so" +``` + +**步骤5** pipeline项目运行在sdk目录下执行命令: + +``` +python3 main.py +``` + +命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 + +**步骤6** mxBase项目在mxBase目录中,执行以下代码进行编译。 + +``` +mkdir build +cd build +cmake .. +make +``` + +编译完成后,将可执行文件 mxBase_text_classification 移动到mxBase目录下,执行下面代码运行 + +``` +./mxBase_text_classification ./data/sample.txt +``` + +执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 + +## 5 精度测试 + +**步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 + +**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件分别放在sdk/data目录和mxBase/data目录。 + +**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 + +``` +python3 test.py +``` + +**步骤4** mxBase项目中,将mxBase目录下main.cpp中main方法的全部代码注释,替换为下面代码(即main函数中仅包含以下代码),参考第4小节 编译与运行 中的步骤4重新编译并运行,得到mxBase的精度测试结果。 + +``` +Test::test_accuracy(); +``` + +## 6 常见问题 +1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From 4d96525ce6ff01f84c12788298128d46a0233f43 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:13:23 +0000 Subject: [PATCH 005/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/EdgeDetectionPicture/CMakeLists.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/CMakeLists.txt | 37 --------------------- 1 file changed, 37 deletions(-) delete mode 100644 contrib/EdgeDetectionPicture/CMakeLists.txt diff --git a/contrib/EdgeDetectionPicture/CMakeLists.txt b/contrib/EdgeDetectionPicture/CMakeLists.txt deleted file mode 100644 index 3928c17d7..000000000 --- a/contrib/EdgeDetectionPicture/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(edge_detection_picture) - -include_directories(./rcfPostProcess) -include_directories(./rcfDetection) -file(GLOB_RECURSE RCF_POSTPROCESS ${PROJECT_SOURCE_DIR}/rcfPostProcess/*cpp) -file(GLOB_RECURSE RCF_DETECTION ${PROJECT_SOURCE_DIR}/rcfDetection/*cpp) -set(TARGET edge_detection_picture) -add_compile_options(-std=c++11 -fPIE -fstack-protector-all -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -s -pie -Wall) -add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=mindxsdk_private) - -set(MX_SDK_HOME "$ENV{MX_SDK_HOME}") - -include_directories( - ${MX_SDK_HOME}/include - ${MX_SDK_HOME}/opensource/include - ${MX_SDK_HOME}/opensource/include/opencv4 -) - -link_directories( - ${MX_SDK_HOME}/lib - ${MX_SDK_HOME}/opensource/lib - ${MX_SDK_HOME}/lib/modelpostprocessors - ${MX_SDK_HOME}/include/MxBase/postprocess/include - /usr/local/Ascend/ascend-toolkit/latest/acllib/lib64 - /usr/local/Ascend/driver/lib64/ -) - -add_executable(edge_detection_picture main.cpp ${RCF_DETECTION} ${RCF_POSTPROCESS}) -target_link_libraries(edge_detection_picture - glog - mxbase - opencv_world - boost_system - boost_filesystem - ) -install(TARGETS ${TARGET} RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/) -- Gitee From 061a83867b246235cdfa347191776a192943782a Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:13:50 +0000 Subject: [PATCH 006/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0CMake=E4=BD=BF?= =?UTF-8?q?=E5=85=B6=E9=80=82=E9=85=8D=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/CMakeLists.txt | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 contrib/EdgeDetectionPicture/CMakeLists.txt diff --git a/contrib/EdgeDetectionPicture/CMakeLists.txt b/contrib/EdgeDetectionPicture/CMakeLists.txt new file mode 100644 index 000000000..c038f4269 --- /dev/null +++ b/contrib/EdgeDetectionPicture/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.10) +project(edge_detection_picture) + +include_directories(./rcfPostProcess) +include_directories(./rcfDetection) +file(GLOB_RECURSE RCF_POSTPROCESS ${PROJECT_SOURCE_DIR}/rcfPostProcess/*cpp) +file(GLOB_RECURSE RCF_DETECTION ${PROJECT_SOURCE_DIR}/rcfDetection/*cpp) +set(TARGET edge_detection_picture) +add_compile_options(-std=c++11 -fPIE -fstack-protector-all -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -s -pie -Wall) +add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=mindxsdk_private) + +set(MX_SDK_HOME /root/SDK/mxVision) + +set(cpprest_DIR ${MX_SDK_HOME}/opensource/lib/libcpprest.so) +if(EXISTS ${cpprest_DIR}) + target_link_libraries(edge_detection_picture cpprest) + add_definitions(_DMX_VERSION_5) +endif() + +include_directories( + ${MX_SDK_HOME}/include + ${MX_SDK_HOME}/opensource/include + ${MX_SDK_HOME}/opensource/include/opencv4 +) + +link_directories( + ${MX_SDK_HOME}/lib + ${MX_SDK_HOME}/opensource/lib + ${MX_SDK_HOME}/lib/modelpostprocessors + ${MX_SDK_HOME}/include/MxBase/postprocess/include + /usr/local/Ascend/ascend-toolkit/latest/acllib/lib64 + /usr/local/Ascend/driver/lib64/ +) + +add_executable(edge_detection_picture main.cpp ${RCF_DETECTION} ${RCF_POSTPROCESS}) +target_link_libraries(edge_detection_picture + glog + mxbase + opencv_world + boost_system + boost_filesystem + ) +install(TARGETS ${TARGET} RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/) -- Gitee From fb9df239a505356210a7f2c62c34abb014b5757e Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:14:00 +0000 Subject: [PATCH 007/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/EdgeDetectionPicture/rcfDetection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rcfDetection/RcfDetection.cpp | 281 ------------------ .../rcfDetection/RcfDetection.h | 61 ---- 2 files changed, 342 deletions(-) delete mode 100644 contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.cpp delete mode 100644 contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.h diff --git a/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.cpp b/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.cpp deleted file mode 100644 index a8a84460c..000000000 --- a/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/** - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "RcfDetection.h" -#include "MxBase/DeviceManager/DeviceManager.h" -#include "MxBase/Log/Log.h" -#include "../rcfPostProcess/RcfPostProcess.h" -#include -#include -#include "opencv2/opencv.hpp" - -namespace { - const uint32_t YUV_BYTE_NU = 3; - const uint32_t YUV_BYTE_DE = 2; - const uint32_t VPC_H_ALIGN = 2; - const uint32_t channel = 3; - const double ALPHA = 255.0 / 255; -} -void RcfDetection::SetRcfPostProcessConfig(const InitParam &initParam, - std::map &config) -{ - MxBase::ConfigData configData; - const std::string checkTensor = initParam.checkTensor ? "true" : "false"; - configData.SetJsonValue("OUTSIZE_NUM", std::to_string(initParam.outSizeNum)); - configData.SetJsonValue("OUTSIZE", initParam.outSize); - configData.SetJsonValue("RCF_TYPE", std::to_string(initParam.rcfType)); - configData.SetJsonValue("MODEL_TYPE", std::to_string(initParam.modelType)); - configData.SetJsonValue("INPUT_TYPE", std::to_string(initParam.inputType)); - configData.SetJsonValue("CHECK_MODEL", checkTensor); - auto jsonStr = configData.GetCfgJson().serialize(); - config["postProcessConfigContent"] = jsonStr; -} - -APP_ERROR RcfDetection::Init(const InitParam &initParam) -{ - deviceId_ = initParam.deviceId; - APP_ERROR ret = MxBase::DeviceManager::GetInstance()->InitDevices(); - if (ret != APP_ERR_OK) { - LogError << "Init devices failed, ret=" << ret << "."; - return ret; - } - ret = MxBase::TensorContext::GetInstance()->SetContext(initParam.deviceId); - if (ret != APP_ERR_OK) { - LogError << "Set context failed, ret=" << ret << "."; - return ret; - } - dvppWrapper_ = std::make_shared(); - ret = dvppWrapper_->Init(); - if (ret != APP_ERR_OK) { - LogError << "DvppWrapper init failed, ret=" << ret << "."; - return ret; - } - model_ = std::make_shared(); - ret = model_->Init(initParam.modelPath, modelDesc_); - if (ret != APP_ERR_OK) { - LogError << "ModelInferenceProcessor init failed, ret=" << ret << "."; - return ret; - } - - std::map config; - SetRcfPostProcessConfig(initParam, config); - post_ = std::make_shared(); - ret = post_->Init(config); - if (ret != APP_ERR_OK) { - LogError << "RcfPostProcess init failed, ret=" << ret << "."; - return ret; - } - if (ret != APP_ERR_OK) { - LogError << "Failed to load labels, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::DeInit() -{ - dvppWrapper_->DeInit(); - model_->DeInit(); - post_->DeInit(); - MxBase::DeviceManager::GetInstance()->DestroyDevices(); - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::ReadImage(const std::string &imgPath, - MxBase::TensorBase &tensor) -{ - MxBase::DvppDataInfo output = {}; - APP_ERROR ret = dvppWrapper_->DvppJpegDecode(imgPath, output); - if (ret != APP_ERR_OK) { - LogError << "DvppWrapper DvppJpegDecode failed, ret=" << ret << "."; - return ret; - } - MxBase::MemoryData memoryData((void*)output.data, output.dataSize, - MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - if (output.heightStride % VPC_H_ALIGN != 0) { - LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; - MxBase::MemoryHelper::MxbsFree(memoryData); - return APP_ERR_COMM_INVALID_PARAM; - } - dvppHeightStride = output.heightStride; - dvppWidthStride = output.widthStride; - std::vector shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; - tensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); - return APP_ERR_OK; -} -APP_ERROR RcfDetection::Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor, - uint32_t resizeHeight, uint32_t resizeWidth) -{ - auto shape = inputTensor.GetShape(); - MxBase::DvppDataInfo input = {}; - input.height = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; - input.width = shape[1]; - input.heightStride = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; - input.widthStride = shape[1]; - input.dataSize = inputTensor.GetByteSize(); - input.data = (uint8_t*)inputTensor.GetBuffer(); - MxBase::ResizeConfig resize = {}; - resize.height = resizeHeight; - resize.width = resizeWidth; - MxBase::DvppDataInfo output = {}; - APP_ERROR ret = dvppWrapper_->VpcResize(input, output, resize); - if (ret != APP_ERR_OK) { - LogError << "VpcResize failed, ret=" << ret << "."; - return ret; - } - MxBase::MemoryData memoryData((void*)output.data, output.dataSize, - MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - if (output.heightStride % VPC_H_ALIGN != 0) { - LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; - MxBase::MemoryHelper::MxbsFree(memoryData); - return APP_ERR_COMM_INVALID_PARAM; - } - shape = {1, channel, output.heightStride, output.widthStride}; - outputTensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::Inference(const std::vector &inputs, - std::vector &outputs) -{ - std::vector output={}; - auto dtypes = model_->GetOutputDataType(); - for (size_t i = 0; i < modelDesc_.outputTensors.size(); ++i) { - std::vector shape = {}; - for (size_t j = 0; j < modelDesc_.outputTensors[i].tensorDims.size(); ++j) { - shape.push_back((uint32_t)modelDesc_.outputTensors[i].tensorDims[j]); - } - MxBase::TensorBase tensor(shape, dtypes[i], MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - APP_ERROR ret = MxBase::TensorBase::TensorBaseMalloc(tensor); - if (ret != APP_ERR_OK) { - LogError << "TensorBaseMalloc failed, ret=" << ret << "."; - return ret; - } - outputs.push_back(tensor); - } - MxBase::DynamicInfo dynamicInfo = {}; - dynamicInfo.dynamicType = MxBase::DynamicType::STATIC_BATCH; - auto startTime = std::chrono::high_resolution_clock::now(); - APP_ERROR ret = model_->ModelInference(inputs, outputs, dynamicInfo); - auto endTime = std::chrono::high_resolution_clock::now(); - double costMs = std::chrono::duration(endTime - startTime).count(); - LogInfo<< "costMs:"<< costMs; - if (ret != APP_ERR_OK) { - LogError << "ModelInference failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::PostProcess(const MxBase::TensorBase &tensor, - const std::vector &outputs, - std::vector &postProcessOutput) -{ - auto shape = tensor.GetShape(); - MxBase::ResizedImageInfo imgInfo; - imgInfo.widthOriginal = shape[1]; - imgInfo.heightOriginal = shape[0] * YUV_BYTE_DE; - uint32_t widthResize = 512; - uint32_t heightResize = 512; - imgInfo.widthResize = widthResize; - imgInfo.heightResize = heightResize; - imgInfo.resizeType = MxBase::RESIZER_STRETCHING; - std::vector imageInfoVec = {}; - imageInfoVec.push_back(imgInfo); - APP_ERROR ret = post_->Process(outputs, postProcessOutput); - if (ret != APP_ERR_OK) { - LogError << "Process failed, ret=" << ret << "."; - return ret; - } - ret = post_->DeInit(); - if (ret != APP_ERR_OK) { - LogError << "RcfDetection DeInit failed"; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::WriteResult(MxBase::TensorBase &inferTensor, const std::string &imgPath) -{ - auto shape = inferTensor.GetShape(); - int dim2 = 2; - int dim3 = 3; - uint32_t height = shape[dim2]; - uint32_t width = shape[dim3]; - cv::Mat imgBgr = cv::imread(imgPath); - std::string fileName = imgPath.substr(imgPath.find_last_of("/") + 1); - uint32_t imageWidth = imgBgr.cols; - uint32_t imageHeight = imgBgr.rows; - cv::Mat modelOutput = cv::Mat(height, width, CV_32FC1, inferTensor.GetBuffer()); - cv::Mat grayMat; - cv::Mat resizedMat; - int crop = 5; - cv::Rect myROI(0, 0, imageWidth - crop, imageHeight); - resize(modelOutput, resizedMat, cv::Size(dvppWidthStride, dvppHeightStride), 0, 0, cv::INTER_LINEAR); - resizedMat.convertTo(grayMat, CV_8UC1, ALPHA); - cv::Mat croppedImage = grayMat(myROI); - resize(croppedImage, croppedImage, cv::Size(imageWidth, imageHeight), 0, 0, cv::INTER_LINEAR); - - std::string resultPathName = "result"; - if (access(resultPathName.c_str(), 0) != 0) { - int ret = mkdir(resultPathName.c_str(), S_IRUSR | S_IWUSR | S_IXUSR); - if (ret != 0) { - LogError << "Failed to create result directory: " << resultPathName << ", ret = " << ret; - return APP_ERR_COMM_FAILURE; - } - } - - cv::imwrite("./result/"+fileName, croppedImage); - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::Process(const std::string &imgPath) -{ - MxBase::TensorBase inTensor; - APP_ERROR ret = ReadImage(imgPath, inTensor); - if (ret != APP_ERR_OK) { - LogError << "ReadImage failed, ret=" << ret << "."; - return ret; - } - MxBase::TensorBase outTensor; - uint32_t resizeHeight = 512; - uint32_t resizeWidth = 512; - ret = Resize(inTensor, outTensor, resizeHeight, resizeWidth); - if (ret != APP_ERR_OK) { - LogError << "Resize failed, ret=" << ret << "."; - return ret; - } - std::vector inputs = {}; - std::vector outputs = {}; - auto shape = outTensor.GetShape(); - inputs.push_back(outTensor); - ret = Inference(inputs, outputs); - if (ret != APP_ERR_OK) { - LogError << "Inference failed, ret=" << ret << "."; - return ret; - } - std::vector postProcessOutput={}; - ret = PostProcess(inTensor, outputs, postProcessOutput); - if (ret != APP_ERR_OK) { - LogError << "PostProcess failed, ret=" << ret << "."; - return ret; - } - ret = WriteResult(postProcessOutput[0], imgPath); - if (ret != APP_ERR_OK) { - LogError << "Save result failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} diff --git a/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.h b/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.h deleted file mode 100644 index 7c0ae6da4..000000000 --- a/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MXBASE_RCFDETECTION_H -#define MXBASE_RCFDETECTION_H - -#include -#include -#include "MxBase/DvppWrapper/DvppWrapper.h" -#include "MxBase/ModelInfer/ModelInferenceProcessor.h" -#include "MxBase/Tensor/TensorContext/TensorContext.h" - -struct InitParam { - uint32_t deviceId = 0; - bool checkTensor = true; - std::string modelPath = ""; - uint32_t outSizeNum = 0; - std::string outSize = ""; - uint32_t rcfType = 0; - uint32_t modelType = 0; - uint32_t inputType = 0; -}; - -class RcfDetection { -public: - APP_ERROR Init(const InitParam &initParam); - APP_ERROR DeInit(); - APP_ERROR Inference(const std::vector &inputs, std::vector &outputs); - APP_ERROR PostProcess(const MxBase::TensorBase &tensor, const std::vector &outputs, - std::vector &postProcessOutput); - APP_ERROR Process(const std::string &imgPath); -protected: - APP_ERROR ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor); - APP_ERROR Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor, - uint32_t resizeHeight, uint32_t resizeWidth); - APP_ERROR WriteResult(MxBase::TensorBase &inferTensor, const std::string &imgPath); - void SetRcfPostProcessConfig(const InitParam &initParam, std::map &config); - -private: - std::shared_ptr dvppWrapper_; - std::shared_ptr model_; - std::shared_ptr post_; - MxBase::ModelDesc modelDesc_ = {}; - uint32_t deviceId_ = 0; - int dvppHeightStride = 0; - int dvppWidthStride = 0; -}; -#endif -- Gitee From 5a5c1e129e621eb7dd649e47bf5a9a9004c00f3c Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:14:14 +0000 Subject: [PATCH 008/129] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20rcfDetection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/rcfDetection/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 contrib/EdgeDetectionPicture/rcfDetection/.keep diff --git a/contrib/EdgeDetectionPicture/rcfDetection/.keep b/contrib/EdgeDetectionPicture/rcfDetection/.keep new file mode 100644 index 000000000..e69de29bb -- Gitee From 9eaf6d186dd3a44d9db2e9cac335c85439f1a6b2 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:15:03 +0000 Subject: [PATCH 009/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0RcfDetection=E4=BD=BF?= =?UTF-8?q?=E5=85=B6=E9=80=82=E9=85=8D=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/RcfDetection.cpp | 286 ++++++++++++++++++ contrib/EdgeDetectionPicture/RcfDetection.h | 61 ++++ 2 files changed, 347 insertions(+) create mode 100644 contrib/EdgeDetectionPicture/RcfDetection.cpp create mode 100644 contrib/EdgeDetectionPicture/RcfDetection.h diff --git a/contrib/EdgeDetectionPicture/RcfDetection.cpp b/contrib/EdgeDetectionPicture/RcfDetection.cpp new file mode 100644 index 000000000..ab1796d72 --- /dev/null +++ b/contrib/EdgeDetectionPicture/RcfDetection.cpp @@ -0,0 +1,286 @@ +/** + * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "RcfDetection.h" +#include "MxBase/DeviceManager/DeviceManager.h" +#include "MxBase/Log/Log.h" +#include "../rcfPostProcess/RcfPostProcess.h" +#include +#include +#include "opencv2/opencv.hpp" + +namespace { + const uint32_t YUV_BYTE_NU = 3; + const uint32_t YUV_BYTE_DE = 2; + const uint32_t VPC_H_ALIGN = 2; + const uint32_t channel = 3; + const double ALPHA = 255.0 / 255; +} +void RcfDetection::SetRcfPostProcessConfig(const InitParam &initParam, + std::map &config) +{ + MxBase::ConfigData configData; + const std::string checkTensor = initParam.checkTensor ? "true" : "false"; + configData.SetJsonValue("OUTSIZE_NUM", std::to_string(initParam.outSizeNum)); + configData.SetJsonValue("OUTSIZE", initParam.outSize); + configData.SetJsonValue("RCF_TYPE", std::to_string(initParam.rcfType)); + configData.SetJsonValue("MODEL_TYPE", std::to_string(initParam.modelType)); + configData.SetJsonValue("INPUT_TYPE", std::to_string(initParam.inputType)); + configData.SetJsonValue("CHECK_MODEL", checkTensor); + #ifdef MX_VERSION_5 + auto jsonStr = configData.GetCfgJson().serialize(); + config["postProcessConfigContent"] = jsonStr; + #else + auto jsonStr = configData.GetCfgJson(); + config["postProcessConfigContent"] = jsonStr; + #endif +} + +APP_ERROR RcfDetection::Init(const InitParam &initParam) +{ + deviceId_ = initParam.deviceId; + APP_ERROR ret = MxBase::DeviceManager::GetInstance()->InitDevices(); + if (ret != APP_ERR_OK) { + LogError << "Init devices failed, ret=" << ret << "."; + return ret; + } + ret = MxBase::TensorContext::GetInstance()->SetContext(initParam.deviceId); + if (ret != APP_ERR_OK) { + LogError << "Set context failed, ret=" << ret << "."; + return ret; + } + dvppWrapper_ = std::make_shared(); + ret = dvppWrapper_->Init(); + if (ret != APP_ERR_OK) { + LogError << "DvppWrapper init failed, ret=" << ret << "."; + return ret; + } + model_ = std::make_shared(); + ret = model_->Init(initParam.modelPath, modelDesc_); + if (ret != APP_ERR_OK) { + LogError << "ModelInferenceProcessor init failed, ret=" << ret << "."; + return ret; + } + + std::map config; + SetRcfPostProcessConfig(initParam, config); + post_ = std::make_shared(); + ret = post_->Init(config); + if (ret != APP_ERR_OK) { + LogError << "RcfPostProcess init failed, ret=" << ret << "."; + return ret; + } + if (ret != APP_ERR_OK) { + LogError << "Failed to load labels, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::DeInit() +{ + dvppWrapper_->DeInit(); + model_->DeInit(); + post_->DeInit(); + MxBase::DeviceManager::GetInstance()->DestroyDevices(); + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::ReadImage(const std::string &imgPath, + MxBase::TensorBase &tensor) +{ + MxBase::DvppDataInfo output = {}; + APP_ERROR ret = dvppWrapper_->DvppJpegDecode(imgPath, output); + if (ret != APP_ERR_OK) { + LogError << "DvppWrapper DvppJpegDecode failed, ret=" << ret << "."; + return ret; + } + MxBase::MemoryData memoryData((void*)output.data, output.dataSize, + MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + if (output.heightStride % VPC_H_ALIGN != 0) { + LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; + MxBase::MemoryHelper::MxbsFree(memoryData); + return APP_ERR_COMM_INVALID_PARAM; + } + dvppHeightStride = output.heightStride; + dvppWidthStride = output.widthStride; + std::vector shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; + tensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); + return APP_ERR_OK; +} +APP_ERROR RcfDetection::Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor, + uint32_t resizeHeight, uint32_t resizeWidth) +{ + auto shape = inputTensor.GetShape(); + MxBase::DvppDataInfo input = {}; + input.height = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; + input.width = shape[1]; + input.heightStride = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; + input.widthStride = shape[1]; + input.dataSize = inputTensor.GetByteSize(); + input.data = (uint8_t*)inputTensor.GetBuffer(); + MxBase::ResizeConfig resize = {}; + resize.height = resizeHeight; + resize.width = resizeWidth; + MxBase::DvppDataInfo output = {}; + APP_ERROR ret = dvppWrapper_->VpcResize(input, output, resize); + if (ret != APP_ERR_OK) { + LogError << "VpcResize failed, ret=" << ret << "."; + return ret; + } + MxBase::MemoryData memoryData((void*)output.data, output.dataSize, + MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + if (output.heightStride % VPC_H_ALIGN != 0) { + LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; + MxBase::MemoryHelper::MxbsFree(memoryData); + return APP_ERR_COMM_INVALID_PARAM; + } + shape = {1, channel, output.heightStride, output.widthStride}; + outputTensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::Inference(const std::vector &inputs, + std::vector &outputs) +{ + std::vector output={}; + auto dtypes = model_->GetOutputDataType(); + for (size_t i = 0; i < modelDesc_.outputTensors.size(); ++i) { + std::vector shape = {}; + for (size_t j = 0; j < modelDesc_.outputTensors[i].tensorDims.size(); ++j) { + shape.push_back((uint32_t)modelDesc_.outputTensors[i].tensorDims[j]); + } + MxBase::TensorBase tensor(shape, dtypes[i], MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + APP_ERROR ret = MxBase::TensorBase::TensorBaseMalloc(tensor); + if (ret != APP_ERR_OK) { + LogError << "TensorBaseMalloc failed, ret=" << ret << "."; + return ret; + } + outputs.push_back(tensor); + } + MxBase::DynamicInfo dynamicInfo = {}; + dynamicInfo.dynamicType = MxBase::DynamicType::STATIC_BATCH; + auto startTime = std::chrono::high_resolution_clock::now(); + APP_ERROR ret = model_->ModelInference(inputs, outputs, dynamicInfo); + auto endTime = std::chrono::high_resolution_clock::now(); + double costMs = std::chrono::duration(endTime - startTime).count(); + LogInfo<< "costMs:"<< costMs; + if (ret != APP_ERR_OK) { + LogError << "ModelInference failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::PostProcess(const MxBase::TensorBase &tensor, + const std::vector &outputs, + std::vector &postProcessOutput) +{ + auto shape = tensor.GetShape(); + MxBase::ResizedImageInfo imgInfo; + imgInfo.widthOriginal = shape[1]; + imgInfo.heightOriginal = shape[0] * YUV_BYTE_DE; + uint32_t widthResize = 512; + uint32_t heightResize = 512; + imgInfo.widthResize = widthResize; + imgInfo.heightResize = heightResize; + imgInfo.resizeType = MxBase::RESIZER_STRETCHING; + std::vector imageInfoVec = {}; + imageInfoVec.push_back(imgInfo); + APP_ERROR ret = post_->Process(outputs, postProcessOutput); + if (ret != APP_ERR_OK) { + LogError << "Process failed, ret=" << ret << "."; + return ret; + } + ret = post_->DeInit(); + if (ret != APP_ERR_OK) { + LogError << "RcfDetection DeInit failed"; + return ret; + } + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::WriteResult(MxBase::TensorBase &inferTensor, const std::string &imgPath) +{ + auto shape = inferTensor.GetShape(); + int dim2 = 2; + int dim3 = 3; + uint32_t height = shape[dim2]; + uint32_t width = shape[dim3]; + cv::Mat imgBgr = cv::imread(imgPath); + std::string fileName = imgPath.substr(imgPath.find_last_of("/") + 1); + uint32_t imageWidth = imgBgr.cols; + uint32_t imageHeight = imgBgr.rows; + cv::Mat modelOutput = cv::Mat(height, width, CV_32FC1, inferTensor.GetBuffer()); + cv::Mat grayMat; + cv::Mat resizedMat; + int crop = 5; + cv::Rect myROI(0, 0, imageWidth - crop, imageHeight); + resize(modelOutput, resizedMat, cv::Size(dvppWidthStride, dvppHeightStride), 0, 0, cv::INTER_LINEAR); + resizedMat.convertTo(grayMat, CV_8UC1, ALPHA); + cv::Mat croppedImage = grayMat(myROI); + resize(croppedImage, croppedImage, cv::Size(imageWidth, imageHeight), 0, 0, cv::INTER_LINEAR); + + std::string resultPathName = "result"; + if (access(resultPathName.c_str(), 0) != 0) { + int ret = mkdir(resultPathName.c_str(), S_IRUSR | S_IWUSR | S_IXUSR); + if (ret != 0) { + LogError << "Failed to create result directory: " << resultPathName << ", ret = " << ret; + return APP_ERR_COMM_FAILURE; + } + } + + cv::imwrite("./result/"+fileName, croppedImage); + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::Process(const std::string &imgPath) +{ + MxBase::TensorBase inTensor; + APP_ERROR ret = ReadImage(imgPath, inTensor); + if (ret != APP_ERR_OK) { + LogError << "ReadImage failed, ret=" << ret << "."; + return ret; + } + MxBase::TensorBase outTensor; + uint32_t resizeHeight = 512; + uint32_t resizeWidth = 512; + ret = Resize(inTensor, outTensor, resizeHeight, resizeWidth); + if (ret != APP_ERR_OK) { + LogError << "Resize failed, ret=" << ret << "."; + return ret; + } + std::vector inputs = {}; + std::vector outputs = {}; + auto shape = outTensor.GetShape(); + inputs.push_back(outTensor); + ret = Inference(inputs, outputs); + if (ret != APP_ERR_OK) { + LogError << "Inference failed, ret=" << ret << "."; + return ret; + } + std::vector postProcessOutput={}; + ret = PostProcess(inTensor, outputs, postProcessOutput); + if (ret != APP_ERR_OK) { + LogError << "PostProcess failed, ret=" << ret << "."; + return ret; + } + ret = WriteResult(postProcessOutput[0], imgPath); + if (ret != APP_ERR_OK) { + LogError << "Save result failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} diff --git a/contrib/EdgeDetectionPicture/RcfDetection.h b/contrib/EdgeDetectionPicture/RcfDetection.h new file mode 100644 index 000000000..7c0ae6da4 --- /dev/null +++ b/contrib/EdgeDetectionPicture/RcfDetection.h @@ -0,0 +1,61 @@ +/* + * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MXBASE_RCFDETECTION_H +#define MXBASE_RCFDETECTION_H + +#include +#include +#include "MxBase/DvppWrapper/DvppWrapper.h" +#include "MxBase/ModelInfer/ModelInferenceProcessor.h" +#include "MxBase/Tensor/TensorContext/TensorContext.h" + +struct InitParam { + uint32_t deviceId = 0; + bool checkTensor = true; + std::string modelPath = ""; + uint32_t outSizeNum = 0; + std::string outSize = ""; + uint32_t rcfType = 0; + uint32_t modelType = 0; + uint32_t inputType = 0; +}; + +class RcfDetection { +public: + APP_ERROR Init(const InitParam &initParam); + APP_ERROR DeInit(); + APP_ERROR Inference(const std::vector &inputs, std::vector &outputs); + APP_ERROR PostProcess(const MxBase::TensorBase &tensor, const std::vector &outputs, + std::vector &postProcessOutput); + APP_ERROR Process(const std::string &imgPath); +protected: + APP_ERROR ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor); + APP_ERROR Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor, + uint32_t resizeHeight, uint32_t resizeWidth); + APP_ERROR WriteResult(MxBase::TensorBase &inferTensor, const std::string &imgPath); + void SetRcfPostProcessConfig(const InitParam &initParam, std::map &config); + +private: + std::shared_ptr dvppWrapper_; + std::shared_ptr model_; + std::shared_ptr post_; + MxBase::ModelDesc modelDesc_ = {}; + uint32_t deviceId_ = 0; + int dvppHeightStride = 0; + int dvppWidthStride = 0; +}; +#endif -- Gitee From d3e96ed7244023009439f4c714e0265842a3200f Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:15:29 +0000 Subject: [PATCH 010/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/EdgeDetectionPicture/rcfDetection/.keep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/rcfDetection/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 contrib/EdgeDetectionPicture/rcfDetection/.keep diff --git a/contrib/EdgeDetectionPicture/rcfDetection/.keep b/contrib/EdgeDetectionPicture/rcfDetection/.keep deleted file mode 100644 index e69de29bb..000000000 -- Gitee From 2c3f8c16725c766066bccc8207571a1c5971ad70 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:16:18 +0000 Subject: [PATCH 011/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/EdgeDetectionPicture/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/README.md | 150 ------------------------- 1 file changed, 150 deletions(-) delete mode 100644 contrib/EdgeDetectionPicture/README.md diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md deleted file mode 100644 index e00f69a20..000000000 --- a/contrib/EdgeDetectionPicture/README.md +++ /dev/null @@ -1,150 +0,0 @@ - -# RCF模型边缘检测 - -## 1 介绍 -本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行 图像边缘提取,并把可视化结果保存到本地。 -其中包含Rcf模型的后处理模块开发。 主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit - -#### 1.1 支持的产品 -昇腾310(推理) - -#### 1.2 支持的版本 -本样例配套的CANN版本为7.0.0,MindX SDK版本为5.0.0 -MindX SDK安装前准备可参考《用户指南》,[安装教程](https://gitee.com/ascend/mindxsdk-referenceapps/blob/master/docs/quickStart/1-1%E5%AE%89%E8%A3%85SDK%E5%BC%80%E5%8F%91%E5%A5%97%E4%BB%B6.md) - -#### 1.3 代码目录结构与说明 -本sample工程名称为EdgeDetectionPicture,工程目录如下图所示: - -``` -. -├── model -│ ├── aipp.cfg // 模型转换aipp配置文件 -├── rcfDetection -│ ├── RcfDetection.cpp -│ └── RcfDetection.h -├── rcfPostProcess -│ ├── rcfPostProcess.cpp -│ └── rcfPostProcess.h -├── build.sh -├── main.cpp -├── README.md -├── CMakeLists.txt -└── License -``` - -## 2 环境依赖 -环境依赖软件和版本如下表: - - - -| 软件 | 版本 | 说明 | 获取方式 | -| ------------------- | ------------ | ----------------------------- | ------------------------------------------------------------ | -| mxVision | 5.0.0 | mxVision软件包 | [链接](https://www.hiascend.com/software/Mindx-sdk) | -| Ascend-CANN-toolkit | 7.0.0 | Ascend-cann-toolkit开发套件包 | [链接](https://www.hiascend.com/software/cann/commercial) | -| 操作系统 | Ubuntu 18.04 | 操作系统 | Ubuntu官网获取 | - -在编译运行项目前,需要设置环境变量: - -- 环境变量介绍 - - ``` - . {cann_install_path}/ascend-toolkit/set_env.sh - . {sdk_install_path}/mxVision/set_env.sh - - ``` - - - -## 3 模型转换 - -**步骤1** 模型获取 -下载RCF模型 。[下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/model.zip) - -**步骤2** 模型存放 -将获取到的RCF模型rcf.prototxt文件和rcf_bsds.caffemodel文件放在edge_detection_picture/model下 - -**步骤3** 执行模型转换命令 - -``` -atc --model=rcf.prototxt --weight=./rcf_bsds.caffemodel --framework=0 --output=rcf --soc_version=Ascend310 --insert_op_conf=./aipp.cfg --input_format=NCHW --output_type=FP32 -``` - -## 4 编译与运行 - -**步骤1** 执行如下编译命令: -bash build.sh - -**步骤2** 进行图像边缘检测 -请自行准备jpg格式的测试图像保存在文件夹中(例如 data/**.jpg)进行边缘检测 -``` -./edge_detection_picture ./data -``` -生成边缘检测图像 result/**.jpg - -## 5 精度测试 -下载开源数据集 BSDS500 [下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/data.zip), 使用 BSR/BSDS500/data/images/test数据进行测试 - - -(1) 下载开源代码 - -``` shell -git clone https://github.com/Walstruzz/edge_eval_python.git -cd edge_eval_python -``` -(2) 编译cxx - -``` shell -cd cxx/src -source build.sh -``` -(3) 将test中的图像经过边缘检测后的结果保存在result文件夹中 - -``` shell -./edge_detection_picture path/to/BSR/BSDS500/data/images/test/ - -``` - - -(4) 修改检测代码 - -vim mian.py -注释第17行代码 nms_process(model_name_list, result_dir, save_dir, key, file_format), -修改18行为 eval_edge(alg, model_name_list, result_dir, gt_dir, workers) - -vim /impl/edges_eval_dir.py -修改155行为 im = os.path.join(res_dir, "{}.jpg".format(i)) - -vim eval_edge.py -修改14行为 res_dir = result_dir - -(5) 测试精度 - -``` shell -python main.py --result_dir path/to/result --gt_dir paht/to/BSR/BSDS500/data/groundTruth/test - -``` -注: - result_dir: results directory - - gt_dir : ground truth directory - - -## 6常见问题 -### 6.1 精度测试脚本运行时, ModuleNotFoundError报错问题: -问题描述: -运行精度测试脚本过程中, 出现如下类似报错: -``` -********* -File "***/nms_process.py", line 6 in - from impl.toolbox import conv_tri, grad2 -ModuleNotFoundError: No module named 'impl.toolbox' -``` - -解决措施: -``` -方法一: -将环境变量PYTHONPATH里面的/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe去掉, 该路径根据cann实际安装位置不同可能会不一样,须自行确认 - -方法二: -执行命令: unset PYTHONPATH -``` \ No newline at end of file -- Gitee From 60e52abad429d3ce0ef7433007b1855297e474cd Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:16:42 +0000 Subject: [PATCH 012/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 156 +++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 contrib/EdgeDetectionPicture/README.md diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md new file mode 100644 index 000000000..53642883f --- /dev/null +++ b/contrib/EdgeDetectionPicture/README.md @@ -0,0 +1,156 @@ + +# RCF模型边缘检测 + +## 1 介绍 + +#### 1.1 简介 +本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行 图像边缘提取,并把可视化结果保存到本地。 +其中包含Rcf模型的后处理模块开发。 主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit + +#### 1.2 支持的产品 +昇腾310(推理) + +#### 1.3 支持的版本 +本样例配套的CANN版本为7.0.0,MindX SDK版本为5.0.0 +MindX SDK安装前准备可参考《用户指南》,[安装教程](https://gitee.com/ascend/mindxsdk-referenceapps/blob/master/docs/quickStart/1-1%E5%AE%89%E8%A3%85SDK%E5%BC%80%E5%8F%91%E5%A5%97%E4%BB%B6.md) +| 软件 | 版本 | 说明 | +| ------------------- | ------------ | ---------------------------- | +| mxVision | 5.0.0 | mxVision软件包 | +| Ascend-CANN-toolkit | 7.0.0 | Ascend-cann-toolkit开发套件包 | + + +#### 1.4 代码目录结构与说明 +本sample工程名称为EdgeDetectionPicture,工程目录如下图所示: + +``` +. +├── model +│ ├── aipp.cfg // 模型转换aipp配置文件 +├── rcfDetection +│ ├── RcfDetection.cpp +│ └── RcfDetection.h +├── rcfPostProcess +│ ├── rcfPostProcess.cpp +│ └── rcfPostProcess.h +├── build.sh +├── main.cpp +├── README.md +├── CMakeLists.txt +└── License +``` + +## 2 设置环境变量 + +在编译运行项目前,需要设置环境变量: + +- 环境变量介绍 + + ``` + . {cann_install_path}/ascend-toolkit/set_env.sh + . {sdk_install_path}/mxVision/set_env.sh + + ``` + + + +## 3 准备模型 + +**步骤1** 模型获取 +下载RCF模型 。[下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/model.zip) + +**步骤2** 模型存放 +将获取到的RCF模型rcf.prototxt文件和rcf_bsds.caffemodel文件放在edge_detection_picture/model下 + +**步骤3** 执行模型转换命令 + +``` +atc --model=rcf.prototxt --weight=./rcf_bsds.caffemodel --framework=0 --output=rcf --soc_version=Ascend310 --insert_op_conf=./aipp.cfg --input_format=NCHW --output_type=FP32 +``` + +## 4 编译与运行 + +**步骤1** 执行如下编译命令: +bash build.sh + +**步骤2** 进行图像边缘检测 +请自行准备jpg格式的测试图像保存在文件夹中(例如 data/**.jpg)进行边缘检测 +``` +./edge_detection_picture ./data +``` +生成边缘检测图像 result/**.jpg + +## 5 精度测试 +下载开源数据集 BSDS500 [下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/data.zip), 使用 BSR/BSDS500/data/images/test数据进行测试 + + +(1) 下载开源代码 + +``` shell +git clone https://github.com/Walstruzz/edge_eval_python.git +cd edge_eval_python +``` +(2) 编译cxx + +``` shell +cd cxx/src +source build.sh +``` +(3) 将test中的图像经过边缘检测后的结果保存在result文件夹中 + +``` shell +./edge_detection_picture path/to/BSR/BSDS500/data/images/test/ + +``` + + +(4) 修改检测代码 + +vim mian.py +注释第17行代码 nms_process(model_name_list, result_dir, save_dir, key, file_format), +修改18行为 eval_edge(alg, model_name_list, result_dir, gt_dir, workers) + +vim /impl/edges_eval_dir.py +修改155行为 im = os.path.join(res_dir, "{}.jpg".format(i)) + +vim eval_edge.py +修改14行为 res_dir = result_dir + +(5) 测试精度 + +``` shell +python main.py --result_dir path/to/result --gt_dir path/to/BSR/BSDS500/data/groundTruth/test + +``` +注: + result_dir: results directory + + gt_dir : ground truth directory + + +## 6常见问题 +### 6.1 精度测试脚本运行时, ModuleNotFoundError报错问题: +问题描述: +运行精度测试脚本过程中, 出现如下类似报错: +``` +********* +File "***/nms_process.py", line 6 in + from impl.toolbox import conv_tri, grad2 +ModuleNotFoundError: No module named 'impl.toolbox' +``` + +解决措施: +``` +方法一: +将环境变量PYTHONPATH里面的/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe去掉, 该路径根据cann实际安装位置不同可能会不一样,须自行确认 + +方法二: +执行命令: unset PYTHONPATH +``` +### 6.2 检测代码无法修改问题: +问题描述: +修改检测代码中, 出现无法修改问题 + +解决措施: +``` +使用 sudo vim filename进行修改 +``` \ No newline at end of file -- Gitee From 242855048bcea8e0784a24395ed259f284cbd873 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:17:02 +0000 Subject: [PATCH 013/129] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20rcfDetection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/rcfDetection/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 contrib/EdgeDetectionPicture/rcfDetection/.keep diff --git a/contrib/EdgeDetectionPicture/rcfDetection/.keep b/contrib/EdgeDetectionPicture/rcfDetection/.keep new file mode 100644 index 000000000..e69de29bb -- Gitee From c38184b05b4a598af37167d258224b5a76718c8e Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:17:31 +0000 Subject: [PATCH 014/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0RcfDetection=E4=BD=BF?= =?UTF-8?q?=E5=85=B6=E9=80=82=E9=85=8D=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- .../rcfDetection/RcfDetection.cpp | 286 ++++++++++++++++++ .../rcfDetection/RcfDetection.h | 61 ++++ 2 files changed, 347 insertions(+) create mode 100644 contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.cpp create mode 100644 contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.h diff --git a/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.cpp b/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.cpp new file mode 100644 index 000000000..ab1796d72 --- /dev/null +++ b/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.cpp @@ -0,0 +1,286 @@ +/** + * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "RcfDetection.h" +#include "MxBase/DeviceManager/DeviceManager.h" +#include "MxBase/Log/Log.h" +#include "../rcfPostProcess/RcfPostProcess.h" +#include +#include +#include "opencv2/opencv.hpp" + +namespace { + const uint32_t YUV_BYTE_NU = 3; + const uint32_t YUV_BYTE_DE = 2; + const uint32_t VPC_H_ALIGN = 2; + const uint32_t channel = 3; + const double ALPHA = 255.0 / 255; +} +void RcfDetection::SetRcfPostProcessConfig(const InitParam &initParam, + std::map &config) +{ + MxBase::ConfigData configData; + const std::string checkTensor = initParam.checkTensor ? "true" : "false"; + configData.SetJsonValue("OUTSIZE_NUM", std::to_string(initParam.outSizeNum)); + configData.SetJsonValue("OUTSIZE", initParam.outSize); + configData.SetJsonValue("RCF_TYPE", std::to_string(initParam.rcfType)); + configData.SetJsonValue("MODEL_TYPE", std::to_string(initParam.modelType)); + configData.SetJsonValue("INPUT_TYPE", std::to_string(initParam.inputType)); + configData.SetJsonValue("CHECK_MODEL", checkTensor); + #ifdef MX_VERSION_5 + auto jsonStr = configData.GetCfgJson().serialize(); + config["postProcessConfigContent"] = jsonStr; + #else + auto jsonStr = configData.GetCfgJson(); + config["postProcessConfigContent"] = jsonStr; + #endif +} + +APP_ERROR RcfDetection::Init(const InitParam &initParam) +{ + deviceId_ = initParam.deviceId; + APP_ERROR ret = MxBase::DeviceManager::GetInstance()->InitDevices(); + if (ret != APP_ERR_OK) { + LogError << "Init devices failed, ret=" << ret << "."; + return ret; + } + ret = MxBase::TensorContext::GetInstance()->SetContext(initParam.deviceId); + if (ret != APP_ERR_OK) { + LogError << "Set context failed, ret=" << ret << "."; + return ret; + } + dvppWrapper_ = std::make_shared(); + ret = dvppWrapper_->Init(); + if (ret != APP_ERR_OK) { + LogError << "DvppWrapper init failed, ret=" << ret << "."; + return ret; + } + model_ = std::make_shared(); + ret = model_->Init(initParam.modelPath, modelDesc_); + if (ret != APP_ERR_OK) { + LogError << "ModelInferenceProcessor init failed, ret=" << ret << "."; + return ret; + } + + std::map config; + SetRcfPostProcessConfig(initParam, config); + post_ = std::make_shared(); + ret = post_->Init(config); + if (ret != APP_ERR_OK) { + LogError << "RcfPostProcess init failed, ret=" << ret << "."; + return ret; + } + if (ret != APP_ERR_OK) { + LogError << "Failed to load labels, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::DeInit() +{ + dvppWrapper_->DeInit(); + model_->DeInit(); + post_->DeInit(); + MxBase::DeviceManager::GetInstance()->DestroyDevices(); + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::ReadImage(const std::string &imgPath, + MxBase::TensorBase &tensor) +{ + MxBase::DvppDataInfo output = {}; + APP_ERROR ret = dvppWrapper_->DvppJpegDecode(imgPath, output); + if (ret != APP_ERR_OK) { + LogError << "DvppWrapper DvppJpegDecode failed, ret=" << ret << "."; + return ret; + } + MxBase::MemoryData memoryData((void*)output.data, output.dataSize, + MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + if (output.heightStride % VPC_H_ALIGN != 0) { + LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; + MxBase::MemoryHelper::MxbsFree(memoryData); + return APP_ERR_COMM_INVALID_PARAM; + } + dvppHeightStride = output.heightStride; + dvppWidthStride = output.widthStride; + std::vector shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; + tensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); + return APP_ERR_OK; +} +APP_ERROR RcfDetection::Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor, + uint32_t resizeHeight, uint32_t resizeWidth) +{ + auto shape = inputTensor.GetShape(); + MxBase::DvppDataInfo input = {}; + input.height = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; + input.width = shape[1]; + input.heightStride = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; + input.widthStride = shape[1]; + input.dataSize = inputTensor.GetByteSize(); + input.data = (uint8_t*)inputTensor.GetBuffer(); + MxBase::ResizeConfig resize = {}; + resize.height = resizeHeight; + resize.width = resizeWidth; + MxBase::DvppDataInfo output = {}; + APP_ERROR ret = dvppWrapper_->VpcResize(input, output, resize); + if (ret != APP_ERR_OK) { + LogError << "VpcResize failed, ret=" << ret << "."; + return ret; + } + MxBase::MemoryData memoryData((void*)output.data, output.dataSize, + MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + if (output.heightStride % VPC_H_ALIGN != 0) { + LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; + MxBase::MemoryHelper::MxbsFree(memoryData); + return APP_ERR_COMM_INVALID_PARAM; + } + shape = {1, channel, output.heightStride, output.widthStride}; + outputTensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::Inference(const std::vector &inputs, + std::vector &outputs) +{ + std::vector output={}; + auto dtypes = model_->GetOutputDataType(); + for (size_t i = 0; i < modelDesc_.outputTensors.size(); ++i) { + std::vector shape = {}; + for (size_t j = 0; j < modelDesc_.outputTensors[i].tensorDims.size(); ++j) { + shape.push_back((uint32_t)modelDesc_.outputTensors[i].tensorDims[j]); + } + MxBase::TensorBase tensor(shape, dtypes[i], MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + APP_ERROR ret = MxBase::TensorBase::TensorBaseMalloc(tensor); + if (ret != APP_ERR_OK) { + LogError << "TensorBaseMalloc failed, ret=" << ret << "."; + return ret; + } + outputs.push_back(tensor); + } + MxBase::DynamicInfo dynamicInfo = {}; + dynamicInfo.dynamicType = MxBase::DynamicType::STATIC_BATCH; + auto startTime = std::chrono::high_resolution_clock::now(); + APP_ERROR ret = model_->ModelInference(inputs, outputs, dynamicInfo); + auto endTime = std::chrono::high_resolution_clock::now(); + double costMs = std::chrono::duration(endTime - startTime).count(); + LogInfo<< "costMs:"<< costMs; + if (ret != APP_ERR_OK) { + LogError << "ModelInference failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::PostProcess(const MxBase::TensorBase &tensor, + const std::vector &outputs, + std::vector &postProcessOutput) +{ + auto shape = tensor.GetShape(); + MxBase::ResizedImageInfo imgInfo; + imgInfo.widthOriginal = shape[1]; + imgInfo.heightOriginal = shape[0] * YUV_BYTE_DE; + uint32_t widthResize = 512; + uint32_t heightResize = 512; + imgInfo.widthResize = widthResize; + imgInfo.heightResize = heightResize; + imgInfo.resizeType = MxBase::RESIZER_STRETCHING; + std::vector imageInfoVec = {}; + imageInfoVec.push_back(imgInfo); + APP_ERROR ret = post_->Process(outputs, postProcessOutput); + if (ret != APP_ERR_OK) { + LogError << "Process failed, ret=" << ret << "."; + return ret; + } + ret = post_->DeInit(); + if (ret != APP_ERR_OK) { + LogError << "RcfDetection DeInit failed"; + return ret; + } + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::WriteResult(MxBase::TensorBase &inferTensor, const std::string &imgPath) +{ + auto shape = inferTensor.GetShape(); + int dim2 = 2; + int dim3 = 3; + uint32_t height = shape[dim2]; + uint32_t width = shape[dim3]; + cv::Mat imgBgr = cv::imread(imgPath); + std::string fileName = imgPath.substr(imgPath.find_last_of("/") + 1); + uint32_t imageWidth = imgBgr.cols; + uint32_t imageHeight = imgBgr.rows; + cv::Mat modelOutput = cv::Mat(height, width, CV_32FC1, inferTensor.GetBuffer()); + cv::Mat grayMat; + cv::Mat resizedMat; + int crop = 5; + cv::Rect myROI(0, 0, imageWidth - crop, imageHeight); + resize(modelOutput, resizedMat, cv::Size(dvppWidthStride, dvppHeightStride), 0, 0, cv::INTER_LINEAR); + resizedMat.convertTo(grayMat, CV_8UC1, ALPHA); + cv::Mat croppedImage = grayMat(myROI); + resize(croppedImage, croppedImage, cv::Size(imageWidth, imageHeight), 0, 0, cv::INTER_LINEAR); + + std::string resultPathName = "result"; + if (access(resultPathName.c_str(), 0) != 0) { + int ret = mkdir(resultPathName.c_str(), S_IRUSR | S_IWUSR | S_IXUSR); + if (ret != 0) { + LogError << "Failed to create result directory: " << resultPathName << ", ret = " << ret; + return APP_ERR_COMM_FAILURE; + } + } + + cv::imwrite("./result/"+fileName, croppedImage); + return APP_ERR_OK; +} + +APP_ERROR RcfDetection::Process(const std::string &imgPath) +{ + MxBase::TensorBase inTensor; + APP_ERROR ret = ReadImage(imgPath, inTensor); + if (ret != APP_ERR_OK) { + LogError << "ReadImage failed, ret=" << ret << "."; + return ret; + } + MxBase::TensorBase outTensor; + uint32_t resizeHeight = 512; + uint32_t resizeWidth = 512; + ret = Resize(inTensor, outTensor, resizeHeight, resizeWidth); + if (ret != APP_ERR_OK) { + LogError << "Resize failed, ret=" << ret << "."; + return ret; + } + std::vector inputs = {}; + std::vector outputs = {}; + auto shape = outTensor.GetShape(); + inputs.push_back(outTensor); + ret = Inference(inputs, outputs); + if (ret != APP_ERR_OK) { + LogError << "Inference failed, ret=" << ret << "."; + return ret; + } + std::vector postProcessOutput={}; + ret = PostProcess(inTensor, outputs, postProcessOutput); + if (ret != APP_ERR_OK) { + LogError << "PostProcess failed, ret=" << ret << "."; + return ret; + } + ret = WriteResult(postProcessOutput[0], imgPath); + if (ret != APP_ERR_OK) { + LogError << "Save result failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} diff --git a/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.h b/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.h new file mode 100644 index 000000000..7c0ae6da4 --- /dev/null +++ b/contrib/EdgeDetectionPicture/rcfDetection/RcfDetection.h @@ -0,0 +1,61 @@ +/* + * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MXBASE_RCFDETECTION_H +#define MXBASE_RCFDETECTION_H + +#include +#include +#include "MxBase/DvppWrapper/DvppWrapper.h" +#include "MxBase/ModelInfer/ModelInferenceProcessor.h" +#include "MxBase/Tensor/TensorContext/TensorContext.h" + +struct InitParam { + uint32_t deviceId = 0; + bool checkTensor = true; + std::string modelPath = ""; + uint32_t outSizeNum = 0; + std::string outSize = ""; + uint32_t rcfType = 0; + uint32_t modelType = 0; + uint32_t inputType = 0; +}; + +class RcfDetection { +public: + APP_ERROR Init(const InitParam &initParam); + APP_ERROR DeInit(); + APP_ERROR Inference(const std::vector &inputs, std::vector &outputs); + APP_ERROR PostProcess(const MxBase::TensorBase &tensor, const std::vector &outputs, + std::vector &postProcessOutput); + APP_ERROR Process(const std::string &imgPath); +protected: + APP_ERROR ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor); + APP_ERROR Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor, + uint32_t resizeHeight, uint32_t resizeWidth); + APP_ERROR WriteResult(MxBase::TensorBase &inferTensor, const std::string &imgPath); + void SetRcfPostProcessConfig(const InitParam &initParam, std::map &config); + +private: + std::shared_ptr dvppWrapper_; + std::shared_ptr model_; + std::shared_ptr post_; + MxBase::ModelDesc modelDesc_ = {}; + uint32_t deviceId_ = 0; + int dvppHeightStride = 0; + int dvppWidthStride = 0; +}; +#endif -- Gitee From 6bbe86b9a7c771bb196f2ff04f28c24f1a99123d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:17:36 +0000 Subject: [PATCH 015/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/EdgeDetectionPicture/rcfDetection/.keep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/rcfDetection/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 contrib/EdgeDetectionPicture/rcfDetection/.keep diff --git a/contrib/EdgeDetectionPicture/rcfDetection/.keep b/contrib/EdgeDetectionPicture/rcfDetection/.keep deleted file mode 100644 index e69de29bb..000000000 -- Gitee From 6d94ab464e821fead4732ba4d0e45c6f0bd9bb50 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:17:45 +0000 Subject: [PATCH 016/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/EdgeDetectionPicture/RcfDetection.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/RcfDetection.h | 61 --------------------- 1 file changed, 61 deletions(-) delete mode 100644 contrib/EdgeDetectionPicture/RcfDetection.h diff --git a/contrib/EdgeDetectionPicture/RcfDetection.h b/contrib/EdgeDetectionPicture/RcfDetection.h deleted file mode 100644 index 7c0ae6da4..000000000 --- a/contrib/EdgeDetectionPicture/RcfDetection.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MXBASE_RCFDETECTION_H -#define MXBASE_RCFDETECTION_H - -#include -#include -#include "MxBase/DvppWrapper/DvppWrapper.h" -#include "MxBase/ModelInfer/ModelInferenceProcessor.h" -#include "MxBase/Tensor/TensorContext/TensorContext.h" - -struct InitParam { - uint32_t deviceId = 0; - bool checkTensor = true; - std::string modelPath = ""; - uint32_t outSizeNum = 0; - std::string outSize = ""; - uint32_t rcfType = 0; - uint32_t modelType = 0; - uint32_t inputType = 0; -}; - -class RcfDetection { -public: - APP_ERROR Init(const InitParam &initParam); - APP_ERROR DeInit(); - APP_ERROR Inference(const std::vector &inputs, std::vector &outputs); - APP_ERROR PostProcess(const MxBase::TensorBase &tensor, const std::vector &outputs, - std::vector &postProcessOutput); - APP_ERROR Process(const std::string &imgPath); -protected: - APP_ERROR ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor); - APP_ERROR Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor, - uint32_t resizeHeight, uint32_t resizeWidth); - APP_ERROR WriteResult(MxBase::TensorBase &inferTensor, const std::string &imgPath); - void SetRcfPostProcessConfig(const InitParam &initParam, std::map &config); - -private: - std::shared_ptr dvppWrapper_; - std::shared_ptr model_; - std::shared_ptr post_; - MxBase::ModelDesc modelDesc_ = {}; - uint32_t deviceId_ = 0; - int dvppHeightStride = 0; - int dvppWidthStride = 0; -}; -#endif -- Gitee From 092009ea6922a7d34c3d56db2ca0cdb7b8110205 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:17:51 +0000 Subject: [PATCH 017/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/EdgeDetectionPicture/RcfDetection.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/RcfDetection.cpp | 286 ------------------ 1 file changed, 286 deletions(-) delete mode 100644 contrib/EdgeDetectionPicture/RcfDetection.cpp diff --git a/contrib/EdgeDetectionPicture/RcfDetection.cpp b/contrib/EdgeDetectionPicture/RcfDetection.cpp deleted file mode 100644 index ab1796d72..000000000 --- a/contrib/EdgeDetectionPicture/RcfDetection.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/** - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "RcfDetection.h" -#include "MxBase/DeviceManager/DeviceManager.h" -#include "MxBase/Log/Log.h" -#include "../rcfPostProcess/RcfPostProcess.h" -#include -#include -#include "opencv2/opencv.hpp" - -namespace { - const uint32_t YUV_BYTE_NU = 3; - const uint32_t YUV_BYTE_DE = 2; - const uint32_t VPC_H_ALIGN = 2; - const uint32_t channel = 3; - const double ALPHA = 255.0 / 255; -} -void RcfDetection::SetRcfPostProcessConfig(const InitParam &initParam, - std::map &config) -{ - MxBase::ConfigData configData; - const std::string checkTensor = initParam.checkTensor ? "true" : "false"; - configData.SetJsonValue("OUTSIZE_NUM", std::to_string(initParam.outSizeNum)); - configData.SetJsonValue("OUTSIZE", initParam.outSize); - configData.SetJsonValue("RCF_TYPE", std::to_string(initParam.rcfType)); - configData.SetJsonValue("MODEL_TYPE", std::to_string(initParam.modelType)); - configData.SetJsonValue("INPUT_TYPE", std::to_string(initParam.inputType)); - configData.SetJsonValue("CHECK_MODEL", checkTensor); - #ifdef MX_VERSION_5 - auto jsonStr = configData.GetCfgJson().serialize(); - config["postProcessConfigContent"] = jsonStr; - #else - auto jsonStr = configData.GetCfgJson(); - config["postProcessConfigContent"] = jsonStr; - #endif -} - -APP_ERROR RcfDetection::Init(const InitParam &initParam) -{ - deviceId_ = initParam.deviceId; - APP_ERROR ret = MxBase::DeviceManager::GetInstance()->InitDevices(); - if (ret != APP_ERR_OK) { - LogError << "Init devices failed, ret=" << ret << "."; - return ret; - } - ret = MxBase::TensorContext::GetInstance()->SetContext(initParam.deviceId); - if (ret != APP_ERR_OK) { - LogError << "Set context failed, ret=" << ret << "."; - return ret; - } - dvppWrapper_ = std::make_shared(); - ret = dvppWrapper_->Init(); - if (ret != APP_ERR_OK) { - LogError << "DvppWrapper init failed, ret=" << ret << "."; - return ret; - } - model_ = std::make_shared(); - ret = model_->Init(initParam.modelPath, modelDesc_); - if (ret != APP_ERR_OK) { - LogError << "ModelInferenceProcessor init failed, ret=" << ret << "."; - return ret; - } - - std::map config; - SetRcfPostProcessConfig(initParam, config); - post_ = std::make_shared(); - ret = post_->Init(config); - if (ret != APP_ERR_OK) { - LogError << "RcfPostProcess init failed, ret=" << ret << "."; - return ret; - } - if (ret != APP_ERR_OK) { - LogError << "Failed to load labels, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::DeInit() -{ - dvppWrapper_->DeInit(); - model_->DeInit(); - post_->DeInit(); - MxBase::DeviceManager::GetInstance()->DestroyDevices(); - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::ReadImage(const std::string &imgPath, - MxBase::TensorBase &tensor) -{ - MxBase::DvppDataInfo output = {}; - APP_ERROR ret = dvppWrapper_->DvppJpegDecode(imgPath, output); - if (ret != APP_ERR_OK) { - LogError << "DvppWrapper DvppJpegDecode failed, ret=" << ret << "."; - return ret; - } - MxBase::MemoryData memoryData((void*)output.data, output.dataSize, - MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - if (output.heightStride % VPC_H_ALIGN != 0) { - LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; - MxBase::MemoryHelper::MxbsFree(memoryData); - return APP_ERR_COMM_INVALID_PARAM; - } - dvppHeightStride = output.heightStride; - dvppWidthStride = output.widthStride; - std::vector shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; - tensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); - return APP_ERR_OK; -} -APP_ERROR RcfDetection::Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor, - uint32_t resizeHeight, uint32_t resizeWidth) -{ - auto shape = inputTensor.GetShape(); - MxBase::DvppDataInfo input = {}; - input.height = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; - input.width = shape[1]; - input.heightStride = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; - input.widthStride = shape[1]; - input.dataSize = inputTensor.GetByteSize(); - input.data = (uint8_t*)inputTensor.GetBuffer(); - MxBase::ResizeConfig resize = {}; - resize.height = resizeHeight; - resize.width = resizeWidth; - MxBase::DvppDataInfo output = {}; - APP_ERROR ret = dvppWrapper_->VpcResize(input, output, resize); - if (ret != APP_ERR_OK) { - LogError << "VpcResize failed, ret=" << ret << "."; - return ret; - } - MxBase::MemoryData memoryData((void*)output.data, output.dataSize, - MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - if (output.heightStride % VPC_H_ALIGN != 0) { - LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; - MxBase::MemoryHelper::MxbsFree(memoryData); - return APP_ERR_COMM_INVALID_PARAM; - } - shape = {1, channel, output.heightStride, output.widthStride}; - outputTensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::Inference(const std::vector &inputs, - std::vector &outputs) -{ - std::vector output={}; - auto dtypes = model_->GetOutputDataType(); - for (size_t i = 0; i < modelDesc_.outputTensors.size(); ++i) { - std::vector shape = {}; - for (size_t j = 0; j < modelDesc_.outputTensors[i].tensorDims.size(); ++j) { - shape.push_back((uint32_t)modelDesc_.outputTensors[i].tensorDims[j]); - } - MxBase::TensorBase tensor(shape, dtypes[i], MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - APP_ERROR ret = MxBase::TensorBase::TensorBaseMalloc(tensor); - if (ret != APP_ERR_OK) { - LogError << "TensorBaseMalloc failed, ret=" << ret << "."; - return ret; - } - outputs.push_back(tensor); - } - MxBase::DynamicInfo dynamicInfo = {}; - dynamicInfo.dynamicType = MxBase::DynamicType::STATIC_BATCH; - auto startTime = std::chrono::high_resolution_clock::now(); - APP_ERROR ret = model_->ModelInference(inputs, outputs, dynamicInfo); - auto endTime = std::chrono::high_resolution_clock::now(); - double costMs = std::chrono::duration(endTime - startTime).count(); - LogInfo<< "costMs:"<< costMs; - if (ret != APP_ERR_OK) { - LogError << "ModelInference failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::PostProcess(const MxBase::TensorBase &tensor, - const std::vector &outputs, - std::vector &postProcessOutput) -{ - auto shape = tensor.GetShape(); - MxBase::ResizedImageInfo imgInfo; - imgInfo.widthOriginal = shape[1]; - imgInfo.heightOriginal = shape[0] * YUV_BYTE_DE; - uint32_t widthResize = 512; - uint32_t heightResize = 512; - imgInfo.widthResize = widthResize; - imgInfo.heightResize = heightResize; - imgInfo.resizeType = MxBase::RESIZER_STRETCHING; - std::vector imageInfoVec = {}; - imageInfoVec.push_back(imgInfo); - APP_ERROR ret = post_->Process(outputs, postProcessOutput); - if (ret != APP_ERR_OK) { - LogError << "Process failed, ret=" << ret << "."; - return ret; - } - ret = post_->DeInit(); - if (ret != APP_ERR_OK) { - LogError << "RcfDetection DeInit failed"; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::WriteResult(MxBase::TensorBase &inferTensor, const std::string &imgPath) -{ - auto shape = inferTensor.GetShape(); - int dim2 = 2; - int dim3 = 3; - uint32_t height = shape[dim2]; - uint32_t width = shape[dim3]; - cv::Mat imgBgr = cv::imread(imgPath); - std::string fileName = imgPath.substr(imgPath.find_last_of("/") + 1); - uint32_t imageWidth = imgBgr.cols; - uint32_t imageHeight = imgBgr.rows; - cv::Mat modelOutput = cv::Mat(height, width, CV_32FC1, inferTensor.GetBuffer()); - cv::Mat grayMat; - cv::Mat resizedMat; - int crop = 5; - cv::Rect myROI(0, 0, imageWidth - crop, imageHeight); - resize(modelOutput, resizedMat, cv::Size(dvppWidthStride, dvppHeightStride), 0, 0, cv::INTER_LINEAR); - resizedMat.convertTo(grayMat, CV_8UC1, ALPHA); - cv::Mat croppedImage = grayMat(myROI); - resize(croppedImage, croppedImage, cv::Size(imageWidth, imageHeight), 0, 0, cv::INTER_LINEAR); - - std::string resultPathName = "result"; - if (access(resultPathName.c_str(), 0) != 0) { - int ret = mkdir(resultPathName.c_str(), S_IRUSR | S_IWUSR | S_IXUSR); - if (ret != 0) { - LogError << "Failed to create result directory: " << resultPathName << ", ret = " << ret; - return APP_ERR_COMM_FAILURE; - } - } - - cv::imwrite("./result/"+fileName, croppedImage); - return APP_ERR_OK; -} - -APP_ERROR RcfDetection::Process(const std::string &imgPath) -{ - MxBase::TensorBase inTensor; - APP_ERROR ret = ReadImage(imgPath, inTensor); - if (ret != APP_ERR_OK) { - LogError << "ReadImage failed, ret=" << ret << "."; - return ret; - } - MxBase::TensorBase outTensor; - uint32_t resizeHeight = 512; - uint32_t resizeWidth = 512; - ret = Resize(inTensor, outTensor, resizeHeight, resizeWidth); - if (ret != APP_ERR_OK) { - LogError << "Resize failed, ret=" << ret << "."; - return ret; - } - std::vector inputs = {}; - std::vector outputs = {}; - auto shape = outTensor.GetShape(); - inputs.push_back(outTensor); - ret = Inference(inputs, outputs); - if (ret != APP_ERR_OK) { - LogError << "Inference failed, ret=" << ret << "."; - return ret; - } - std::vector postProcessOutput={}; - ret = PostProcess(inTensor, outputs, postProcessOutput); - if (ret != APP_ERR_OK) { - LogError << "PostProcess failed, ret=" << ret << "."; - return ret; - } - ret = WriteResult(postProcessOutput[0], imgPath); - if (ret != APP_ERR_OK) { - LogError << "Save result failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} -- Gitee From 7a361e132d66248b60ff1a52f2a0473b351a51aa Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Sat, 12 Oct 2024 07:18:44 +0000 Subject: [PATCH 018/129] update contrib/EdgeDetectionPicture/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md index 53642883f..ec2f72b99 100644 --- a/contrib/EdgeDetectionPicture/README.md +++ b/contrib/EdgeDetectionPicture/README.md @@ -19,7 +19,7 @@ MindX SDK安装前准备可参考《用户指南》,[安装教程](https://git | Ascend-CANN-toolkit | 7.0.0 | Ascend-cann-toolkit开发套件包 | -#### 1.4 代码目录结构与说明 +#### 1.4 代码目录结构说明 本sample工程名称为EdgeDetectionPicture,工程目录如下图所示: ``` @@ -48,7 +48,6 @@ MindX SDK安装前准备可参考《用户指南》,[安装教程](https://git ``` . {cann_install_path}/ascend-toolkit/set_env.sh . {sdk_install_path}/mxVision/set_env.sh - ``` -- Gitee From 8b88b3b89adc14434e9f9dab9c94d462f111644c Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 14 Oct 2024 01:53:46 +0000 Subject: [PATCH 019/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/TSM/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/TSM/README.md | 341 ------------------------------------------ 1 file changed, 341 deletions(-) delete mode 100644 contrib/TSM/README.md diff --git a/contrib/TSM/README.md b/contrib/TSM/README.md deleted file mode 100644 index 7356a5817..000000000 --- a/contrib/TSM/README.md +++ /dev/null @@ -1,341 +0,0 @@ -# TSM视频分类参考设计 - -## 1 介绍 -使用TSM模型,基于Kinetics-400数据集,在MindX SDK环境下实现视频分类功能。将测试视频传入脚本进行前处理,模型推理,后处理等功能,最终得到模型推理的精度和性能。 - -### 1.1 支持的产品 - -以昇腾Atlas310卡为主要的硬件平台 - -### 1.2 支持的版本 - -CANN:7.0.RC1 - -SDK:mxVision 5.0.RC3(可通过cat SDK目录下的 version.info 查看) - -### 1.3 软件方案介绍 - -项目主要由离线精度测试文件,在线功能测试文件,离线单视频推理性能测试文件,模型文件,测试数据集预处理文件组成。 - -### 1.4 代码目录结构与说明 - -```text -├── TSM - ├── README.md // 所有模型相关说明 - ├── model - ├── onnx2om.sh // 转om模型脚本 - ├── onnx2om1.sh // 在线模型转om模型脚本 - ├── label - ├── kinetics_val.csv // label文件 - ├── download_data - ├── k400_extractor.sh // 解压数据集脚本 - ├── offline.png // 离线推理技术实现流程 - ├── online.png // 在线推理技术实现流程 - ├── online_infer.py // 在线推理精度脚本 - ├── offline_infer.py // 离线推理精度脚本 - ├── speed.py // 离线单视频推理NPU性能脚本 - ├── speed_gpu.py // 离线单视频推理GPU性能脚本 -``` - -### 1.5技术实现流程 - -离线推理流程: - -![离线推理流程](./offline.png) - -在线推理流程: - -![离线推理流程](./online.png) - -### 1.6特性及适用场景 - -离线模型: - -本案例中的 TSM 模型适用于Kinetics数据集中的400类视频分类,并可以返回测试集视频的精度值及单视频识别的种类、性能。 - -在以下两种情况视频分类情况不太好:1. 视频长度过短(小于3s)。 2. 视频帧率过低。 - -在线模型: - -本案例中的在线模型适用于26中手势识别,并可以返回识别手势的名称。 - -## 2 环境依赖 - -推荐系统为ubuntu 18.04,环境依赖软件和版本如下表 - -| 软件名称 | 版本 | -|----------|--------| -| cmake | 3.5+ | -| mxVision | 5.0.RC3 | -| Python | 3.9 | -| torch | 1.10.0 | -| ffmpeg | 4.2.1 | - -- 环境变量搭建 - -在运行项目前,需要设置环境变量: - -MindSDK 环境变量: - -```Shell -. ${SDK-path}/set_env.sh -``` - -CANN 环境变量: - -```Shell -. ${ascend-toolkit-path}/set_env.sh -``` - -环境变量介绍 - -SDK-path: mxVision SDK 安装路径 - -ascend-toolkit-path: CANN 安装路径。 - -下载[ffmpeg](https://github.com/FFmpeg/FFmpeg/archive/n4.2.1.tar.gz),解压进入并执行以下命令安装: - -```Shell -./configure --prefix=/usr/local/ffmpeg --enable-shared -make -j -make install -``` - -安装完毕后导入环境变量 - -```Shell -export PATH=/usr/local/ffmpeg/bin:$PATH -export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH -``` - -## 3 离线推理 - -**步骤1** Kinetics-400数据集下载 - -参考[Kinetics-400 数据准备](https://github.com/PaddlePaddle/PaddleVideo/blob/develop/docs/zh-CN/dataset/k400.md#%E4%B8%8B%E8%BD%BDvideo%E6%95%B0%E6%8D%AE)中的脚本下载操作,在代码根目录的"download_data"目录下准备"download.sh"数据集下载脚本和"val_link.list"验证集链接列表文件。 - -```text -├── TSM - ├── download_data - ├── download.sh // 下载数据集脚本 - ├── k400_extractor.sh // 解压数据集脚本 - ├── val_link.list -``` - -进入代码根目录的"download_data"目录下,执行以下命令下载数据集压缩包val_part1.tar、val_part2.tar、val_part3.tar: - -```Shell -bash download.sh val_link.list -``` - -然后执行以下命令解压数据集到代码根目录下: - -```Shell -bash k400_extractor.sh -``` - -数据集结构如下: - -```text -├── TSM - ├── data - ├── abseiling - ├── air_drumming - ├── ... - ├── zumba -``` - -**步骤2** 数据集预处理 - -1、视频抽帧 - -在代码根目录执行以下命令创建所需目录: - -```Shell -mkdir tools -mkdir ops -``` - -下载[“temporal-shift-module-master.zip”](https://github.com/mit-han-lab/temporal-shift-module/tree/master)代码包并上传服务器解压,将代码包中"tools"目录下的"vid2img_kinetics.py"、"gen_label_kinetics.py"、"kinetics_label_map.txt"三个文件拷贝至参考设计代码根目录的“tools”目录下。 - -```text -├── TSM - ├── tools - ├── gen_label_kinetics.py // label生成脚本 - ├── vid2img_kinetics.py // 视频抽帧脚本 - ├── kinetics_label_map.txt -``` - -将代码包中"ops"目录下的"basic_ops.py"、"dataset.py"、"dataset_config.py"、"models.py"、"temporal_shift.py"、"transforms.py"六个文件拷贝至参考设计代码根目录的“ops”目录下。 - -```text - ├── ops - ├── basic_ops.py - ├── dataset.py // 数据集构建脚本 - ├── dataset_config.py // 数据集配置脚本 - ├── models.py // 模型搭建脚本 - ├── temporal_shift.py - ├── transforms.py -``` - -修改“tools”目录下的 vid2img_kinetics.py 内容,将77、78行注释。 - -```text - -77行 #class_name = 'test' -78行 #class_process(dir_path, dst_dir_path, class_name) - -``` - -在参考设计代码根目录下,执行以下命令对数据集视频进行抽帧并生成图片: - -```shell -mkdir dataset -cd ./tools -python3 vid2img_kinetics.py [video_path] [image_path] -e.g. -python3 vid2img_kinetics.py ../data ../dataset/ -``` - -修改“tools”目录下gen_label_kinetics.py 内容。 - -```text - -# 11行 dataset_path = '../dataset' # 放视频抽帧后的图片路径 -# 12行 label_path = '../label' # 存放label路径 -# 25行 files_input = ['kinetics_val.csv'] -# 26行 files_output = ['val_videofolder.txt'] -# 37行 folders.append(items[1]) -# 57行 output.append('%s %d %d'%(os.path.join('../dataset/',os.path.join(categories_list[i], curFolder)), len(dir_files), curIDX)) - -``` - -在“tools”目录下,执行以下命令生成标签文件: - -```shell -python3 gen_label_kinetics.py -``` - -**步骤3** 模型转换 - -下载[离线模型](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/TSM/offline_models.zip) TSM.onnx, 将下载好的模型放在“${TSM代码根目录}/model”目录下。 - -将模型转换为om模型,在“model”目录下,执行以下命令生成om模型 - -```shell -bash onnx2om.sh -``` - -**步骤4** 精度测试 - -修改${TSM代码根目录}/ops/dataset_config.py 脚本中参数root_data、filename_imglist_train和filename_imglist_val,若仅进行离线精度测试则可忽略filename_imglist_train设置。 - -```shell -import os - -ROOT_DATASET = './labels/' # 标签文件所在路径 - -... - -def return_kinetics(modality): - filename_categories = 400 - if modality == 'RGB': - root_data = ROOT_DATASET # 训练集根目录 - filename_imglist_train = 'train_videofolder.txt' # 训练数据集标签 - filename_imglist_val = 'val_videofolder.txt' # 测试数据集标签 - prefix = 'img_{:05d}.jpg' - else: - raise NotImplementedError('no such modality:' + modality) - return filename_categories, filename_imglist_train, filename_imglist_val, root_data, prefix -``` - -在参考设计代码根目录下,运行精度测试脚本 - -```shell -python3 offline_infer.py kinetics -``` - -原模型精度值为71.1%,实测精度值为71.01%,符合精度偏差范围,精度达标。 - -**步骤5** 性能测试 - -将用来测试的单视频放在参考设计代码根目录下,如视频“test_speed.mp4”,运行性能测试脚本 - -修改speed_gpu.py与speed.py参数,'./test_speed.mp4'为测试视频,测试视频类别需在Kinetics-400数据集的400个种类内且视频长度至少为3s。 - -```python -def main(): - cmd = 'ffmpeg -i \"{}\" -threads 1 -vf scale=-1:331 -q:v 0 \"{}/img_%05d.jpg\"'.format('./test_speed.mp4', './image') - subprocess.call(cmd, shell=True, - stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - files = os.listdir(r"./image/") -``` - -GPU性能(Tesla_V100S_PCIE_32GB) - -在参考设计代码根目录下,运行GPU性能测试脚本 - -```shell -python3 speed_gpu.py kinetics --test_segments=8 --test_crops=1 --batch_size=1 -``` - -注:speed_gpu.py脚本需在GPU环境上运行,NPU环境无法运行。 - -得到单视频纯推理性能为0.08sec/video - -SDK性能 - -在参考设计代码根目录下,运行SDK性能测试脚本 - -```shell -python3 speed.py -``` - -注:speed.py脚本需在NPU环境上运行。 - -得到单视频纯推理性能为0.189sec/video - -## 4 在线推理 - -**步骤1** 安装[视频流工具](https://gitee.com/ascend/docs-openmind/blob/master/guide/mindx/sdk/tutorials/reference_material/Live555%E7%A6%BB%E7%BA%BF%E8%A7%86%E9%A2%91%E8%BD%ACRTSP%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md) - -**步骤2** 生成视频流 - -根据提示当前只支持部分视频格式,并不支持.mp4后缀的文件,但可以通过ffmpeg转换生成[ffmpeg安装教程](https://gitee.com/ascend/docs-openmind/blob/master/guide/mindx/sdk/tutorials/reference_material/pc%E7%AB%AFffmpeg%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B.md),如下所示为MP4转换为h.264命令: - -使用ffmpeg工具将带有手势的“jester.mp4”的mp4格式视频转换生成为“jester.264”的264格式视频: - -```shell -ffmpeg -i jester.mp4 -vcodec h264 -bf 0 -g 25 -r 10 -s 1280*720 -an -f h264 jester.264 - -//-bf B帧数目控制,-g 关键帧间隔控制,-s 分辨率控制 -an关闭音频, -r 指定帧率 -``` - -使用live555生成视频流。 - -**步骤3** 模型转换 - -下载[在线模型](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/TSM/online_models.zip) jester.onnx - -将下载好的模型放在参考设计代码根目录的“model”目录下。 - -将模型转换为om模型,在“model”目录下,运行脚本生成om模型 - -```shell -bash onnx2om1.sh -``` - -**步骤4** 程序测试 - -```shell -python3 online_infer.py -``` - -修改参数,'ip:port/jester.264'为测试视频流,其中ip为起流的机器ip地址,port为起流的机器端口地址,jester.264为测试视频jester.mp4通过ffmpeg转换后的视频。 - -```python -def video2img(): - cmd = 'ffmpeg -i \"{}\" -threads 1 -vf scale=-1:331 -q:v 0 \"{}/img_%05d.jpg\"'.format('rtsp://ip:port/jester.264', './image') - subprocess.call(cmd, shell=True, - stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) -``` -- Gitee From ba11b674371f0a92621ccbca8ca3e9e9b45a51ce Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 14 Oct 2024 01:54:00 +0000 Subject: [PATCH 020/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/TSM/README.md | 141 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 contrib/TSM/README.md diff --git a/contrib/TSM/README.md b/contrib/TSM/README.md new file mode 100644 index 000000000..cc2c0f52b --- /dev/null +++ b/contrib/TSM/README.md @@ -0,0 +1,141 @@ +# TSM视频分类参考设计 + +## 1 介绍 + +### 1.1 简介 +使用TSM模型,在MindX SDK环境下实现视频分类功能。将测试视频传入脚本进行前处理,模型推理,后处理等功能,最终得到模型推理的结果。 + +### 1.2 支持的产品 + +以昇腾Atlas310卡为主要的硬件平台 + +### 1.3 支持的版本 +环境依赖软件和版本如下表: + +| 软件名称 | 版本 | +|----------|--------| +| cmake | 3.5+ | +| mxVision | 5.0.RC3 | +| Python | 3.9 | +| torch | 1.10.0 | +| ffmpeg | 4.2.1 | + +### 1.4 软件方案介绍 + +项目主要由离线精度测试文件,在线功能测试文件,离线单视频推理性能测试文件,模型文件,测试数据集预处理文件组成。 + +### 1.5 代码目录结构与说明 + +```text +├── TSM + ├── README.md // 所有模型相关说明 + ├── model + ├── onnx2om.sh // 转om模型脚本 + ├── onnx2om1.sh // 在线模型转om模型脚本 + ├── label + ├── kinetics_val.csv // label文件 + ├── download_data + ├── k400_extractor.sh // 解压数据集脚本 + ├── offline.png // 离线推理技术实现流程 + ├── online.png // 在线推理技术实现流程 + ├── online_infer.py // 在线推理精度脚本 + ├── offline_infer.py // 离线推理精度脚本 + ├── speed.py // 离线单视频推理NPU性能脚本 + ├── speed_gpu.py // 离线单视频推理GPU性能脚本 +``` + +### 1.6技术实现流程 + +在线推理流程: + +![离线推理流程](./online.png) + +### 1.7特性及适用场景 + +在线模型: + +本案例中的在线模型适用于26中手势识别,并可以返回识别手势的名称。 + +## 2 设置环境变量 + +- 环境变量搭建 + +在运行项目前,需要设置环境变量: + +MindSDK 环境变量: + +```Shell +. ${SDK-path}/set_env.sh +``` + +CANN 环境变量: + +```Shell +. ${ascend-toolkit-path}/set_env.sh +``` + +环境变量介绍 + +SDK-path: mxVision SDK 安装路径 + +ascend-toolkit-path: CANN 安装路径。 + +下载[ffmpeg](https://github.com/FFmpeg/FFmpeg/archive/n4.2.1.tar.gz),解压进入并执行以下命令安装: + +```Shell +./configure --prefix=/usr/local/ffmpeg --enable-shared +make -j +make install +``` + +安装完毕后导入环境变量 + +```Shell +export PATH=/usr/local/ffmpeg/bin:$PATH +export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH +``` + +## 3 在线推理 + +**步骤1** 安装[视频流工具](https://gitee.com/ascend/docs-openmind/blob/master/guide/mindx/sdk/tutorials/reference_material/Live555%E7%A6%BB%E7%BA%BF%E8%A7%86%E9%A2%91%E8%BD%ACRTSP%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md) + +**步骤2** 生成视频流 + +根据提示当前只支持部分视频格式,并不支持.mp4后缀的文件,但可以通过ffmpeg转换生成[ffmpeg安装教程](https://gitee.com/ascend/docs-openmind/blob/master/guide/mindx/sdk/tutorials/reference_material/pc%E7%AB%AFffmpeg%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B.md),如下所示为MP4转换为h.264命令: + +使用ffmpeg工具将带有手势的“jester.mp4”的mp4格式视频转换生成为“jester.264”的264格式视频: + +```shell +ffmpeg -i jester.mp4 -vcodec h264 -bf 0 -g 25 -r 10 -s 1280*720 -an -f h264 jester.264 + +//-bf B帧数目控制,-g 关键帧间隔控制,-s 分辨率控制 -an关闭音频, -r 指定帧率 +``` + +使用live555生成视频流。 + +**步骤3** 模型转换 + +下载[在线模型](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/TSM/online_models.zip) jester.onnx + +将下载好的模型放在参考设计代码根目录的“model”目录下。 + +将模型转换为om模型,在“model”目录下,运行脚本生成om模型 + +```shell +bash onnx2om1.sh +``` + +**步骤4** 程序测试 + +```shell +python3 online_infer.py +``` + +修改参数,'ip:port/jester.264'为测试视频流,其中ip为起流的机器ip地址,port为起流的机器端口地址,jester.264为测试视频jester.mp4通过ffmpeg转换后的视频。 + +```python +def video2img(): + cmd = 'ffmpeg -i \"{}\" -threads 1 -vf scale=-1:331 -q:v 0 \"{}/img_%05d.jpg\"'.format('rtsp://ip:port/jester.264', './image') + subprocess.call(cmd, shell=True, + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) +``` -- Gitee From 2deb845caece73511497b7de04e631f5a47624bd Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 14 Oct 2024 02:42:01 +0000 Subject: [PATCH 021/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/CrowdCounting/CMakeLists.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/CrowdCounting/CMakeLists.txt | 34 ---------------------------- 1 file changed, 34 deletions(-) delete mode 100644 contrib/CrowdCounting/CMakeLists.txt diff --git a/contrib/CrowdCounting/CMakeLists.txt b/contrib/CrowdCounting/CMakeLists.txt deleted file mode 100644 index 00606d306..000000000 --- a/contrib/CrowdCounting/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(crowd_counting) - -include_directories(./CrowdCountPostProcess) -include_directories(./CrowdCount) -file(GLOB_RECURSE CROWDCOUNT_POSTPROCESS ${PROJECT_SOURCE_DIR}/CrowdCountPostProcess/*cpp) -file(GLOB_RECURSE CROWDCOUNT ${PROJECT_SOURCE_DIR}/CrowdCount/*cpp) -set(TARGET crowd_counting) -add_compile_options(-std=c++11 -fPIC -fstack-protector-all -g -Wl,-z,relro,-z,now,-z -pie -Wall) - -add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=mindxsdk_private) - -set(MX_SDK_HOME "$ENV{MX_SDK_HOME}") - -include_directories( - ${MX_SDK_HOME}/include - ${MX_SDK_HOME}/opensource/include - ${MX_SDK_HOME}/opensource/include/opencv4 -) - -link_directories( - ${MX_SDK_HOME}/lib - ${MX_SDK_HOME}/opensource/lib - ${MX_SDK_HOME}/lib/modelpostprocessors - ${MX_SDK_HOME}/include/MxBase/postprocess/include -) - -add_executable(${TARGET} main.cpp ${CROWDCOUNT} ${CROWDCOUNT_POSTPROCESS}) -target_link_libraries(${TARGET} - glog - mxbase - opencv_world - ) -install(TARGETS ${TARGET} RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/) -- Gitee From 3382121b1307fd7d467e4aed5e2157ec7e6d6bbd Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 14 Oct 2024 02:42:08 +0000 Subject: [PATCH 022/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/CrowdCounting/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/CrowdCounting/README.md | 107 -------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 contrib/CrowdCounting/README.md diff --git a/contrib/CrowdCounting/README.md b/contrib/CrowdCounting/README.md deleted file mode 100644 index 00ba8047d..000000000 --- a/contrib/CrowdCounting/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# C++ 基于MxBase 的人群计数图像检测样例及后处理模块开发 - -## 1 介绍 -本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行人群计数目标检测,并把可视化结果保存到本地。开发端到端人群计数-人群密度估计的参考设计,实现图像当中人计数的功能,并达到精度和性能要求。 该Sample的主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit - -### 1.1 支持的产品 - -支持昇腾310芯片 - -### 1.2 支持的版本 - -在Atlas产品环境下,通过运行命令: - -``` -npu-smi info -``` - -可以查询支持SDK的版本号 - -### 1.3 软件方案介绍 - -人群计数项目实现:输入类型是图片数据(例如jpg格式的图片),通过调用MindX SDK mxBase提供的接口,使用DVPP进行图像解码,解码后获取图像数据,然后经过图像尺寸大小变换,满足模型的输入尺寸要求;将尺寸变换后的图像数据输入人群计数模型进行推理,模型输出经过后处理后,得到人群密度估计图和人计数估计值,输出人计数的估计值。 - -整个流程需要参考Ascend的参考样例:crowd_count_picture 样例,详见以下链接:https://gitee.com/ascend/samples/tree/master/python/contrib/crowd_count_picture crowd_count_picture 样例是基于ACL实现的,本任务需要参考crowd_count_picture 样例,基于MindX SDK mxBase的接口实现。MindX SDK mxBase是对ACL接口的封装,提供了极简易用的API, 使能AI应用的开发。 - -表1.1 系统方案中各模块功能: - -| 序号 | 子系统 | 功能描述 | -| ---- | ----------------- | ------------------------------------------------------------ | -| 1 | 设备初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的初始化。 | -| 2 | 图像输入 | C++文件IO读取图像文件 | -| 3 | 图像解码/图像缩放 | 调用mxBase::DvppWrappe.DvppJpegDecode()函数完成图像解码,VpcResize()完成缩放。 | -| 4 | 模型推理 | 调用mxBase:: ModelInferenceProcessor 接口完成模型推理 | -| 5 | 后处理 | 获取模型推理输出张量BaseTensor,进行后处理。 | -| 6 | 保存结果 | 输出图像当中的人的数量,保存标记出人数的结果图像。 | -| 7 | 设备去初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的去初始化。 | - -### 1.4 代码目录结构与说明 - -本sample工程名称为 **CrowdCounting**,工程目录如下图所示: - -![image-20210813152252629](image-20210813152252629.png) - -### 1.5 技术实现流程图 - -![image-20210813154111508](image-20210813154111508.png) - -## 2 环境依赖: - -请列出环境依赖软件和版本。 - -eg:推荐系统为ubuntu 18.04或centos 7.6,环境依赖软件和版本如下表: - -| 软件名称 | 版本 | -| -------- | ------------ | -| 系统软件 | ubuntu 18.04 | - -在编译运行项目前,需要设置环境变量: - - -``` -. {cann_install_path}/ascend-toolkit/set_env.sh -. {sdk_install_path}/mxVision/set_env.sh -``` - -## 3 模型转换 - -**步骤1** - -下载原始模型权重、原始模型网络、对应的cfg文件: - -[模型及配置文件下载链接](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/CrowdCounting/model.zip) - -**步骤2** - -将上述下载得文件统一放在CrowdCounting/model文件夹下,并使用ATC模型转换工具进行模型转换,参考如下指令: - -``` -atc --input_shape="blob1:1,3,800,1408" --weight="count_person.caffe.caffemodel" --input_format=NCHW --output="count_person.caffe" --soc_version=Ascend310 --insert_op_conf=insert_op.cfg --framework=0 --model="count_person.caffe.prototxt" -``` - -得到count_person.caffe.om文件 - -## 4 编译与运行 - -**步骤1** - -cd到CrowdCounting目录下,执行如下编译命令: bash build.sh - - -**步骤2** - -下载人群计数图像,需自行在网络找图,暂支持JPG格式,任意图像分辨率。再将该下载的图片作为推理图片放入CrowdCounting目录下,执行: - -``` -./crowd_counting ./xxx.jpg -``` - -## 5 软件依赖说明 - -| 依赖软件 | 版本 | 说明 | -| -------- | ----- | ------------------------------------------------------------ | -| mxVision | 5.0.0 | 封装昇腾计算语言(AscendCL)的高级编程API,简化插件和推理应用开发。 | -| CANN | 7.0.0 | 提供昇腾计算语言(AscendCL)的高级编程API。 | - - - -- Gitee From 7c5a29d4f5e8f7816bb2512e68b3d72ab775088d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 14 Oct 2024 02:42:27 +0000 Subject: [PATCH 023/129] =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CrowdCounting/CMakeLists.txt | 41 ++++++++++++ contrib/CrowdCounting/README.md | 94 ++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 contrib/CrowdCounting/CMakeLists.txt create mode 100644 contrib/CrowdCounting/README.md diff --git a/contrib/CrowdCounting/CMakeLists.txt b/contrib/CrowdCounting/CMakeLists.txt new file mode 100644 index 000000000..11c34fd96 --- /dev/null +++ b/contrib/CrowdCounting/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.10) +project(crowd_counting) + +include_directories(./CrowdCountPostProcess) +include_directories(./CrowdCount) +file(GLOB_RECURSE CROWDCOUNT_POSTPROCESS ${PROJECT_SOURCE_DIR}/CrowdCountPostProcess/*cpp) +file(GLOB_RECURSE CROWDCOUNT ${PROJECT_SOURCE_DIR}/CrowdCount/*cpp) +set(TARGET crowd_counting) +add_compile_options(-std=c++11 -fPIC -fstack-protector-all -g -Wl,-z,relro,-z,now,-z -pie -Wall) + +add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=mindxsdk_private) + +set(MX_SDK_HOME "$ENV{MX_SDK_HOME}") + +set(cpprest_DIR ${MX_SDK_HOME}/opensource/lib/libcpprest.so) +if(EXISTS ${cpprest_DIR}) + target_link_libraries(crowd_counting cpprest) + add_definitions(-DMX_VERSION_5) +endif() + + +include_directories( + ${MX_SDK_HOME}/include + ${MX_SDK_HOME}/opensource/include + ${MX_SDK_HOME}/opensource/include/opencv4 +) + +link_directories( + ${MX_SDK_HOME}/lib + ${MX_SDK_HOME}/opensource/lib + ${MX_SDK_HOME}/lib/modelpostprocessors + ${MX_SDK_HOME}/include/MxBase/postprocess/include +) + +add_executable(${TARGET} main.cpp ${CROWDCOUNT} ${CROWDCOUNT_POSTPROCESS}) +target_link_libraries(${TARGET} + glog + mxbase + opencv_world + ) +install(TARGETS ${TARGET} RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/) diff --git a/contrib/CrowdCounting/README.md b/contrib/CrowdCounting/README.md new file mode 100644 index 000000000..a7959de12 --- /dev/null +++ b/contrib/CrowdCounting/README.md @@ -0,0 +1,94 @@ +# C++ 基于MxBase 的人群计数图像检测样例及后处理模块开发 + +## 1 介绍 + +### 1.1 简介 +本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行人群计数目标检测,并把可视化结果保存到本地。开发端到端人群计数-人群密度估计的参考设计,实现图像当中人计数的功能,并达到精度和性能要求。 该Sample的主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit + +### 1.2 支持的产品 + +支持昇腾310芯片 + +### 1.3 支持的版本 + +环境依赖软件和版本如下表: + +表1.1 系统方案中各模块功能: + +| 软件名称 | 版本 | 说明 | +| -------- | ----- | ------------------------------------------------------------ | +| mxVision | 5.0.0 | 封装昇腾计算语言(AscendCL)的高级编程API,简化插件和推理应用开发。 | +| CANN | 7.0.0 | 提供昇腾计算语言(AscendCL)的高级编程API。 | + +### 1.4 软件方案介绍 + +人群计数项目实现:输入类型是图片数据(例如jpg格式的图片),通过调用MindX SDK mxBase提供的接口,使用DVPP进行图像解码,解码后获取图像数据,然后经过图像尺寸大小变换,满足模型的输入尺寸要求;将尺寸变换后的图像数据输入人群计数模型进行推理,模型输出经过后处理后,得到人群密度估计图和人计数估计值,输出人计数的估计值。 + +整个流程需要参考Ascend的参考样例:crowd_count_picture 样例,详见以下链接:https://gitee.com/ascend/samples/tree/master/python/contrib/crowd_count_picture crowd_count_picture 样例是基于ACL实现的,本任务需要参考crowd_count_picture 样例,基于MindX SDK mxBase的接口实现。MindX SDK mxBase是对ACL接口的封装,提供了极简易用的API, 使能AI应用的开发。 + +表1.2 系统方案中各模块功能: + +| 序号 | 子系统 | 功能描述 | +| ---- | ----------------- | ------------------------------------------------------------ | +| 1 | 设备初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的初始化。 | +| 2 | 图像输入 | C++文件IO读取图像文件 | +| 3 | 图像解码/图像缩放 | 调用mxBase::DvppWrappe.DvppJpegDecode()函数完成图像解码,VpcResize()完成缩放。 | +| 4 | 模型推理 | 调用mxBase:: ModelInferenceProcessor 接口完成模型推理 | +| 5 | 后处理 | 获取模型推理输出张量BaseTensor,进行后处理。 | +| 6 | 保存结果 | 输出图像当中的人的数量,保存标记出人数的结果图像。 | +| 7 | 设备去初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的去初始化。 | + +### 1.5 代码目录结构与说明 + +本sample工程名称为 **CrowdCounting**,工程目录如下图所示: + +![image-20210813152252629](image-20210813152252629.png) + +### 1.6 技术实现流程图 + +![image-20210813154111508](image-20210813154111508.png) + +## 2 设置环境变量: + +在编译运行项目前,需要设置环境变量: + + +``` +. {cann_install_path}/ascend-toolkit/set_env.sh +. {sdk_install_path}/mxVision/set_env.sh +``` + +## 3 准备模型 + +**步骤1** + +下载原始模型权重、原始模型网络、对应的cfg文件: + +[模型及配置文件下载链接](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/CrowdCounting/model.zip) + +**步骤2** + +将上述下载得文件统一放在CrowdCounting/model文件夹下,并使用ATC模型转换工具进行模型转换,参考如下指令: + +``` +atc --input_shape="blob1:1,3,800,1408" --weight="count_person.caffe.caffemodel" --input_format=NCHW --output="count_person.caffe" --soc_version=Ascend310 --insert_op_conf=insert_op.cfg --framework=0 --model="count_person.caffe.prototxt" +``` + +得到count_person.caffe.om文件 + +## 4 编译与运行 + +**步骤1** + +cd到CrowdCounting目录下,执行如下编译命令: bash build.sh + + +**步骤2** + +下载人群计数图像,需自行在网络找图,暂支持JPG格式,任意图像分辨率。再将该下载的图片作为推理图片放入CrowdCounting目录下,执行: + +``` +./crowd_counting ./xxx.jpg +``` + + -- Gitee From 41dd195f13f1b9ffd7c3ad3c765c4834034993a6 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 14 Oct 2024 02:42:34 +0000 Subject: [PATCH 024/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/CrowdCounting/CrowdCount/CrowdCount.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CrowdCounting/CrowdCount/CrowdCount.cpp | 265 ------------------ 1 file changed, 265 deletions(-) delete mode 100644 contrib/CrowdCounting/CrowdCount/CrowdCount.cpp diff --git a/contrib/CrowdCounting/CrowdCount/CrowdCount.cpp b/contrib/CrowdCounting/CrowdCount/CrowdCount.cpp deleted file mode 100644 index ea0bb6c1f..000000000 --- a/contrib/CrowdCounting/CrowdCount/CrowdCount.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "opencv2/opencv.hpp" -#include "CrowdCount.h" -#include "MxBase/DeviceManager/DeviceManager.h" -#include "MxBase/Log/Log.h" -#include -#include -#include - -namespace{ - const uint32_t YUV_BYTE_NU = 3; - const uint32_t YUV_BYTE_DE = 2; - const uint32_t VPC_H_ALIGN = 2; - const uint32_t RESIZE_WIDTH = 1408; - const uint32_t RESIZE_HEIGHT = 800; -} -// 设置配置参数 -void CrowdCount::SetCrowdCountPostProcessConfig(const InitParam &initParam, - std::map &config) { - MxBase::ConfigData configData; - const std::string checkTensor = initParam.checkTensor ? "true" : "false"; - configData.SetJsonValue("CHECK_MODEL", checkTensor); - configData.SetJsonValue("CLASS_NUM", std::to_string(initParam.classNum)); - auto jsonStr = configData.GetCfgJson().serialize(); - config["postProcessConfigContent"] = jsonStr; -} - -APP_ERROR CrowdCount::Init(const InitParam &initParam) { - deviceId_ = initParam.deviceId; - APP_ERROR ret = MxBase::DeviceManager::GetInstance()->InitDevices(); - if (ret != APP_ERR_OK) { - LogError << "Init devices failed, ret=" << ret << "."; - return ret; - } - ret = MxBase::TensorContext::GetInstance()->SetContext(initParam.deviceId); - if (ret != APP_ERR_OK) { - LogError << "Set context failed, ret=" << ret << "."; - return ret; - } - dvppWrapper_ = std::make_shared(); - ret = dvppWrapper_->Init(); - if (ret != APP_ERR_OK) { - LogError << "DvppWrapper init failed, ret=" << ret << "."; - return ret; - } - model_ = std::make_shared(); - ret = model_->Init(initParam.modelPath, modelDesc_); - if (ret != APP_ERR_OK) { - LogError << "ModelInferenceProcessor init failed, ret=" << ret << "."; - return ret; - } - std::map config; - SetCrowdCountPostProcessConfig(initParam, config); - // 初始化CrowdCount后处理对象 - post_ = std::make_shared(); - ret = post_->Init(config); - if (ret != APP_ERR_OK) { - LogError << "CrowdCountstProcess init failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR CrowdCount::DeInit() { - dvppWrapper_->DeInit(); - model_->DeInit(); - post_->DeInit(); - MxBase::DeviceManager::GetInstance()->DestroyDevices(); - return APP_ERR_OK; -} -// 调用mxBase::DvppWrappe.DvppJpegDecode()函数完成图像解码,VpcResize()完成缩放 -APP_ERROR CrowdCount::ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor) { - MxBase::DvppDataInfo output = {}; - APP_ERROR ret = dvppWrapper_->DvppJpegDecode(imgPath, output); - if (ret != APP_ERR_OK) { - LogError << "DvppWrapper DvppJpegDecode failed, ret=" << ret << "."; - return ret; - } - // 将数据转为到DEVICE侧,以便后续处理 - MxBase::MemoryData memoryData((void*)output.data, output.dataSize, - MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - // 对解码后图像对齐尺寸进行判定 - if (output.heightStride % VPC_H_ALIGN != 0) { - LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; - MxBase::MemoryHelper::MxbsFree(memoryData); - return APP_ERR_COMM_INVALID_PARAM; - } - std::vector shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; - tensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); - return APP_ERR_OK; -} - -APP_ERROR CrowdCount::Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor){ - auto shape = inputTensor.GetShape(); - // 还原为原始尺寸 - MxBase::DvppDataInfo input = {}; - input.height = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; - input.width = shape[1]; - input.heightStride = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; - input.widthStride = shape[1]; - input.dataSize = inputTensor.GetByteSize(); - input.data = (uint8_t*)inputTensor.GetBuffer(); - MxBase::ResizeConfig resize = {}; - resize.height = RESIZE_HEIGHT; - resize.width = RESIZE_WIDTH; - MxBase::DvppDataInfo output = {}; - // 图像缩放 - APP_ERROR ret = dvppWrapper_->VpcResize(input, output, resize); - if (ret != APP_ERR_OK) { - LogError << "VpcResize failed, ret=" << ret << "."; - return ret; - } - // 对缩放后图像对齐尺寸进行判定 - MxBase::MemoryData memoryData((void*)output.data, output.dataSize, - MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - if (output.heightStride % VPC_H_ALIGN != 0) { - LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; - MxBase::MemoryHelper::MxbsFree(memoryData); - return APP_ERR_COMM_INVALID_PARAM; - } - shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; - outputTensor = MxBase::TensorBase(memoryData, false, shape,MxBase::TENSOR_DTYPE_UINT8); - return APP_ERR_OK; - -} -// 模型推理 -APP_ERROR CrowdCount::Inference(const std::vector &inputs, - std::vector &outputs) { - auto dtypes = model_->GetOutputDataType(); - for (size_t i = 0; i < modelDesc_.outputTensors.size(); ++i) { - std::vector shape = {}; - // 人群计数模型检测特征图尺寸 - for (size_t j = 0; j < modelDesc_.outputTensors[i].tensorDims.size(); ++j) { - shape.push_back((uint32_t) modelDesc_.outputTensors[i].tensorDims[j]); - } - // 用检测特征图尺寸分别为数据构建空的tensor - MxBase::TensorBase tensor(shape, dtypes[i], MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - APP_ERROR ret = MxBase::TensorBase::TensorBaseMalloc(tensor); - if (ret != APP_ERR_OK) { - LogError << "TensorBaseMalloc failed, ret=" << ret << "."; - return ret; - } - outputs.push_back(tensor); - } - // 设置类型为静态batch - MxBase::DynamicInfo dynamicInfo = {}; - dynamicInfo.dynamicType = MxBase::DynamicType::STATIC_BATCH; - auto startTime = std::chrono::high_resolution_clock::now(); - APP_ERROR ret = model_->ModelInference(inputs, outputs, dynamicInfo); - auto endTime = std::chrono::high_resolution_clock::now(); - double costMs = std::chrono::duration(endTime - startTime).count(); - g_inferCost.push_back(costMs); - if (ret != APP_ERR_OK) { - LogError << "ModelInference failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} -// 后处理 -APP_ERROR CrowdCount::PostProcess(const std::vector &inputs, - std::vector &images, std::vector &results) -{ - // 使用CrowdCountPostProcess post_; - APP_ERROR ret = post_->Process(inputs, images, results); - if (ret != APP_ERR_OK) { - LogError << "Process failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} -// 输出人群计数结果图 -APP_ERROR CrowdCount::WriteResult(const std::vector &outputs, - const std::vector &postimage, const std::vector &results, - const std::string &imgPath) { - cv::Mat mergeImage; - cv::Mat dstimgBgr; - double alpha = 1.0; - double beta = 0.5; - double gamma = 0.0; - cv::Mat imgBgr; - imgBgr = cv::imread(imgPath, cv::IMREAD_COLOR); - imageWidth_ = imgBgr.cols; - imageHeight_ = imgBgr.rows; - int number = results[0]; - std::string str; - str = std::to_string(number); - float fontScale_ = 3; - uint32_t thickness_ = 8; - auto shape = outputs[0].GetShape(); - cv::Mat heatMap = cv::Mat(shape[1], shape[2], CV_8UC3, outputs[0].GetBuffer()); - auto image = postimage[0]; - APP_ERROR ret = image.ToHost(); - if (ret != APP_ERR_OK) { - LogError << GetError(ret) << "ToHost Failed"; - return ret; - } - shape = image.GetShape(); - cv::Mat imageYuv = cv::Mat(shape[0], shape[1], CV_8UC1, image.GetBuffer()); - cv::cvtColor(imageYuv, dstimgBgr, cv::COLOR_YUV2BGR_NV12); - addWeighted(dstimgBgr, alpha, heatMap, beta, gamma, mergeImage); - // 将得到的mergeImage图片的大小还原成被测试图片的大小 - resize(mergeImage, mergeImage, cv::Size(imageWidth_, imageHeight_), 0, 0, cv::INTER_LINEAR); - // 将计算得到的result结果写在输出结果的图片上 - cv::putText(mergeImage, str, cv::Point(30, 120), - cv::FONT_HERSHEY_SIMPLEX, fontScale_, cv::Scalar(0,0,255), thickness_); - cv::imwrite("./result.jpg", mergeImage); - return APP_ERR_OK; -} - -APP_ERROR CrowdCount::Process(const std::string &imgPath) { - // read image - MxBase::TensorBase inTensor; - APP_ERROR ret = ReadImage(imgPath, inTensor); - if (ret != APP_ERR_OK) { - LogError << "ReadImage failed, ret=" << ret << "."; - return ret; - } - //do resize - MxBase::TensorBase outTensor; - ret = Resize(inTensor, outTensor); - if (ret != APP_ERR_OK) { - LogError << "Resize failed, ret=" << ret << "."; - return ret; - } - //do inference - std::vector inputs = {}; - std::vector outputs = {}; - inputs.push_back(outTensor); - ret = Inference(inputs, outputs); - if (ret != APP_ERR_OK) { - LogError << "Inference failed, ret=" << ret << "."; - return ret; - } - LogInfo << "Inference"; - //do postprocess - std::vector heatmap = {}; - std::vector results = {}; - ret = PostProcess(outputs, heatmap, results); - if (ret != APP_ERR_OK) { - LogError << "PostProcess failed, ret=" << ret << "."; - return ret; - } - //wirte result - std::vector postimage = {outTensor}; - ret = WriteResult(heatmap, postimage, results, imgPath); - if (ret != APP_ERR_OK) { - LogError << "Save result failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} -- Gitee From cf5a901227bde94a60ce0e3332759ca14d37a161 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 14 Oct 2024 02:42:51 +0000 Subject: [PATCH 025/129] =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- .../CrowdCounting/CrowdCount/CrowdCount.cpp | 270 ++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 contrib/CrowdCounting/CrowdCount/CrowdCount.cpp diff --git a/contrib/CrowdCounting/CrowdCount/CrowdCount.cpp b/contrib/CrowdCounting/CrowdCount/CrowdCount.cpp new file mode 100644 index 000000000..492f351a5 --- /dev/null +++ b/contrib/CrowdCounting/CrowdCount/CrowdCount.cpp @@ -0,0 +1,270 @@ +/* + * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "opencv2/opencv.hpp" +#include "CrowdCount.h" +#include "MxBase/DeviceManager/DeviceManager.h" +#include "MxBase/Log/Log.h" +#include +#include +#include + +namespace{ + const uint32_t YUV_BYTE_NU = 3; + const uint32_t YUV_BYTE_DE = 2; + const uint32_t VPC_H_ALIGN = 2; + const uint32_t RESIZE_WIDTH = 1408; + const uint32_t RESIZE_HEIGHT = 800; +} +// 设置配置参数 +void CrowdCount::SetCrowdCountPostProcessConfig(const InitParam &initParam, + std::map &config) { + MxBase::ConfigData configData; + const std::string checkTensor = initParam.checkTensor ? "true" : "false"; + configData.SetJsonValue("CHECK_MODEL", checkTensor); + configData.SetJsonValue("CLASS_NUM", std::to_string(initParam.classNum)); + #ifdef MX_VERSION_5 + auto jsonStr = configData.GetCfgJson().serialize(); + config["postProcessConfigContent"] = jsonStr; + #else + auto jsonStr = configData.GetCfgJson(); + config["postProcessConfigContent"] = jsonStr; + #endif +} + +APP_ERROR CrowdCount::Init(const InitParam &initParam) { + deviceId_ = initParam.deviceId; + APP_ERROR ret = MxBase::DeviceManager::GetInstance()->InitDevices(); + if (ret != APP_ERR_OK) { + LogError << "Init devices failed, ret=" << ret << "."; + return ret; + } + ret = MxBase::TensorContext::GetInstance()->SetContext(initParam.deviceId); + if (ret != APP_ERR_OK) { + LogError << "Set context failed, ret=" << ret << "."; + return ret; + } + dvppWrapper_ = std::make_shared(); + ret = dvppWrapper_->Init(); + if (ret != APP_ERR_OK) { + LogError << "DvppWrapper init failed, ret=" << ret << "."; + return ret; + } + model_ = std::make_shared(); + ret = model_->Init(initParam.modelPath, modelDesc_); + if (ret != APP_ERR_OK) { + LogError << "ModelInferenceProcessor init failed, ret=" << ret << "."; + return ret; + } + std::map config; + SetCrowdCountPostProcessConfig(initParam, config); + // 初始化CrowdCount后处理对象 + post_ = std::make_shared(); + ret = post_->Init(config); + if (ret != APP_ERR_OK) { + LogError << "CrowdCountstProcess init failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} + +APP_ERROR CrowdCount::DeInit() { + dvppWrapper_->DeInit(); + model_->DeInit(); + post_->DeInit(); + MxBase::DeviceManager::GetInstance()->DestroyDevices(); + return APP_ERR_OK; +} +// 调用mxBase::DvppWrappe.DvppJpegDecode()函数完成图像解码,VpcResize()完成缩放 +APP_ERROR CrowdCount::ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor) { + MxBase::DvppDataInfo output = {}; + APP_ERROR ret = dvppWrapper_->DvppJpegDecode(imgPath, output); + if (ret != APP_ERR_OK) { + LogError << "DvppWrapper DvppJpegDecode failed, ret=" << ret << "."; + return ret; + } + // 将数据转为到DEVICE侧,以便后续处理 + MxBase::MemoryData memoryData((void*)output.data, output.dataSize, + MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + // 对解码后图像对齐尺寸进行判定 + if (output.heightStride % VPC_H_ALIGN != 0) { + LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; + MxBase::MemoryHelper::MxbsFree(memoryData); + return APP_ERR_COMM_INVALID_PARAM; + } + std::vector shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; + tensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); + return APP_ERR_OK; +} + +APP_ERROR CrowdCount::Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor){ + auto shape = inputTensor.GetShape(); + // 还原为原始尺寸 + MxBase::DvppDataInfo input = {}; + input.height = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; + input.width = shape[1]; + input.heightStride = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; + input.widthStride = shape[1]; + input.dataSize = inputTensor.GetByteSize(); + input.data = (uint8_t*)inputTensor.GetBuffer(); + MxBase::ResizeConfig resize = {}; + resize.height = RESIZE_HEIGHT; + resize.width = RESIZE_WIDTH; + MxBase::DvppDataInfo output = {}; + // 图像缩放 + APP_ERROR ret = dvppWrapper_->VpcResize(input, output, resize); + if (ret != APP_ERR_OK) { + LogError << "VpcResize failed, ret=" << ret << "."; + return ret; + } + // 对缩放后图像对齐尺寸进行判定 + MxBase::MemoryData memoryData((void*)output.data, output.dataSize, + MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + if (output.heightStride % VPC_H_ALIGN != 0) { + LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; + MxBase::MemoryHelper::MxbsFree(memoryData); + return APP_ERR_COMM_INVALID_PARAM; + } + shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; + outputTensor = MxBase::TensorBase(memoryData, false, shape,MxBase::TENSOR_DTYPE_UINT8); + return APP_ERR_OK; + +} +// 模型推理 +APP_ERROR CrowdCount::Inference(const std::vector &inputs, + std::vector &outputs) { + auto dtypes = model_->GetOutputDataType(); + for (size_t i = 0; i < modelDesc_.outputTensors.size(); ++i) { + std::vector shape = {}; + // 人群计数模型检测特征图尺寸 + for (size_t j = 0; j < modelDesc_.outputTensors[i].tensorDims.size(); ++j) { + shape.push_back((uint32_t) modelDesc_.outputTensors[i].tensorDims[j]); + } + // 用检测特征图尺寸分别为数据构建空的tensor + MxBase::TensorBase tensor(shape, dtypes[i], MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + APP_ERROR ret = MxBase::TensorBase::TensorBaseMalloc(tensor); + if (ret != APP_ERR_OK) { + LogError << "TensorBaseMalloc failed, ret=" << ret << "."; + return ret; + } + outputs.push_back(tensor); + } + // 设置类型为静态batch + MxBase::DynamicInfo dynamicInfo = {}; + dynamicInfo.dynamicType = MxBase::DynamicType::STATIC_BATCH; + auto startTime = std::chrono::high_resolution_clock::now(); + APP_ERROR ret = model_->ModelInference(inputs, outputs, dynamicInfo); + auto endTime = std::chrono::high_resolution_clock::now(); + double costMs = std::chrono::duration(endTime - startTime).count(); + g_inferCost.push_back(costMs); + if (ret != APP_ERR_OK) { + LogError << "ModelInference failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} +// 后处理 +APP_ERROR CrowdCount::PostProcess(const std::vector &inputs, + std::vector &images, std::vector &results) +{ + // 使用CrowdCountPostProcess post_; + APP_ERROR ret = post_->Process(inputs, images, results); + if (ret != APP_ERR_OK) { + LogError << "Process failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} +// 输出人群计数结果图 +APP_ERROR CrowdCount::WriteResult(const std::vector &outputs, + const std::vector &postimage, const std::vector &results, + const std::string &imgPath) { + cv::Mat mergeImage; + cv::Mat dstimgBgr; + double alpha = 1.0; + double beta = 0.5; + double gamma = 0.0; + cv::Mat imgBgr; + imgBgr = cv::imread(imgPath, cv::IMREAD_COLOR); + imageWidth_ = imgBgr.cols; + imageHeight_ = imgBgr.rows; + int number = results[0]; + std::string str; + str = std::to_string(number); + float fontScale_ = 3; + uint32_t thickness_ = 8; + auto shape = outputs[0].GetShape(); + cv::Mat heatMap = cv::Mat(shape[1], shape[2], CV_8UC3, outputs[0].GetBuffer()); + auto image = postimage[0]; + APP_ERROR ret = image.ToHost(); + if (ret != APP_ERR_OK) { + LogError << GetError(ret) << "ToHost Failed"; + return ret; + } + shape = image.GetShape(); + cv::Mat imageYuv = cv::Mat(shape[0], shape[1], CV_8UC1, image.GetBuffer()); + cv::cvtColor(imageYuv, dstimgBgr, cv::COLOR_YUV2BGR_NV12); + addWeighted(dstimgBgr, alpha, heatMap, beta, gamma, mergeImage); + // 将得到的mergeImage图片的大小还原成被测试图片的大小 + resize(mergeImage, mergeImage, cv::Size(imageWidth_, imageHeight_), 0, 0, cv::INTER_LINEAR); + // 将计算得到的result结果写在输出结果的图片上 + cv::putText(mergeImage, str, cv::Point(30, 120), + cv::FONT_HERSHEY_SIMPLEX, fontScale_, cv::Scalar(0,0,255), thickness_); + cv::imwrite("./result.jpg", mergeImage); + return APP_ERR_OK; +} + +APP_ERROR CrowdCount::Process(const std::string &imgPath) { + // read image + MxBase::TensorBase inTensor; + APP_ERROR ret = ReadImage(imgPath, inTensor); + if (ret != APP_ERR_OK) { + LogError << "ReadImage failed, ret=" << ret << "."; + return ret; + } + //do resize + MxBase::TensorBase outTensor; + ret = Resize(inTensor, outTensor); + if (ret != APP_ERR_OK) { + LogError << "Resize failed, ret=" << ret << "."; + return ret; + } + //do inference + std::vector inputs = {}; + std::vector outputs = {}; + inputs.push_back(outTensor); + ret = Inference(inputs, outputs); + if (ret != APP_ERR_OK) { + LogError << "Inference failed, ret=" << ret << "."; + return ret; + } + LogInfo << "Inference"; + //do postprocess + std::vector heatmap = {}; + std::vector results = {}; + ret = PostProcess(outputs, heatmap, results); + if (ret != APP_ERR_OK) { + LogError << "PostProcess failed, ret=" << ret << "."; + return ret; + } + //wirte result + std::vector postimage = {outTensor}; + ret = WriteResult(heatmap, postimage, results, imgPath); + if (ret != APP_ERR_OK) { + LogError << "Save result failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} -- Gitee From 9672a14fd693e934ba865f1a912315b44bbd3b06 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 14 Oct 2024 03:13:21 +0000 Subject: [PATCH 026/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?tutorials/DvppWrapperSample/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tutorials/DvppWrapperSample/README.md | 35 --------------------------- 1 file changed, 35 deletions(-) delete mode 100644 tutorials/DvppWrapperSample/README.md diff --git a/tutorials/DvppWrapperSample/README.md b/tutorials/DvppWrapperSample/README.md deleted file mode 100644 index ce2862963..000000000 --- a/tutorials/DvppWrapperSample/README.md +++ /dev/null @@ -1,35 +0,0 @@ - -# DvppWrapper接口样例 - -## 介绍 -提供DvppWrapper接口样例,对图片实现编码,解码,缩放,抠图,以及把样例图片编码为264视频文件。 - -## 准备 -打开百度图片https://image.baidu.com/,输入任何关键字,然后搜索,右击任意图片,点击另存为。把图片保存在DvppWrapperSample目录下。 - -## 编译与运行 -**步骤1** 修改CMakeLists.txt文件 将set(MX_SDK_HOME ${SDK安装路径}) 中的${SDK安装路径}替换为实际的SDK安装路径 - -**步骤2** 设置环境变量 -ASCEND_HOME Ascend安装的路径,一般为/usr/local/Ascend -LD_LIBRARY_PATH 指定程序运行时依赖的动态库查找路径 -``` -export ASCEND_HOME=/usr/local/Ascend -export ASCEND_VERSION=nnrt/latest -export ARCH_PATTERN=. -export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib/modelpostprocessors:${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:${LD_LIBRARY_PATH} -``` - -**步骤3** cd到DvppWrapperSample目录下,执行如下编译命令: -``` -mkdir build -cd build -cmake .. -make -``` - -**步骤4** cd到DvppWrapperSample目录下,可看到可执行文件DvppWrapperSample, 实行命令: -``` -./DvppWrapperSample ./保存的图片 -``` -最后会生成缩放resize_result.jpg、抠图后保存的图片write_result_crop.jpg,以及编码保存的视频test.h264。 \ No newline at end of file -- Gitee From 88f26d7f53e5285ac6cb00ecc81ee44e4c4854fa Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 14 Oct 2024 03:13:40 +0000 Subject: [PATCH 027/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/DvppWrapperSample/README.md | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tutorials/DvppWrapperSample/README.md diff --git a/tutorials/DvppWrapperSample/README.md b/tutorials/DvppWrapperSample/README.md new file mode 100644 index 000000000..f2a780367 --- /dev/null +++ b/tutorials/DvppWrapperSample/README.md @@ -0,0 +1,34 @@ + +# DvppWrapper接口样例 + +## 1 介绍 +提供DvppWrapper接口样例,对图片实现编码,解码,缩放,抠图,以及把样例图片编码为264视频文件。 + +## 2 设置环境变量 +ASCEND_HOME Ascend安装的路径,一般为/usr/local/Ascend +LD_LIBRARY_PATH 指定程序运行时依赖的动态库查找路径 +``` +export ASCEND_HOME=/usr/local/Ascend +export ASCEND_VERSION=nnrt/latest +export ARCH_PATTERN=. +export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib/modelpostprocessors:${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:${LD_LIBRARY_PATH} +``` + +## 3 准备模型 +打开百度图片https://image.baidu.com/,输入任何关键字,然后搜索,右击任意图片,点击另存为。把图片保存在DvppWrapperSample目录下。 + +## 4 编译与运行 +**步骤1** 修改CMakeLists.txt文件 将set(MX_SDK_HOME ${SDK安装路径}) 中的${SDK安装路径}替换为实际的SDK安装路径 + +**步骤2** cd到DvppWrapperSample目录下,执行如下编译命令: +``` +mkdir build +cd build +cmake .. +make +``` +**步骤3** cd到DvppWrapperSample目录下,可看到可执行文件DvppWrapperSample, 实行命令: +``` +./DvppWrapperSample ./保存的图片 +``` +最后会生成缩放resize_result.jpg、抠图后保存的图片write_result_crop.jpg,以及编码保存的视频test.h264。 \ No newline at end of file -- Gitee From a4c7e83dbe47418864a80379d4a5e1230097957e Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Thu, 17 Oct 2024 01:34:32 +0000 Subject: [PATCH 028/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/VCOD=5FSLTNet/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/VCOD_SLTNet/README.md | 272 ---------------------------------- 1 file changed, 272 deletions(-) delete mode 100644 contrib/VCOD_SLTNet/README.md diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md deleted file mode 100644 index e7d69da0c..000000000 --- a/contrib/VCOD_SLTNet/README.md +++ /dev/null @@ -1,272 +0,0 @@ -# 视频伪装物体检测 - -## 1 介绍 - -基于 MindX SDK 实现 SLT-Net 模型的推理,在 MoCA-Mask 数据集上 Sm 达到大于 0.6。输入连续几帧伪装物体的视频序列,输出伪装物体掩膜 Mask 图。 - - -### 1.1 支持的产品 - -支持昇腾310芯片 - - -### 1.2 支持的版本 - -CANN:7.0.RC1 - -SDK:mxVision 5.0.RC3(可通过cat SDK目录下的 version.info 查看) - - -### 1.3 软件方案介绍 - - -本方案中,先通过 `torch2onnx.py` 脚本将 PyTorch 版本的伪装视频物体检测模型 SLT-Net 转换为 onnx 模型;然后通过 `inference.py` 脚本调用晟腾om模型,将输入视频帧进行图像处理,最终生成视频伪装物体的掩膜 Mask 图。 - - -### 1.4 代码目录结构与说明 - -本sample工程名称为 VCOD_SLTNet,工程目录如下图所示: - -``` -──VCOD_SLTNet - ├── flowchart.jpeg - ├── inference.py # 推理文件 - ├── torch2onnx.py # 模型转换脚本 - └── README.md -``` - - -### 1.5 技术实现流程图 - -![Flowchart](./flowchart.jpeg) - -图1 视频伪装物体检测流程图 - - -### 1.6 特性及适用场景 - -对于伪装视频数据的分割任务均适用,输入视频需要转换为图片序列输入到模型中,具体可以参考 MoCA 数据格式与目录结构(如下所示),详见 [SLT-Net](https://xueliancheng.github.io/SLT-Net-project/) 与 [MoCA 数据集主页](https://www.robots.ox.ac.uk/~vgg/data/MoCA/)。 - - -``` ---data - └── TestDataset_per_sq # 测试数据集 - ├── flower_crab_spider_1 # 不同场景 - ├── GT # Ground Truth - ├── 00000.png - ├── ..... - └── Imgs # 输入图片序列 - ├── 00000.jpg - ├── ..... - ...... - -``` - - -## 2 环境依赖 - -环境依赖软件和版本如下表: - -| 软件名称 | 版本 | -| -------- | ------ | -| MindX SDK | 5.0.RC3 | -| Python | 3.9.2 | -| CANN | 7.0RC1 | -| PyTorch | 1.12.1 | -| numpy | 1.21.5 | -| imageio | 2.22.3| -| Pillow | 9.3.0 | -| cv2 | 4.5.5 | -| timm | 0.4.12 | -| tqdm | 4.64.1 | - - -## 3. 数据准备 - -### 3.1 准备相关文件 - -1、SLT-Net代码包准备 - -点击访问 [SLT-Net](https://github.com/XuelianCheng/SLT-Net) 并下载 SLT-Net-master.zip 代码压缩包,上传服务器并解压得到“SLT-Net-master”目录及文件; - -2、SLT-Net模型文件准备 - -方法一:通过访问 [SLT-Net 模型官方链接](https://drive.google.com/file/d/1_u4dEdxM4AKuuh6EcWHAlo8EtR7e8q5v/view) 下载模型压缩包 (注意,需要访问 Google Drive ),解压后将 `Net_epoch_MoCA_short_term_pseudo.pth` 模型拷贝至 `SLT-Net-master` 目录下; - -方法二:下载 [models.zip 备份模型压缩包](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/models.zip) 并解压获得 `sltnet.pth`、`sltnet.onnx`、`sltnet.om` 三个模型文件,将 `sltnet.pth` 模型拷贝至 `SLT-Net-master` 目录下 - - -3、数据集准备 - -通过访问[MoCA官方链接](https://xueliancheng.github.io/SLT-Net-project/)下载 `MoCA_Video` 数据集,或者通过[数据集备份链接](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/MoCA_Video.zip)来下载 `MoCA_Video.zip` 数据集压缩包并解压; - - -### 3.2 模型转换 - -1、SLT-Net代码预处理 - -进入 `SLT-Net-master/lib` 目录下,对 `__init__.py`、`short_term_model.py`、`pvtv2_afterTEM.py`三个文件做以下修改: - -1)`__init__.py`文件注释如下: - -``` -from .short_term_model import VideoModel as VideoModel_pvtv2 -# from .long_term_model import VideoModel as VideoModel_long_term -``` - -注:因为长期模型依赖 CUDA,并且需要在 CUDA 平台进行编译,而本项目基于 MindX SDK 实现,因此使用短期模型。并且,短期模型的评价指标满足预期。 - - -2)修改 `short_term_model.py` 文件中,如下代码行: - -修改 - -``` -def forward(self, x): - image1, image2, image3 = x[:, :3], x[:, 3:6], x[:, 6:] # 替换之前的 image1, image2, image3 = x[0],x[1],x[2] - fmap1=self.backbone.feat_net(image1) - fmap2=self.backbone.feat_net(image2) - fmap3=self.backbone.feat_net(image3) -``` - -修改 - -``` - def __init__(self, args): - super(ImageModel, self).__init__() - self.args = args - # self.backbone = Network(pvtv2_pretrained=self.args.pvtv2_pretrained, imgsize=self.args.trainsize) - self.backbone = Network(pvtv2_pretrained=self.args.pvtv2_pretrained, imgsize=352) # 指定图片大小 - - .... - - # self.backbone = Network(pvtv2_pretrained=False, imgsize=self.args.trainsize) - self.backbone = Network(pvtv2_pretrained=False, imgsize=352) # 指定图片大小 - if self.args.pretrained_cod10k is not None: - self.load_backbone(self.args.pretrained_cod10k ) -``` - - -删除 - -``` -if self.args.pretrained_cod10k is not None: - self.load_backbone(self.args.pretrained_cod10k ) -``` - - -3)`pvtv2_afterTEM.py` 文件注释如下: - -``` -from timm.models import create_model -#from mmseg.models import build_segmentor -#from mmcv import ConfigDict -import pdb -``` - - -修改“SLT-Net-master/mypath.py”文件如下: - -``` -elif dataset == 'MoCA': - return './dataset/MoCA-Mask/' # 将此处路径修改指定为“MoCA_Video”目录的相对路径 -``` - - -可参考已经完成修改的 [SLT_Net_MindXsdk_torch](https://github.com/shuowang-ai/SLT_Net_MindXsdk_torch),也可直接使用该项目进行下面的 onnx 模型转换操作,替代以上步骤。 - - -2、模型转换 - -步骤一、pth模型转onnx模型 - -将 `VCOD_SLTNet` 代码包中的 `torch2onnx.py` 脚本拷贝至 `SLT-Net-master` 目录下,并在 `SLT-Net-master` 目录下执行以下命令将 pth 模型转换成 onnx 模型: - -``` -python torch2onnx.py --pth_path ${pth模型文件路径} --onnx_path ./sltnet.onnx -``` - -参数说明: - -pth_path:pth模型文件名称及所在路径 - -onnx_path:生成输出的onnx模型文件 - - -注意,timm 的版本为 `0.4.12`,其他版本可能有兼容性问题。 - - -步骤二、简化onnx文件(可选操作) - -``` -python -m onnxsim --input-shape="1,9,352,352" --dynamic-input-shape sltnet.onnx sltnet_sim.onnx -``` - -步骤三、onnx模型转om模型 - -``` -atc --framework=5 --model=sltnet.onnx --output=sltnet --input_shape="image:1,9,352,352" --soc_version=Ascend310 --log=error -``` - -注意: - -1. 若想使用转换好的onnx模型或om模型,可通过下载 [models.zip备份模型压缩包](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/models.zip) 解压获得转换好的 onnx 模型或 om 模型。 - -2. pth模型转onnx模型,onnx模型转om模型,均可能花费约1小时左右,视不同运行环境而定。如无报错,请耐心等待。 - - -## 4. 运行推理 - - -使用如下命令,运行 `inference.py` 脚本: - -``` -python inference.py --datapath ${MoCA_Video数据集路径} --save_root ./results/ --om_path ./sltnet.om --testsize 352 --device_id 0 -``` - -参数说明: - -datapath:下载数据以后,目录中 `TestDataset_per_sq` 的上一级目录, - -save_root:结果保存路径 - -om_path:om 模型路径 - -testsize:图片 resize 的大小,当前固定为 352 - -device_id:设备编号 - - -注意,该脚本无需放入修改的 SLT-Net 目录,在任意位置均可执行,只需设置好上述参数即可。 - - -运行输出如下: - -``` - 0%| | 0/713 [00:00 ./results/arctic_fox/Pred/00000.png - 0%|▏ | 1/713 [00:00<10:31, 1.13it/s]> ./results/arctic_fox/Pred/00005.png - 0%|▎ | 2/713 [00:01<09:01, 1.31it/s]> ./results/arctic_fox/Pred/00010.png - 0%|▍ | 3/713 [00:02<08:30, 1.39it/s]> ./results/arctic_fox/Pred/00015.png - 1%|▌ | 4/713 [00:02<08:13, 1.44it/s]> ./results/arctic_fox/Pred/00020.png -``` - -将展示剩余运行时间以及生成图片的路径。 - - -## 5. 精度评估 - -点击访问 [SLT_Net_MindXsdk_torch](https://github.com/shuowang-ai/SLT_Net_MindXsdk_torch) 并下载 `SLT_Net_MindXsdk_torch-master.zip` 代码压缩包,上传服务器并解压获得 `SLT_Net_MindXsdk_torch-master` 目录及相关文件; - -进入 `SLT_Net_MindXsdk_torch-master` 目录,修改 `eval_python/run_eval.py` 脚本中的 `gt_dir` 为本地的 `MoCA_Video/TestDataset_per_sq/` 目录的绝对路径,`pred_dir` 为预测结果目录的绝对路径,并执行以下命令进行精度评估: - -``` -python eval_python/run_eval.py -``` - -完成评估后的结果如下: - -{'Smeasure': 0.6539, 'wFmeasure': 0.3245, 'MAE': 0.0161, 'adpEm': 0.6329, 'meanEm': 0.7229, 'maxEm': 0.7554, 'adpFm': 0.3025, 'meanFm': 0.3577, 'maxFm': 0.3738} - -评测结果高于交付所要求的 Smeasure 0.6 的指标。 - -注:评估还可参考基于 基于 [MATLAB](https://github.com/XuelianCheng/SLT-Net/tree/master/eval) 的 SLT-Net 的评测代码或参考基于 Python 的 [PySODEvalToolkit](https://github.com/lartpang/PySODEvalToolkit) 的评测代码。 -- Gitee From 10e36335469b72e36cea6036ffce306ced7db69b Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Thu, 17 Oct 2024 01:34:46 +0000 Subject: [PATCH 029/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VCOD_SLTNet/README.md | 290 ++++++++++++++++++++++++++++++++++ 1 file changed, 290 insertions(+) create mode 100644 contrib/VCOD_SLTNet/README.md diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md new file mode 100644 index 000000000..8ed86814f --- /dev/null +++ b/contrib/VCOD_SLTNet/README.md @@ -0,0 +1,290 @@ +# 视频伪装物体检测 + +## 1 介绍 + +### 1.1 简介 + +基于 MindX SDK 实现 SLT-Net 模型的推理,在 MoCA-Mask 数据集上 Sm 达到大于 0.6。输入连续几帧伪装物体的视频序列,输出伪装物体掩膜 Mask 图。 + + +### 1.2 支持的产品 + +支持昇腾310芯片 + + +### 1.3 支持的版本 + +| 软件名称 | 版本 | +| -------- | ------ | +| MindX SDK | 5.0.RC3 | +| Python | 3.9.2 | +| CANN | 7.0RC1 | +| PyTorch | 1.12.1 | +| numpy | 1.21.5 | +| imageio | 2.22.3| +| Pillow | 9.3.0 | +| cv2 | 4.5.5 | +| timm | 0.4.12 | +| tqdm | 4.64.1 | +| mindspore | 2.0.0| + + +### 1.4 软件方案介绍 + + +本方案中,先通过 `torch2onnx.py` 脚本将 PyTorch 版本的伪装视频物体检测模型 SLT-Net 转换为 onnx 模型;然后通过 `inference.py` 脚本调用晟腾om模型,将输入视频帧进行图像处理,最终生成视频伪装物体的掩膜 Mask 图。 + + +### 1.5 代码目录结构与说明 + +本sample工程名称为 VCOD_SLTNet,工程目录如下图所示: + +``` +──VCOD_SLTNet + ├── flowchart.jpeg + ├── inference.py # 推理文件 + ├── torch2onnx.py # 模型转换脚本 + └── README.md +``` + + +### 1.6 技术实现流程图 + +![Flowchart](./flowchart.jpeg) + +图1 视频伪装物体检测流程图 + + +### 1.7 特性及适用场景 + +对于伪装视频数据的分割任务均适用,输入视频需要转换为图片序列输入到模型中,具体可以参考 MoCA 数据格式与目录结构(如下所示),详见 [SLT-Net](https://xueliancheng.github.io/SLT-Net-project/) 与 [MoCA 数据集主页](https://www.robots.ox.ac.uk/~vgg/data/MoCA/)。 + + +``` +--data + └── TestDataset_per_sq # 测试数据集 + ├── flower_crab_spider_1 # 不同场景 + ├── GT # Ground Truth + ├── 00000.png + ├── ..... + └── Imgs # 输入图片序列 + ├── 00000.jpg + ├── ..... + ...... + +``` + + +## 2 设置环境变量 + +在运行项目前,需要设置环境变量: + +MindSDK 环境变量: + +```Shell +. ${SDK-path}/set_env.sh +``` + +CANN 环境变量: + +```Shell +. ${ascend-toolkit-path}/set_env.sh +``` + +环境变量介绍 + +SDK-path: mxVision SDK 安装路径 + +ascend-toolkit-path: CANN 安装路径。 + + + +## 3. 数据准备 + +### 3.1 准备相关文件 + +1、SLT-Net代码包准备 + +点击访问 [SLT-Net](https://github.com/XuelianCheng/SLT-Net) 并下载 SLT-Net-master.zip 代码压缩包,上传服务器并解压得到“SLT-Net-master”目录及文件; + +2、SLT-Net模型文件准备 + +方法一:通过访问 [SLT-Net 模型官方链接](https://drive.google.com/file/d/1_u4dEdxM4AKuuh6EcWHAlo8EtR7e8q5v/view) 下载模型压缩包 (注意,需要访问 Google Drive ),解压后将 `Net_epoch_MoCA_short_term_pseudo.pth` 模型拷贝至 `SLT-Net-master` 目录下; + +方法二:下载 [models.zip 备份模型压缩包](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/models.zip) 并解压获得 `sltnet.pth`、`sltnet.onnx`、`sltnet.om` 三个模型文件,将 `sltnet.pth` 模型拷贝至 `SLT-Net-master` 目录下 + + +3、数据集准备 + +通过访问[MoCA官方链接](https://xueliancheng.github.io/SLT-Net-project/)下载 `MoCA_Video` 数据集,或者通过[数据集备份链接](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/MoCA_Video.zip)来下载 `MoCA_Video.zip` 数据集压缩包并解压; + + +### 3.2 模型转换 + +1、SLT-Net代码预处理 + +进入 `SLT-Net-master/lib` 目录下,对 `__init__.py`、`short_term_model.py`、`pvtv2_afterTEM.py`三个文件做以下修改: + +1)`__init__.py`文件注释如下: + +``` +from .short_term_model import VideoModel as VideoModel_pvtv2 +# from .long_term_model import VideoModel as VideoModel_long_term +``` + +注:因为长期模型依赖 CUDA,并且需要在 CUDA 平台进行编译,而本项目基于 MindX SDK 实现,因此使用短期模型。并且,短期模型的评价指标满足预期。 + + +2)修改 `short_term_model.py` 文件中,如下代码行: + +修改 + +``` +def forward(self, x): + image1, image2, image3 = x[:, :3], x[:, 3:6], x[:, 6:] # 替换之前的 image1, image2, image3 = x[0],x[1],x[2] + fmap1=self.backbone.feat_net(image1) + fmap2=self.backbone.feat_net(image2) + fmap3=self.backbone.feat_net(image3) +``` + +修改 + +``` + def __init__(self, args): + super(ImageModel, self).__init__() + self.args = args + # self.backbone = Network(pvtv2_pretrained=self.args.pvtv2_pretrained, imgsize=self.args.trainsize) + self.backbone = Network(pvtv2_pretrained=self.args.pvtv2_pretrained, imgsize=352) # 指定图片大小 + + .... + + # self.backbone = Network(pvtv2_pretrained=False, imgsize=self.args.trainsize) + self.backbone = Network(pvtv2_pretrained=False, imgsize=352) # 指定图片大小 + if self.args.pretrained_cod10k is not None: + self.load_backbone(self.args.pretrained_cod10k ) +``` + + +删除 + +``` +if self.args.pretrained_cod10k is not None: + self.load_backbone(self.args.pretrained_cod10k ) +``` + + +3)`pvtv2_afterTEM.py` 文件注释如下: + +``` +from timm.models import create_model +#from mmseg.models import build_segmentor +#from mmcv import ConfigDict +import pdb +``` + + +修改“SLT-Net-master/mypath.py”文件如下: + +``` +elif dataset == 'MoCA': + return './dataset/MoCA-Mask/' # 将此处路径修改指定为“MoCA_Video”目录的相对路径 +``` + + +可参考已经完成修改的 [SLT_Net_MindXsdk_torch](https://github.com/shuowang-ai/SLT_Net_MindXsdk_torch),也可直接使用该项目进行下面的 onnx 模型转换操作,替代以上步骤。 + + +2、模型转换 + +步骤一、pth模型转onnx模型 + +将 `VCOD_SLTNet` 代码包中的 `torch2onnx.py` 脚本拷贝至 `SLT-Net-master` 目录下,并在 `SLT-Net-master` 目录下执行以下命令将 pth 模型转换成 onnx 模型: + +``` +python torch2onnx.py --pth_path ${pth模型文件路径} --onnx_path ./sltnet.onnx +``` + +参数说明: + +pth_path:pth模型文件名称及所在路径 + +onnx_path:生成输出的onnx模型文件 + + +注意,timm 的版本为 `0.4.12`,其他版本可能有兼容性问题。 + + +步骤二、简化onnx文件(可选操作) + +``` +python -m onnxsim --input-shape="1,9,352,352" --dynamic-input-shape sltnet.onnx sltnet_sim.onnx +``` + +步骤三、onnx模型转om模型 + +``` +atc --framework=5 --model=sltnet.onnx --output=sltnet --input_shape="image:1,9,352,352" --soc_version=Ascend310 --log=error +``` + +注意: + +1. 若想使用转换好的onnx模型或om模型,可通过下载 [models.zip备份模型压缩包](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/models.zip) 解压获得转换好的 onnx 模型或 om 模型。 + +2. pth模型转onnx模型,onnx模型转om模型,均可能花费约1小时左右,视不同运行环境而定。如无报错,请耐心等待。 + + +## 4. 运行推理 + + +使用如下命令,运行 `inference.py` 脚本: + +``` +python inference.py --datapath ${MoCA_Video数据集路径} --save_root ./results/ --om_path ./sltnet.om --testsize 352 --device_id 0 +``` + +参数说明: + +datapath:下载数据以后,目录中 `TestDataset_per_sq` 的上一级目录, + +save_root:结果保存路径 + +om_path:om 模型路径 + +testsize:图片 resize 的大小,当前固定为 352 + +device_id:设备编号 + + +注意,该脚本无需放入修改的 SLT-Net 目录,在任意位置均可执行,只需设置好上述参数即可。 + + +运行输出如下: + +``` + 0%| | 0/713 [00:00 ./results/arctic_fox/Pred/00000.png + 0%|▏ | 1/713 [00:00<10:31, 1.13it/s]> ./results/arctic_fox/Pred/00005.png + 0%|▎ | 2/713 [00:01<09:01, 1.31it/s]> ./results/arctic_fox/Pred/00010.png + 0%|▍ | 3/713 [00:02<08:30, 1.39it/s]> ./results/arctic_fox/Pred/00015.png + 1%|▌ | 4/713 [00:02<08:13, 1.44it/s]> ./results/arctic_fox/Pred/00020.png +``` + +将展示剩余运行时间以及生成图片的路径。 + + +## 5. 精度评估 + +点击访问 [SLT_Net_MindXsdk_torch](https://github.com/shuowang-ai/SLT_Net_MindXsdk_torch) 并下载 `SLT_Net_MindXsdk_torch-master.zip` 代码压缩包,上传服务器并解压获得 `SLT_Net_MindXsdk_torch-master` 目录及相关文件; + +进入 `SLT_Net_MindXsdk_torch-master` 目录,修改 `eval_python/run_eval.py` 脚本中的 `gt_dir` 为本地的 `MoCA_Video/TestDataset_per_sq/` 目录的绝对路径,`pred_dir` 为预测结果目录的绝对路径,并执行以下命令进行精度评估: + +``` +python eval_python/run_eval.py +``` + +完成评估后的结果如下: + +{'Smeasure': 0.6539, 'wFmeasure': 0.3245, 'MAE': 0.0161, 'adpEm': 0.6329, 'meanEm': 0.7229, 'maxEm': 0.7554, 'adpFm': 0.3025, 'meanFm': 0.3577, 'maxFm': 0.3738} + +评测结果高于交付所要求的 Smeasure 0.6 的指标。 + +注:评估还可参考基于 基于 [MATLAB](https://github.com/XuelianCheng/SLT-Net/tree/master/eval) 的 SLT-Net 的评测代码或参考基于 Python 的 [PySODEvalToolkit](https://github.com/lartpang/PySODEvalToolkit) 的评测代码。 -- Gitee From f0d421ff36501301437bfd4a7392db8fc4ce142b Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Thu, 17 Oct 2024 06:47:17 +0000 Subject: [PATCH 030/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/CamouflagedObjectDetection/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/CamouflagedObjectDetection/README.md | 194 ------------------- 1 file changed, 194 deletions(-) delete mode 100644 contrib/CamouflagedObjectDetection/README.md diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md deleted file mode 100644 index a5a99f56a..000000000 --- a/contrib/CamouflagedObjectDetection/README.md +++ /dev/null @@ -1,194 +0,0 @@ -# MindX SDK -- 伪装目标分割参考设计案例 - -## 1 案例概述 - -### 1.1 概要描述 - -在本系统中,目的是基于MindX SDK,在华为云昇腾平台上,开发端到端**伪装目标分割**的参考设计,实现**对图像中的伪装目标进行识别检测**的功能,达到功能要求 - -### 1.2 模型介绍 - -本项目主要基于用于通用伪装目标分割任务的DGNet模型 - -- 模型的具体描述和细节可以参考原文:https://arxiv.org/abs/2205.12853 - -- 具体实现细节可以参考基于PyTorch深度学习框架的代码:https://github.com/GewelsJI/DGNet/tree/main/lib_pytorch - -- 所使用的公开数据集是NC4K,可以在此处下载:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/data.tar - -- 所使用的模型是EfficientNet-B4版本的DGNet模型,原始的PyTorch模型文件可以在此处下载:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/DGNet.zip - -### 1.3 实现流程 - -- 基础环境:Ascend 310、mxVision、Ascend-CANN-toolkit、Ascend Driver -- 模型转换:将ONNX模型(.onnx)转换为昇腾离线模型(.om) -- 昇腾离线模型推理流程代码开发 - -### 1.4 代码地址 - -本项目的代码地址为:https://gitee.com/ascend/mindxsdk-referenceapps/tree/master/contrib/CamouflagedObjectDetection - -### 1.5 特性及适用场景 - -本项目适用于自然场景下图片完整清晰、无模糊鬼影的场景,并且建议输入图片为JPEG编码格式,大小不超过10M。 - -**注意:由于模型限制,本项目暂只支持自然场景下伪装动物的检测,不能用于其他用途** - -## 2 软件方案介绍 - -### 2.1 项目方案架构介绍 - -本系统设计了不同的功能模块。主要流程为:图片传入流中,利用DGNet检测模型检测伪装目标,将检测出的伪装目标以逐像素概率图的形式输出,各模块功能描述如表2.1所示: - -表2.1 系统方案中各模块功能: - -| 序号 | 子系统 | 功能描述 | -| :------------ | :---------- | :---------- | -| 1 | 图像输入 | 调用cv2中的图片加载函数,用于加载输入图片| -| 2 | 图像前处理 | 将输入图片放缩到352*352大小,并执行归一化操作 | -| 3 | 伪装目标检测 | 利用DGNet检测模型,检测出图片中的伪装目标| -| 4 | 数据分发 | 将DGNet模型检测到的逐像素概率图进行数据分发到下个插件| -| 5 | 结果输出 | 将伪装目标概率预测图结果进行输出并保存| - -### 2.2 代码目录结构与说明 - -本工程名称为DGNet,工程目录如下列表所示: - -``` -./ -├── assets # 文件 -│ ├── 74.jpg -│ └── 74.png -├── data # 数据集存放路径 -│ └── NC4K -├── inference_om.py # 昇腾离线模型推理python脚本文件 -├── README.md # 本文件 -├── seg_results_om -│ ├── Exp-DGNet-OM # 预测结果图存放路径 -├── snapshots -│ ├── DGNet # 模型文件存放路径 -``` - -## 3 开发准备 - -### 3.1 环境依赖说明 - -环境依赖软件和版本如下表: - -| 软件名称 | 版本 | -| :-----------: | :---------: | -| ubantu | 18.04.1 LTS | -| MindX SDK | 2.0.4 | -| Python | 3.9.2 | -| CANN | 5.0.4 | -| numpy | 1.21.2 | -| opencv-python | 4.5.3.56 | -| mindspore (cpu) | 1.9.0 | - -### 3.2 环境搭建 - -在编译运行项目前,需要设置环境变量 - -```bash -# MindXSDK 环境变量: -. ${SDK-path}/set_env.sh - -# CANN 环境变量: -. ${ascend-toolkit-path}/set_env.sh - -# 环境变量介绍 -SDK-path: SDK mxVision 安装路径 -ascend-toolkit-path: CANN 安装路径 -``` - -### 3.3 模型转换 - -**步骤1** 下载DGNet (Efficient-B4) 的ONNX模型:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/DGNet.zip - -**步骤2** 将下载获取到的DGNet模型onxx文件存放至`./snapshots/DGNet/DGNet.onnx`。 - -**步骤3** 模型转换具体步骤 - -```bash -# 进入对应目录 -cd ./snapshots/DGNet/ -# 执行以下命令将ONNX模型(.onnx)转换为昇腾离线模型(.om) -atc --framework=5 --model=DGNet.onnx --output=DGNet --input_shape="image:1,3,352,352" --log=debug --soc_version=Ascend310 -``` - -执行完模型转换脚本后,会在对应目录中获取到如下转化模型:DGNet.om(本项目中在Ascend平台上所使用的离线模型文件)。 - -## 4 推理与评测 - -示例步骤如下: - -**步骤0** - -参考1.2节中说明下载一份测试数据集合:下载链接:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/data.tar - -**步骤1** - -执行离线推理Python脚本 - -```bash -python inference_om.py --om_path ./snapshots/DGNet/DGNet.om --save_path ./seg_results_om/Exp-DGNet-OM/NC4K/ --data_path ./data/NC4K/Imgs -``` - -**步骤2** - -- 定量性能验证: - -使用原始GitHub仓库中提供的标准评测代码进行测评,具体操作步骤如下: - -```bash -# 拉取原始仓库 -git clone https://github.com/GewelsJI/DGNet.git - -# 将如下两个文件夹放入当前 -mv ./DGNet/lib_ascend/eval ./contrib/CamouflagedObjectDetection/ -mv ./DGNet/lib_ascend/evaluation.py ./contrib/CamouflagedObjectDetection/ - -# 运行如下命令进行测评 -python evaluation.py -``` - -然后可以生成评测指标数值表格。可以看出DGNet模型的Smeasure指标数值为0.856,已经超过了项目交付中提到的“大于0.84”的要求。 - -```text -+---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ -| Dataset | Method | Smeasure | wFmeasure | MAE | adpEm | meanEm | maxEm | adpFm | meanFm | maxFm | -+---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ -| NC4K | Exp-DGNet-OM | 0.856 | 0.782 | 0.043 | 0.909 | 0.91 | 0.921 | 0.8 | 0.812 | 0.833 | -+---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ -``` - -- 定性性能验证: - -输入伪装图片:![](./assets/74.jpg) -预测分割结果:![](./assets/74.png) - -## 5 参考引用 - -主要参考为如下三篇论文: - - @article{ji2022gradient, - title={Deep Gradient Learning for Efficient Camouflaged Object Detection}, - author={Ji, Ge-Peng and Fan, Deng-Ping and Chou, Yu-Cheng and Dai, Dengxin and Liniger, Alexander and Van Gool, Luc}, - journal={Machine Intelligence Research}, - year={2023} - } - - @article{fan2021concealed, - title={Concealed Object Detection}, - author={Fan, Deng-Ping and Ji, Ge-Peng and Cheng, Ming-Ming and Shao, Ling}, - journal={IEEE TPAMI}, - year={2022} - } - - @inproceedings{fan2020camouflaged, - title={Camouflaged object detection}, - author={Fan, Deng-Ping and Ji, Ge-Peng and Sun, Guolei and Cheng, Ming-Ming and Shen, Jianbing and Shao, Ling}, - booktitle={IEEE CVPR}, - pages={2777--2787}, - year={2020} - } -- Gitee From 3ecfff5bc26420242a3eff77b36fab35779288ec Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Thu, 17 Oct 2024 06:47:29 +0000 Subject: [PATCH 031/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CamouflagedObjectDetection/README.md | 126 +++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 contrib/CamouflagedObjectDetection/README.md diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md new file mode 100644 index 000000000..f6cb45f66 --- /dev/null +++ b/contrib/CamouflagedObjectDetection/README.md @@ -0,0 +1,126 @@ +# MindX SDK -- 伪装目标分割参考设计案例 + +## 1 介绍 + +### 1.1 简介 + +在本系统中,目的是基于MindX SDK,在华为云昇腾平台上,开发端到端**伪装目标分割**的参考设计,实现**对图像中的伪装目标进行识别检测**的功能,达到功能要求 + +### 1.2 支持的产品 + +昇腾Atlas310 + +### 1.3 支持的版本 + +环境依赖软件和版本如下表: + +| 软件名称 | 版本 | +| :-----------: | :---------: | +| MindX SDK | 2.0.4 | +| Python | 3.9.2 | +| CANN | 5.0.4 | +| numpy | 1.21.2 | +| opencv-python | 4.5.3.56 | +| mindspore (cpu) | 1.9.0 | + +### 1.4 代码目录结构与说明 + +本工程名称为DGNet,工程目录如下列表所示: + +``` +./ +├── assets # 文件 +│ ├── 74.jpg +│ └── 74.png +├── data # 数据集存放路径 +│ └── NC4K +├── inference_om.py # 昇腾离线模型推理python脚本文件 +├── README.md # 本文件 +├── seg_results_om +│ ├── Exp-DGNet-OM # 预测结果图存放路径 +├── snapshots +│ ├── DGNet # 模型文件存放路径 +``` + +## 2 设置环境变量 + +在编译运行项目前,需要设置环境变量 + +```bash +# MindXSDK 环境变量: +. ${SDK-path}/set_env.sh + +# CANN 环境变量: +. ${ascend-toolkit-path}/set_env.sh + +# 环境变量介绍 +SDK-path: SDK mxVision 安装路径 +ascend-toolkit-path: CANN 安装路径 +``` + + +## 3 准备模型 + +### 模型转换 + +**步骤1** 下载DGNet (Efficient-B4) 的ONNX模型:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/DGNet.zip + +**步骤2** 将下载获取到的DGNet模型onxx文件存放至`./snapshots/DGNet/DGNet.onnx`。 + +**步骤3** 模型转换具体步骤 + +```bash +# 进入对应目录 +cd ./snapshots/DGNet/ +# 执行以下命令将ONNX模型(.onnx)转换为昇腾离线模型(.om) +atc --framework=5 --model=DGNet.onnx --output=DGNet --input_shape="image:1,3,352,352" --log=debug --soc_version=Ascend310 +``` +执行完模型转换脚本后,会在对应目录中获取到如下转化模型:DGNet.om(本项目中在Ascend平台上所使用的离线模型文件)。 + +## 4 编译与运行 +示例步骤如下: + +**步骤0** + +下载一份测试数据集合:下载链接:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/data.tar + +**步骤1** + +执行离线推理Python脚本 + +```bash +python inference_om.py --om_path ./snapshots/DGNet/DGNet.om --save_path ./seg_results_om/Exp-DGNet-OM/NC4K/ --data_path ./data/NC4K/Imgs +``` + +**步骤2** + +- 定量性能验证: + +使用原始GitHub仓库中提供的标准评测代码进行测评,具体操作步骤如下: + +```bash +# 拉取原始仓库 +git clone https://github.com/GewelsJI/DGNet.git + +# 将如下两个文件夹放入当前 +mv ./DGNet/lib_ascend/eval ./contrib/CamouflagedObjectDetection/ +mv ./DGNet/lib_ascend/evaluation.py ./contrib/CamouflagedObjectDetection/ + +# 运行如下命令进行测评 +python evaluation.py +``` + +然后可以生成评测指标数值表格。可以看出DGNet模型的Smeasure指标数值为0.856,已经超过了项目交付中提到的“大于0.84”的要求。 + +```text ++---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ +| Dataset | Method | Smeasure | wFmeasure | MAE | adpEm | meanEm | maxEm | adpFm | meanFm | maxFm | ++---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ +| NC4K | Exp-DGNet-OM | 0.856 | 0.782 | 0.043 | 0.909 | 0.91 | 0.921 | 0.8 | 0.812 | 0.833 | ++---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ +``` + +- 定性性能验证: + +输入伪装图片:![](./assets/74.jpg) +预测分割结果:![](./assets/74.png) \ No newline at end of file -- Gitee From 65390a80ffc0280865264a341385d6f6cd872c52 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Thu, 17 Oct 2024 06:48:13 +0000 Subject: [PATCH 032/129] update contrib/CamouflagedObjectDetection/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CamouflagedObjectDetection/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md index f6cb45f66..dca79fabd 100644 --- a/contrib/CamouflagedObjectDetection/README.md +++ b/contrib/CamouflagedObjectDetection/README.md @@ -4,7 +4,7 @@ ### 1.1 简介 -在本系统中,目的是基于MindX SDK,在华为云昇腾平台上,开发端到端**伪装目标分割**的参考设计,实现**对图像中的伪装目标进行识别检测**的功能,达到功能要求 +在本系统中,目的是基于MindX SDK,在华为云昇腾平台上,开发端到端**伪装目标分割**的参考设计,实现**对图像中的伪装目标进行识别检测**的功能,达到功能要求。 ### 1.2 支持的产品 -- Gitee From 91e52d7423492eed5792825bfc3ae5c990aca53c Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 02:16:30 +0000 Subject: [PATCH 033/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/IAT/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/IAT/README.md | 237 ------------------------------------------ 1 file changed, 237 deletions(-) delete mode 100644 contrib/IAT/README.md diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md deleted file mode 100644 index efb46e807..000000000 --- a/contrib/IAT/README.md +++ /dev/null @@ -1,237 +0,0 @@ -# MindX SDK -- RGB图像的夜间增强参考设计 - -## 1 介绍 -基于 MindX SDK 实现 IAT 模型的推理,在 LOL 数据集上达到 $PSNR\ge$23, $SSIM\ge 0.8$, 并把可视化结果保存到本地,达到预期的功能和精度要求。 - -### 1.1 支持的产品 - -支持昇腾310芯片 - -### 1.2 支持的版本 - -支持的SDK版本,列出版本号查询方式。 - -eg:版本号查询方法,在Atlas产品环境下,运行命令: - -``` -npu-smi info -``` - -版本号为Mind SDK 3.0RC3 - -### 1.3 软件方案介绍 - -本方案中,将 PyTorch 版本的低光图像增强模型 [IAT](https://github.com/cuiziteng/illumination-adaptive-transformer),转化为昇腾的om模型。对于输入的夜间低照度图像,通过调用昇腾om模型进行处理,最终生成经过低光增强后的图像。 - - - -### 1.4 代码目录结构与说明 - -eg:本sample工程名称为XXX,工程目录如下图所示: - -``` -├── images # README图片文件夹 -├── data # 推理图片文件夹 - ├──.keepme -├── models # 模型文件夹 - ├──.keepme -├── main.py # 推理文件 -├── pth2onnx.py # 模型转换文件 -└── README.md - -``` - -### 1.5 技术实现流程图 - -![技术实现流程图](images/技术路线.jpeg) - -### 1.6 特性及适用场景 - -对于夜间图像、低照度图像的增强均使用 - - - -## 2 环境依赖 - -请列出环境依赖软件和版本。 - -eg:推荐系统为ubuntu 18.04或centos 7.6,环境依赖软件和版本如下表: - -| 软件名称 | 版本 | -| ------------- | ---------------- | -| ubuntu | 18.04.1 LTS | -| MindX SDK | mxVision-3.0.RC3 | -| Python | 3.9.2 | -| CANN | 5.1.RC2.alpha008 | -| numpy | 1.22.3 | -| opencv-python | 4.5.5 | -| onnxsim | 0.4.10 | - -在编译运行项目前,需要设置环境变量: - -- 环境变量介绍 - -``` -列出具体执行命令(简化) -. ${sdk_path}/set_env.sh -. ${ascend_toolkit_path}/set_env.sh -``` - - - -## 3 编译与运行 -### 3.1 推理示例代码 - -**步骤1** (下载原模型代码) - -- 下载 PyTorch 版本 [IAT代码](https://github.com/cuiziteng/illumination-adaptive-transformer) - -- 根据原模型目录下的README.md文件配置原模型环境,具体代码如下: - - ``` - $ conda create -n IAT python==3.7.0 - $ conda activate IAT - $ conda install --yes -c pytorch pytorch=1.7.1 torchvision cudatoolkit=11.0 - $ pip install timm matplotlib IQA_pytorch tqdm - ``` - - -**步骤2** (配置项目环境) - -退出原模型环境,根据第2节环境依赖所述安装相应的项目环境,并设置环境变量。 - -``` -source ${sdk_path}/set_env.sh -source ${ascend_toolkit_path}/set_env.sh -``` - -**步骤3** (执行编译的步骤) - -​ 1.pytorch 模型转换 onnx 文件 - -​ 将 `pth2onnx.py` 放到 Illumination-Adaptive_Transformer/IAT_enhance/项目目录下,并切换到原模型环境,运行: - -``` -python pth2onnx.py -``` - -​ 在该目录下会生成名为IAT_lol.onnx的onnx模型文件 - -​ 2.简化 onnx 文件 - -​ 在上述目录下继续运行: - -``` -onnxsim IAT_lol.onnx IAT_lol-sim.onnx -``` - -​ 会在路径下生成简化后的IAT_lol-sim.onnx模型文件 - -​ 已经简化好的onnx模型可供参考:[IAT_lol-sim.onnx](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/IAT/IAT_lol-sim.onnx) - -​ 3.onnx 文件转换 om 文件 - -​ 将环境从原模型环境切换到当前项目环境,然后运行: - -``` -atc --framework=5 --model=./IAT_lol-sim.onnx --input_shape="input_1:1,3,400,600" --output=IAT_lol-sim --soc_version=Ascend310 -``` - -**步骤4** (运行及输出结果) - -将要推理的图片放到本项目./data/文件夹下, 并将其改为test.png, 将.om模型放到./models/文件夹下, 命名为iatsim.om。运行: - -``` -python main.py -``` - -即可在./data/目录下得到推理后的结果. - - - -## * 4 指标验证 - -### 4.1 模型规模测试 - -模型计算量测试需要利用python相关的模型测试工具 fvcore, 在原模型环境中可以使用以下命令进行安装: - -``` -pip install fvcore -``` - -利用fvcore的相关工具即可测得IAT模型的计算量,测试方法代码如下: - -```python -def evaluate_net(): - from model.IAT_main import IAT - from fvcore.nn import FlopCountAnalysis - - # 创建IAT网络 - model = IAT() - model = model.cuda() - # 创建输入网络的tensor - tensor = torch.rand(1, 3, 400, 600).cuda() - - # 分析FLOPs - flops = FlopCountAnalysis(model, tensor) - print("FLOPs: ", flops.total()) -``` - -测试结果如下: - -![模型计算量](images/模型规模测试.jpeg) - -根据[IAT论文](https://github.com/cuiziteng/illumination-adaptive-transformer)所述,该模型参数量约为90K,通过测试得到计算量约为6.019GFLOPs。 - - - -### 4.2 精度测试 - -**步骤1-3** 与3.1节一致 - -**步骤4** (获取LOL数据集) - -- 下载[LOLv1数据集](https://daooshee.github.io/BMVC2018website/) - -- 将数据集解压后将测试集目录(eval15)放到本项目./data/文件夹下,如下图所示: - - ``` - ├── data - ├──eval15 # 精度测试数据集 - ├──high - ├──low - ``` - -**步骤5** (修改主函数并运行) - -切换到项目环境下,将main.py中的主函数改为调用test_precision(),运行: - -``` -python main.py -``` - -即可得到精度测试结果,测试结果如下: - -![模型计算量](images/精度测试.jpeg) - - - -## 5 参考文献 - -@misc{https://doi.org/10.48550/arxiv.2205.14871, - doi = {10.48550/ARXIV.2205.14871}, - - url = {https://arxiv.org/abs/2205.14871}, - - author = {Cui, Ziteng and Li, Kunchang and Gu, Lin and Su, Shenghan and Gao, Peng and Jiang, Zhengkai and Qiao, Yu and Harada, Tatsuya}, - - keywords = {Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences}, - - title = {You Only Need 90K Parameters to Adapt Light: A Light Weight Transformer for Image Enhancement and Exposure Correction}, - - publisher = {arXiv}, - - year = {2022}, - - copyright = {Creative Commons Attribution 4.0 International} -} \ No newline at end of file -- Gitee From 691c40d407b345bd8aa23e2a41ddc1537db51b31 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 02:16:43 +0000 Subject: [PATCH 034/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/IAT/README.md | 121 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 contrib/IAT/README.md diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md new file mode 100644 index 000000000..1f652e8f8 --- /dev/null +++ b/contrib/IAT/README.md @@ -0,0 +1,121 @@ +# MindX SDK -- RGB图像的夜间增强参考设计 + +## 1 介绍 + +### 1.1 简介 +基于 MindX SDK 实现 IAT 模型的推理,把可视化结果保存到本地,达到预期的功能和精度要求。 + +### 1.2 支持的产品 + +支持昇腾310芯片 + +### 1.3 支持的版本 + +| 名称 | 版本 | +| ------------- | ---------------- | +| MindX SDK | mxVision-3.0.RC3 | +| Python | 3.9.2 | +| CANN | 5.1.RC2.alpha008 | +| numpy | 1.22.3 | +| opencv-python | 4.5.5 | +| onnxsim | 0.4.10 | + + +### 1.4 代码目录结构与说明 + +eg:本sample工程名称为XXX,工程目录如下图所示: + +``` +├── images # README图片文件夹 +├── data # 推理图片文件夹 + ├──.keepme +├── models # 模型文件夹 + ├──.keepme +├── main.py # 推理文件 +├── pth2onnx.py # 模型转换文件 +└── README.md + +``` + +## 2 设置环境变量 + +在编译运行项目前,需要设置环境变量: + +- 环境变量介绍 + +``` +列出具体执行命令(简化) +. ${sdk_path}/set_env.sh +. ${ascend_toolkit_path}/set_env.sh +``` + + +## 3 编译与运行 +### 3.1 推理示例代码 + +**步骤1** (下载原模型代码) + +- 下载 PyTorch 版本 [IAT代码](https://github.com/cuiziteng/illumination-adaptive-transformer) + +- 根据原模型目录下的README.md文件配置原模型环境,具体代码如下: + + ``` + $ conda create -n IAT python==3.7.0 + $ conda activate IAT + $ conda install --yes -c pytorch pytorch=1.7.1 torchvision cudatoolkit=11.0 + $ pip install timm matplotlib IQA_pytorch tqdm + ``` + + +**步骤2** (配置项目环境) + +退出原模型环境,根据第2节环境依赖所述安装相应的项目环境,并设置环境变量。 + +``` +source ${sdk_path}/set_env.sh +source ${ascend_toolkit_path}/set_env.sh +``` + +**步骤3** (执行编译的步骤) + +​ 1.pytorch 模型转换 onnx 文件 + +​ 将 `pth2onnx.py` 放到 Illumination-Adaptive_Transformer/IAT_enhance/项目目录下,并切换到原模型环境,运行: + +``` +python pth2onnx.py +``` + +​ 在该目录下会生成名为IAT_lol.onnx的onnx模型文件 + +​ 2.简化 onnx 文件 + +​ 在上述目录下继续运行: + +``` +onnxsim IAT_lol.onnx IAT_lol-sim.onnx +``` + +​ 会在路径下生成简化后的IAT_lol-sim.onnx模型文件 + +​ 已经简化好的onnx模型可供参考:[IAT_lol-sim.onnx](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/IAT/IAT_lol-sim.onnx) + +​ 3.onnx 文件转换 om 文件 + +​ 将环境从原模型环境切换到当前项目环境,然后运行: + +``` +atc --framework=5 --model=./IAT_lol-sim.onnx --input_shape="input_1:1,3,400,600" --output=IAT_lol-sim --soc_version=Ascend310 +``` + +**步骤4** (运行及输出结果) + +将要推理的图片放到本项目./data/文件夹下, 并将其改为test.png, 将.om模型放到./models/文件夹下, 命名为iatsim.om。运行: + +``` +python main.py +``` + +即可在./data/目录下得到推理后的结果. + + -- Gitee From d64bc3187a32428e36f98a6fd82b895879a77eae Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:48:36 +0000 Subject: [PATCH 035/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/BertTextClassification/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/BertTextClassification/README.md | 223 ----------------------- 1 file changed, 223 deletions(-) delete mode 100644 contrib/BertTextClassification/README.md diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md deleted file mode 100644 index 119c12544..000000000 --- a/contrib/BertTextClassification/README.md +++ /dev/null @@ -1,223 +0,0 @@ -# 文本分类 - -## 1. 介绍 - -### 1.1 简介 -文本分类插件基于 MindXSDK 开发,在晟腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 -该模型支持5个新闻类别:体育、健康、军事、教育、汽车。 - -### 1.2 支持的产品 - -本项目以昇腾Atlas310卡为主要的硬件平台。 - -### 1.3 支持的版本 - -推荐系统为ubuntu 18.04。 - -表1.1 环境依赖软件和版本: - -| 软件名称 | 版本 | -| -------- | ------ | -| cmake | 3.10.2 | -| mxVision | 2.0.4 | -| python | 3.9.2 | -| CANN | 5.0.4 | - -### 1.4 软件方案介绍 - -基于MindX SDK的文本分类业务流程为:待分类文本通过预处理,将文本根据字典vocab.txt进行编码,组成numpy形式的向量,将向量通过 appsrc 插件输入,然后由模型推理插件mxpi_tensorinfer得到每种类别的得分,再通过后处理插件mxpi_classpostprocessor将模型输出的结果处理,最后得到该文本的类别。本系统的各模块及功能描述如表1.2所示: - - -表1.2 系统方案各子系统功能描述: - -| 序号 | 子系统 | 功能描述 | -| ---- | ------ | ------------ | -| 1 | 文本输入 | 读取输入文本 | -| 2 | 文本编码 | 根据字典对输入文本编码 | -| 3 | 模型推理 | 对文本编码后的张量进行推理 | -| 4 | 后处理 | 从模型推理结果中寻找对应的分类标签 | -| 5 | 保存结果 | 将分类结果保存文件| - -### 1.5 代码目录结构与说明 - -本工程名称为文本分类,工程目录如下图所示: - -``` -. -│ build.sh -│ README.md -│ tree.txt -│ -├─mxBase -│ │ build.sh -│ │ CMakeLists.txt -│ │ main.cpp -│ │ -│ ├─BertClassification -│ │ BertClassification.cpp -│ │ BertClassification.h -│ │ -│ ├─data -│ │ vocab.txt -│ │ -│ ├─model -│ │ bert_text_classification_labels.names -│ │ -│ ├─out -│ │ prediction_label.txt -│ │ -│ └─test -│ Test.cpp -│ Test.h -│ -└─sdk - │ build.sh - │ flowChart.png - │ main.py - │ run.sh - │ tokenizer.py - │ - ├─config - │ bert_text_classification_aipp_tf.cfg - │ bert_text_classification_labels.names - │ - ├─data - │ vocab.txt - │ - ├─model - │ bert_text_classification_aipp_tf.cfg - │ bert_text_classification_labels.names - │ model_conversion.sh - │ - ├─out - │ prediction_label.txt - │ - ├─pipeline - │ BertTextClassification.pipeline - │ - └─test - test.py - test.sh - test_input.py -``` -### 1.6 技术实现流程图 - -![image](sdk/flowChart.png) - - -## 2 设置环境变量 - -确保环境中正确安装mxVision SDK。 - -在编译运行项目前,需要设置环境变量: - -``` -export MX_SDK_HOME=${SDK安装路径}/mxVision -export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/driver/lib64:${LD_LIBRARY_PATH} -export PYTHONPATH=${MX_SDK_HOME}/python:${PYTHONPATH} - -export install_path=/usr/local/Ascend/ascend-toolkit/latest -export PATH=/usr/local/python3.9.2/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH -export LD_LIBRARY_PATH=${install_path}/atc/lib64:$LD_LIBRARY_PATH -export ASCEND_OPP_PATH=${install_path}/opp -``` - -- 环境变量介绍 - -``` -MX_SDK_HOME:MindX SDK mxVision的根安装路径,用于包含MindX SDK提供的所有库和头文件。 -LD_LIBRARY_PATH:提供了MindX SDK已开发的插件和相关的库信息。 -install_path:ascend-toolkit的安装路径。 -PATH:添加python的执行路径和atc转换工具的执行路径。 -LD_LIBRARY_PATH:添加ascend-toolkit和MindX SDK提供的库目录路径。 -ASCEND_OPP_PATH:atc转换工具需要的目录。 -``` - -## 3 准备模型 - -**步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb -下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 - -**步骤2** 执行以下命令使用atc命令进行模型转换: - -cd $HOME/models/bert_text_classification - -atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" - -**步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: - -``` -cp ./bert_text_classification.om $HOME/sdk/model/ -cp ./bert_text_classification.om $HOME/mxBase/model/ -``` - -**步骤4** 执行成功后终端输出为: - -``` -ATC start working now, please wait for a moment. -ATC run success, welcome to the next use. -``` - -## 4 编译与运行 - -**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 - -**步骤2** 按照第 2 小节 环境依赖 中的步骤设置环境变量。 - -**步骤3** 按照第 3 小节 模型转换 中的步骤获得 om 模型文件。 - -**步骤4** 将本项目代码的文件路径中出现的 ${SDK目录} 替换成自己SDK的存放目录,下面是需要替换的代码。 - -``` -mxBase目录下的CMakeList.txt中的第13行代码: -set(MX_SDK_HOME ${SDK目录}) - -sdk/pipeline目录下BertTextClassification.pipeline文件中的第26行: -"postProcessLibPath": "${SDK目录}/lib/modelpostprocessors/libresnet50postprocess.so" -``` - -**步骤5** pipeline项目运行在sdk目录下执行命令: - -``` -python3 main.py -``` - -命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 - -**步骤6** mxBase项目在mxBase目录中,执行以下代码进行编译。 - -``` -mkdir build -cd build -cmake .. -make -``` - -编译完成后,将可执行文件 mxBase_text_classification 移动到mxBase目录下,执行下面代码运行 - -``` -./mxBase_text_classification ./data/sample.txt -``` - -执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 - -## 5 精度测试 - -**步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 - -**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件分别放在sdk/data目录和mxBase/data目录。 - -**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 - -``` -python3 test.py -``` - -**步骤4** mxBase项目中,将mxBase目录下main.cpp中main方法的全部代码注释,替换为下面代码(即main函数中仅包含以下代码),参考第4小节 编译与运行 中的步骤4重新编译并运行,得到mxBase的精度测试结果。 - -``` -Test::test_accuracy(); -``` - -## 6 常见问题 -1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From 39940bc90c0d0fa5cc398f7ea4872b553119f15b Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:48:55 +0000 Subject: [PATCH 036/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 210 +++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 contrib/BertTextClassification/README.md diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md new file mode 100644 index 000000000..2d6addd94 --- /dev/null +++ b/contrib/BertTextClassification/README.md @@ -0,0 +1,210 @@ +# 文本分类 + +## 1. 介绍 + +### 1.1 简介 +文本分类插件基于 MindXSDK 开发,在昇腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 +该模型支持5个新闻类别:体育、健康、军事、教育、汽车。 + +### 1.2 支持的产品 + +本项目以昇腾Atlas310卡为主要的硬件平台。 + +### 1.3 支持的版本 + +推荐系统为ubuntu 18.04。 + +表1.1 环境依赖软件和版本: + +| 软件名称 | 版本 | +| -------- | ------ | +| cmake | 3.10.2 | +| mxVision | 5.0.0 | +| python | 3.9.2 | +| CANN | 7.0.0 | + +### 1.4 软件方案介绍 + +基于MindX SDK的文本分类业务流程为:待分类文本通过预处理,将文本根据字典vocab.txt进行编码,组成numpy形式的向量,将向量通过 appsrc 插件输入,然后由模型推理插件mxpi_tensorinfer得到每种类别的得分,再通过后处理插件mxpi_classpostprocessor将模型输出的结果处理,最后得到该文本的类别。本系统的各模块及功能描述如表1.2所示: + + +表1.2 系统方案各子系统功能描述: + +| 序号 | 子系统 | 功能描述 | +| ---- | ------ | ------------ | +| 1 | 文本输入 | 读取输入文本 | +| 2 | 文本编码 | 根据字典对输入文本编码 | +| 3 | 模型推理 | 对文本编码后的张量进行推理 | +| 4 | 后处理 | 从模型推理结果中寻找对应的分类标签 | +| 5 | 保存结果 | 将分类结果保存文件| + +### 1.5 代码目录结构与说明 + +本工程名称为文本分类,工程目录如下图所示: + +``` +. +│ build.sh +│ README.md +│ tree.txt +│ +├─mxBase +│ │ build.sh +│ │ CMakeLists.txt +│ │ main.cpp +│ │ +│ ├─BertClassification +│ │ BertClassification.cpp +│ │ BertClassification.h +│ │ +│ ├─data +│ │ vocab.txt +│ │ +│ ├─model +│ │ bert_text_classification_labels.names +│ │ +│ ├─out +│ │ prediction_label.txt +│ │ +│ └─test +│ Test.cpp +│ Test.h +│ +└─sdk + │ build.sh + │ flowChart.png + │ main.py + │ run.sh + │ tokenizer.py + │ + ├─config + │ bert_text_classification_aipp_tf.cfg + │ bert_text_classification_labels.names + │ + ├─data + │ vocab.txt + │ + ├─model + │ bert_text_classification_aipp_tf.cfg + │ bert_text_classification_labels.names + │ model_conversion.sh + │ + ├─out + │ prediction_label.txt + │ + ├─pipeline + │ BertTextClassification.pipeline + │ + └─test + test.py + test.sh + test_input.py +``` +### 1.6 技术实现流程图 + +![image](sdk/flowChart.png) + + +## 2 设置环境变量 + +确保环境中正确安装mxVision SDK。 + +在编译运行项目前,需要设置环境变量: + +``` +# 设置环境变量 +. ${ascend-toolkit-path}/set_env.sh +. ${SDK-path}/set_env.sh + +# 环境变量介绍 +ascend-toolkit-path: CANN 安装路径 +SDK-path: SDK mxVision 安装路径 +``` +## 3 准备模型 + +**步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb +下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 + +**步骤2** 执行以下命令使用atc命令进行模型转换: + +cd $HOME/models/bert_text_classification + +atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" + +**步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: + +``` +cp ./bert_text_classification.om $HOME/sdk/model/ +cp ./bert_text_classification.om $HOME/mxBase/model/ +``` + +**步骤4** 执行成功后终端输出为: + +``` +ATC start working now, please wait for a moment. +ATC run success, welcome to the next use. +``` + +## 4 编译与运行 + +**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip 下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 + +**步骤2** 按照第 2 小节 环境依赖 中的步骤设置环境变量。 + +**步骤3** 按照第 3 小节 模型转换 中的步骤获得 om 模型文件。 + +**步骤4** 将本项目代码的文件路径中出现的 ${SDK目录} 替换成自己SDK的存放目录,下面是需要替换的代码。 + +``` +mxBase目录下的CMakeList.txt中的第13行代码: +set(MX_SDK_HOME ${SDK目录}) + +sdk/pipeline目录下BertTextClassification.pipeline文件中的第26行: +"postProcessLibPath": "${SDK目录}/lib/modelpostprocessors/libresnet50postprocess.so" +``` + +**步骤5** pipeline项目运行在sdk目录下执行命令: + +``` +python3 main.py +``` + +命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 + +**步骤6** mxBase项目在mxBase目录中,执行以下代码进行编译。 + +``` +mkdir build +cd build +cmake .. +make +``` + +编译完成后,将可执行文件 mxBase_text_classification 移动到mxBase目录下,执行下面代码运行 + +``` +./mxBase_text_classification ./data/sample.txt +``` + +执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 + +## 5 精度测试 + +**步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 + +**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件分别放在sdk/data目录和mxBase/data目录。 + +**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 + +``` +python3 test.py +``` + +**步骤4** mxBase项目中,将mxBase目录下main.cpp中main方法的全部代码注释,替换为下面代码(即main函数中仅包含以下代码),参考第4小节 编译与运行 中的步骤4重新编译并运行,得到mxBase的精度测试结果。 + +``` +Test::test_accuracy(); +``` + +## 6 常见问题 +1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From 602066ba6dcf13e3ec99a82f269e7ea7e036c57c Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:50:12 +0000 Subject: [PATCH 037/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/BertTextClassification/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/BertTextClassification/README.md | 210 ----------------------- 1 file changed, 210 deletions(-) delete mode 100644 contrib/BertTextClassification/README.md diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md deleted file mode 100644 index 2d6addd94..000000000 --- a/contrib/BertTextClassification/README.md +++ /dev/null @@ -1,210 +0,0 @@ -# 文本分类 - -## 1. 介绍 - -### 1.1 简介 -文本分类插件基于 MindXSDK 开发,在昇腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 -该模型支持5个新闻类别:体育、健康、军事、教育、汽车。 - -### 1.2 支持的产品 - -本项目以昇腾Atlas310卡为主要的硬件平台。 - -### 1.3 支持的版本 - -推荐系统为ubuntu 18.04。 - -表1.1 环境依赖软件和版本: - -| 软件名称 | 版本 | -| -------- | ------ | -| cmake | 3.10.2 | -| mxVision | 5.0.0 | -| python | 3.9.2 | -| CANN | 7.0.0 | - -### 1.4 软件方案介绍 - -基于MindX SDK的文本分类业务流程为:待分类文本通过预处理,将文本根据字典vocab.txt进行编码,组成numpy形式的向量,将向量通过 appsrc 插件输入,然后由模型推理插件mxpi_tensorinfer得到每种类别的得分,再通过后处理插件mxpi_classpostprocessor将模型输出的结果处理,最后得到该文本的类别。本系统的各模块及功能描述如表1.2所示: - - -表1.2 系统方案各子系统功能描述: - -| 序号 | 子系统 | 功能描述 | -| ---- | ------ | ------------ | -| 1 | 文本输入 | 读取输入文本 | -| 2 | 文本编码 | 根据字典对输入文本编码 | -| 3 | 模型推理 | 对文本编码后的张量进行推理 | -| 4 | 后处理 | 从模型推理结果中寻找对应的分类标签 | -| 5 | 保存结果 | 将分类结果保存文件| - -### 1.5 代码目录结构与说明 - -本工程名称为文本分类,工程目录如下图所示: - -``` -. -│ build.sh -│ README.md -│ tree.txt -│ -├─mxBase -│ │ build.sh -│ │ CMakeLists.txt -│ │ main.cpp -│ │ -│ ├─BertClassification -│ │ BertClassification.cpp -│ │ BertClassification.h -│ │ -│ ├─data -│ │ vocab.txt -│ │ -│ ├─model -│ │ bert_text_classification_labels.names -│ │ -│ ├─out -│ │ prediction_label.txt -│ │ -│ └─test -│ Test.cpp -│ Test.h -│ -└─sdk - │ build.sh - │ flowChart.png - │ main.py - │ run.sh - │ tokenizer.py - │ - ├─config - │ bert_text_classification_aipp_tf.cfg - │ bert_text_classification_labels.names - │ - ├─data - │ vocab.txt - │ - ├─model - │ bert_text_classification_aipp_tf.cfg - │ bert_text_classification_labels.names - │ model_conversion.sh - │ - ├─out - │ prediction_label.txt - │ - ├─pipeline - │ BertTextClassification.pipeline - │ - └─test - test.py - test.sh - test_input.py -``` -### 1.6 技术实现流程图 - -![image](sdk/flowChart.png) - - -## 2 设置环境变量 - -确保环境中正确安装mxVision SDK。 - -在编译运行项目前,需要设置环境变量: - -``` -# 设置环境变量 -. ${ascend-toolkit-path}/set_env.sh -. ${SDK-path}/set_env.sh - -# 环境变量介绍 -ascend-toolkit-path: CANN 安装路径 -SDK-path: SDK mxVision 安装路径 -``` -## 3 准备模型 - -**步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb -下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 - -**步骤2** 执行以下命令使用atc命令进行模型转换: - -cd $HOME/models/bert_text_classification - -atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" - -**步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: - -``` -cp ./bert_text_classification.om $HOME/sdk/model/ -cp ./bert_text_classification.om $HOME/mxBase/model/ -``` - -**步骤4** 执行成功后终端输出为: - -``` -ATC start working now, please wait for a moment. -ATC run success, welcome to the next use. -``` - -## 4 编译与运行 - -**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip 下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 - -**步骤2** 按照第 2 小节 环境依赖 中的步骤设置环境变量。 - -**步骤3** 按照第 3 小节 模型转换 中的步骤获得 om 模型文件。 - -**步骤4** 将本项目代码的文件路径中出现的 ${SDK目录} 替换成自己SDK的存放目录,下面是需要替换的代码。 - -``` -mxBase目录下的CMakeList.txt中的第13行代码: -set(MX_SDK_HOME ${SDK目录}) - -sdk/pipeline目录下BertTextClassification.pipeline文件中的第26行: -"postProcessLibPath": "${SDK目录}/lib/modelpostprocessors/libresnet50postprocess.so" -``` - -**步骤5** pipeline项目运行在sdk目录下执行命令: - -``` -python3 main.py -``` - -命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 - -**步骤6** mxBase项目在mxBase目录中,执行以下代码进行编译。 - -``` -mkdir build -cd build -cmake .. -make -``` - -编译完成后,将可执行文件 mxBase_text_classification 移动到mxBase目录下,执行下面代码运行 - -``` -./mxBase_text_classification ./data/sample.txt -``` - -执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 - -## 5 精度测试 - -**步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 - -**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件分别放在sdk/data目录和mxBase/data目录。 - -**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 - -``` -python3 test.py -``` - -**步骤4** mxBase项目中,将mxBase目录下main.cpp中main方法的全部代码注释,替换为下面代码(即main函数中仅包含以下代码),参考第4小节 编译与运行 中的步骤4重新编译并运行,得到mxBase的精度测试结果。 - -``` -Test::test_accuracy(); -``` - -## 6 常见问题 -1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From 9048acffb04699421e64cb9badfdc0f67e70a4c5 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:50:25 +0000 Subject: [PATCH 038/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 210 +++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 contrib/BertTextClassification/README.md diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md new file mode 100644 index 000000000..f3a3bbd3d --- /dev/null +++ b/contrib/BertTextClassification/README.md @@ -0,0 +1,210 @@ +# 文本分类 + +## 1. 介绍 + +### 1.1 简介 +文本分类插件基于 MindXSDK 开发,在昇腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 +该模型支持5个新闻类别:体育、健康、军事、教育、汽车。 + +### 1.2 支持的产品 + +本项目以昇腾Atlas310卡为主要的硬件平台。 + +### 1.3 支持的版本 + +推荐系统为ubuntu 18.04。 + +表1.1 环境依赖软件和版本: + +| 软件名称 | 版本 | +| -------- | ------ | +| cmake | 3.10.2 | +| mxVision | 5.0.0 | +| python | 3.9.2 | +| CANN | 7.0.0 | + +### 1.4 软件方案介绍 + +基于MindX SDK的文本分类业务流程为:待分类文本通过预处理,将文本根据字典vocab.txt进行编码,组成numpy形式的向量,将向量通过 appsrc 插件输入,然后由模型推理插件mxpi_tensorinfer得到每种类别的得分,再通过后处理插件mxpi_classpostprocessor将模型输出的结果处理,最后得到该文本的类别。本系统的各模块及功能描述如表1.2所示: + + +表1.2 系统方案各子系统功能描述: + +| 序号 | 子系统 | 功能描述 | +| ---- | ------ | ------------ | +| 1 | 文本输入 | 读取输入文本 | +| 2 | 文本编码 | 根据字典对输入文本编码 | +| 3 | 模型推理 | 对文本编码后的张量进行推理 | +| 4 | 后处理 | 从模型推理结果中寻找对应的分类标签 | +| 5 | 保存结果 | 将分类结果保存文件| + +### 1.5 代码目录结构与说明 + +本工程名称为文本分类,工程目录如下图所示: + +``` +. +│ build.sh +│ README.md +│ tree.txt +│ +├─mxBase +│ │ build.sh +│ │ CMakeLists.txt +│ │ main.cpp +│ │ +│ ├─BertClassification +│ │ BertClassification.cpp +│ │ BertClassification.h +│ │ +│ ├─data +│ │ vocab.txt +│ │ +│ ├─model +│ │ bert_text_classification_labels.names +│ │ +│ ├─out +│ │ prediction_label.txt +│ │ +│ └─test +│ Test.cpp +│ Test.h +│ +└─sdk + │ build.sh + │ flowChart.png + │ main.py + │ run.sh + │ tokenizer.py + │ + ├─config + │ bert_text_classification_aipp_tf.cfg + │ bert_text_classification_labels.names + │ + ├─data + │ vocab.txt + │ + ├─model + │ bert_text_classification_aipp_tf.cfg + │ bert_text_classification_labels.names + │ model_conversion.sh + │ + ├─out + │ prediction_label.txt + │ + ├─pipeline + │ BertTextClassification.pipeline + │ + └─test + test.py + test.sh + test_input.py +``` +### 1.6 技术实现流程图 + +![image](sdk/flowChart.png) + + +## 2 设置环境变量 + +确保环境中正确安装mxVision SDK。 + +在编译运行项目前,需要设置环境变量: + +``` +# 设置环境变量 +. ${ascend-toolkit-path}/set_env.sh +. ${SDK-path}/set_env.sh + +# 环境变量介绍 +ascend-toolkit-path: CANN 安装路径 +SDK-path: SDK mxVision 安装路径 +``` +## 3 准备模型 + +**步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb +下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 + +**步骤2** 执行以下命令使用atc命令进行模型转换: + +cd $HOME/models/bert_text_classification + +atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" + +**步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: + +``` +cp ./bert_text_classification.om $HOME/sdk/model/ +cp ./bert_text_classification.om $HOME/mxBase/model/ +``` + +**步骤4** 执行成功后终端输出为: + +``` +ATC start working now, please wait for a moment. +ATC run success, welcome to the next use. +``` + +## 4 编译与运行 + +**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip 下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 + +**步骤2** 按照第 2 小节 环境依赖 中的步骤设置环境变量。 + +**步骤3** 按照第 3 小节 模型转换 中的步骤获得 om 模型文件。 + +**步骤4** 将本项目代码的文件路径中出现的 ${SDK目录} 替换成自己SDK的存放目录,下面是需要替换的代码。 + +``` +mxBase目录下的CMakeList.txt中的第13行代码: +set(MX_SDK_HOME ${SDK目录}) + +sdk/pipeline目录下BertTextClassification.pipeline文件中的第26行: +"postProcessLibPath": "${SDK目录}/lib/modelpostprocessors/libresnet50postprocess.so" +``` + +**步骤5** pipeline项目运行在sdk目录下执行命令: + +``` +python3 main.py +``` + +命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 + +**步骤6** mxBase项目在mxBase目录中,执行以下代码进行编译。 + +``` +mkdir build +cd build +cmake .. +make +``` + +编译完成后,将可执行文件 mxBase_text_classification 移动到mxBase目录下,执行下面代码运行 + +``` +./mxBase_text_classification ./data/sample.txt +``` + +执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 + +## 5 精度验证 + +**步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 + +**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件分别放在sdk/data目录和mxBase/data目录。 + +**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 + +``` +python3 test.py +``` + +**步骤4** mxBase项目中,将mxBase目录下main.cpp中main方法的全部代码注释,替换为下面代码(即main函数中仅包含以下代码),参考第4小节 编译与运行 中的步骤4重新编译并运行,得到mxBase的精度测试结果。 + +``` +Test::test_accuracy(); +``` + +## 6 常见问题 +1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From 38c4084c93a7f94584230b65d99b53ffb3d1afc1 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:51:02 +0000 Subject: [PATCH 039/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/EdgeDetectionPicture/CMakeLists.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/CMakeLists.txt | 43 --------------------- 1 file changed, 43 deletions(-) delete mode 100644 contrib/EdgeDetectionPicture/CMakeLists.txt diff --git a/contrib/EdgeDetectionPicture/CMakeLists.txt b/contrib/EdgeDetectionPicture/CMakeLists.txt deleted file mode 100644 index c038f4269..000000000 --- a/contrib/EdgeDetectionPicture/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(edge_detection_picture) - -include_directories(./rcfPostProcess) -include_directories(./rcfDetection) -file(GLOB_RECURSE RCF_POSTPROCESS ${PROJECT_SOURCE_DIR}/rcfPostProcess/*cpp) -file(GLOB_RECURSE RCF_DETECTION ${PROJECT_SOURCE_DIR}/rcfDetection/*cpp) -set(TARGET edge_detection_picture) -add_compile_options(-std=c++11 -fPIE -fstack-protector-all -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -s -pie -Wall) -add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=mindxsdk_private) - -set(MX_SDK_HOME /root/SDK/mxVision) - -set(cpprest_DIR ${MX_SDK_HOME}/opensource/lib/libcpprest.so) -if(EXISTS ${cpprest_DIR}) - target_link_libraries(edge_detection_picture cpprest) - add_definitions(_DMX_VERSION_5) -endif() - -include_directories( - ${MX_SDK_HOME}/include - ${MX_SDK_HOME}/opensource/include - ${MX_SDK_HOME}/opensource/include/opencv4 -) - -link_directories( - ${MX_SDK_HOME}/lib - ${MX_SDK_HOME}/opensource/lib - ${MX_SDK_HOME}/lib/modelpostprocessors - ${MX_SDK_HOME}/include/MxBase/postprocess/include - /usr/local/Ascend/ascend-toolkit/latest/acllib/lib64 - /usr/local/Ascend/driver/lib64/ -) - -add_executable(edge_detection_picture main.cpp ${RCF_DETECTION} ${RCF_POSTPROCESS}) -target_link_libraries(edge_detection_picture - glog - mxbase - opencv_world - boost_system - boost_filesystem - ) -install(TARGETS ${TARGET} RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/) -- Gitee From 1d9982f31e16710c2b1825e2e47c5b922c50b0ca Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:51:10 +0000 Subject: [PATCH 040/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/EdgeDetectionPicture/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/EdgeDetectionPicture/README.md | 155 ------------------------- 1 file changed, 155 deletions(-) delete mode 100644 contrib/EdgeDetectionPicture/README.md diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md deleted file mode 100644 index ec2f72b99..000000000 --- a/contrib/EdgeDetectionPicture/README.md +++ /dev/null @@ -1,155 +0,0 @@ - -# RCF模型边缘检测 - -## 1 介绍 - -#### 1.1 简介 -本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行 图像边缘提取,并把可视化结果保存到本地。 -其中包含Rcf模型的后处理模块开发。 主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit - -#### 1.2 支持的产品 -昇腾310(推理) - -#### 1.3 支持的版本 -本样例配套的CANN版本为7.0.0,MindX SDK版本为5.0.0 -MindX SDK安装前准备可参考《用户指南》,[安装教程](https://gitee.com/ascend/mindxsdk-referenceapps/blob/master/docs/quickStart/1-1%E5%AE%89%E8%A3%85SDK%E5%BC%80%E5%8F%91%E5%A5%97%E4%BB%B6.md) -| 软件 | 版本 | 说明 | -| ------------------- | ------------ | ---------------------------- | -| mxVision | 5.0.0 | mxVision软件包 | -| Ascend-CANN-toolkit | 7.0.0 | Ascend-cann-toolkit开发套件包 | - - -#### 1.4 代码目录结构说明 -本sample工程名称为EdgeDetectionPicture,工程目录如下图所示: - -``` -. -├── model -│ ├── aipp.cfg // 模型转换aipp配置文件 -├── rcfDetection -│ ├── RcfDetection.cpp -│ └── RcfDetection.h -├── rcfPostProcess -│ ├── rcfPostProcess.cpp -│ └── rcfPostProcess.h -├── build.sh -├── main.cpp -├── README.md -├── CMakeLists.txt -└── License -``` - -## 2 设置环境变量 - -在编译运行项目前,需要设置环境变量: - -- 环境变量介绍 - - ``` - . {cann_install_path}/ascend-toolkit/set_env.sh - . {sdk_install_path}/mxVision/set_env.sh - ``` - - - -## 3 准备模型 - -**步骤1** 模型获取 -下载RCF模型 。[下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/model.zip) - -**步骤2** 模型存放 -将获取到的RCF模型rcf.prototxt文件和rcf_bsds.caffemodel文件放在edge_detection_picture/model下 - -**步骤3** 执行模型转换命令 - -``` -atc --model=rcf.prototxt --weight=./rcf_bsds.caffemodel --framework=0 --output=rcf --soc_version=Ascend310 --insert_op_conf=./aipp.cfg --input_format=NCHW --output_type=FP32 -``` - -## 4 编译与运行 - -**步骤1** 执行如下编译命令: -bash build.sh - -**步骤2** 进行图像边缘检测 -请自行准备jpg格式的测试图像保存在文件夹中(例如 data/**.jpg)进行边缘检测 -``` -./edge_detection_picture ./data -``` -生成边缘检测图像 result/**.jpg - -## 5 精度测试 -下载开源数据集 BSDS500 [下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/data.zip), 使用 BSR/BSDS500/data/images/test数据进行测试 - - -(1) 下载开源代码 - -``` shell -git clone https://github.com/Walstruzz/edge_eval_python.git -cd edge_eval_python -``` -(2) 编译cxx - -``` shell -cd cxx/src -source build.sh -``` -(3) 将test中的图像经过边缘检测后的结果保存在result文件夹中 - -``` shell -./edge_detection_picture path/to/BSR/BSDS500/data/images/test/ - -``` - - -(4) 修改检测代码 - -vim mian.py -注释第17行代码 nms_process(model_name_list, result_dir, save_dir, key, file_format), -修改18行为 eval_edge(alg, model_name_list, result_dir, gt_dir, workers) - -vim /impl/edges_eval_dir.py -修改155行为 im = os.path.join(res_dir, "{}.jpg".format(i)) - -vim eval_edge.py -修改14行为 res_dir = result_dir - -(5) 测试精度 - -``` shell -python main.py --result_dir path/to/result --gt_dir path/to/BSR/BSDS500/data/groundTruth/test - -``` -注: - result_dir: results directory - - gt_dir : ground truth directory - - -## 6常见问题 -### 6.1 精度测试脚本运行时, ModuleNotFoundError报错问题: -问题描述: -运行精度测试脚本过程中, 出现如下类似报错: -``` -********* -File "***/nms_process.py", line 6 in - from impl.toolbox import conv_tri, grad2 -ModuleNotFoundError: No module named 'impl.toolbox' -``` - -解决措施: -``` -方法一: -将环境变量PYTHONPATH里面的/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe去掉, 该路径根据cann实际安装位置不同可能会不一样,须自行确认 - -方法二: -执行命令: unset PYTHONPATH -``` -### 6.2 检测代码无法修改问题: -问题描述: -修改检测代码中, 出现无法修改问题 - -解决措施: -``` -使用 sudo vim filename进行修改 -``` \ No newline at end of file -- Gitee From 9bf66d4c4743032ca6f7691770bcc1d243b91594 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:51:32 +0000 Subject: [PATCH 041/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README=E4=B8=8ECMake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/CMakeLists.txt | 43 ++++++ contrib/EdgeDetectionPicture/README.md | 159 ++++++++++++++++++++ 2 files changed, 202 insertions(+) create mode 100644 contrib/EdgeDetectionPicture/CMakeLists.txt create mode 100644 contrib/EdgeDetectionPicture/README.md diff --git a/contrib/EdgeDetectionPicture/CMakeLists.txt b/contrib/EdgeDetectionPicture/CMakeLists.txt new file mode 100644 index 000000000..3dd908ccc --- /dev/null +++ b/contrib/EdgeDetectionPicture/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.10) +project(edge_detection_picture) + +include_directories(./rcfPostProcess) +include_directories(./rcfDetection) +file(GLOB_RECURSE RCF_POSTPROCESS ${PROJECT_SOURCE_DIR}/rcfPostProcess/*cpp) +file(GLOB_RECURSE RCF_DETECTION ${PROJECT_SOURCE_DIR}/rcfDetection/*cpp) +set(TARGET edge_detection_picture) +add_compile_options(-std=c++11 -fPIE -fstack-protector-all -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -s -pie -Wall) +add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=mindxsdk_private) + +set(MX_SDK_HOME "$ENV{MX_SDK_HOME}") + +set(cpprest_DIR ${MX_SDK_HOME}/opensource/lib/libcpprest.so) +if(EXISTS ${cpprest_DIR}) + target_link_libraries(edge_detection_picture cpprest) + add_definitions(_DMX_VERSION_5) +endif() + +include_directories( + ${MX_SDK_HOME}/include + ${MX_SDK_HOME}/opensource/include + ${MX_SDK_HOME}/opensource/include/opencv4 +) + +link_directories( + ${MX_SDK_HOME}/lib + ${MX_SDK_HOME}/opensource/lib + ${MX_SDK_HOME}/lib/modelpostprocessors + ${MX_SDK_HOME}/include/MxBase/postprocess/include + /usr/local/Ascend/ascend-toolkit/latest/acllib/lib64 + /usr/local/Ascend/driver/lib64/ +) + +add_executable(edge_detection_picture main.cpp ${RCF_DETECTION} ${RCF_POSTPROCESS}) +target_link_libraries(edge_detection_picture + glog + mxbase + opencv_world + boost_system + boost_filesystem + ) +install(TARGETS ${TARGET} RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/) diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md new file mode 100644 index 000000000..2be5df9ce --- /dev/null +++ b/contrib/EdgeDetectionPicture/README.md @@ -0,0 +1,159 @@ + +# RCF模型边缘检测 + +## 1 介绍 + +#### 1.1 简介 +本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行 图像边缘提取,并把可视化结果保存到本地。 +其中包含Rcf模型的后处理模块开发。 主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit + +#### 1.2 支持的产品 +昇腾310(推理) + +#### 1.3 支持的版本 +本样例配套的CANN版本为7.0.0,MindX SDK版本为5.0.0 +MindX SDK安装前准备可参考《用户指南》,[安装教程](https://gitee.com/ascend/mindxsdk-referenceapps/blob/master/docs/quickStart/1-1%E5%AE%89%E8%A3%85SDK%E5%BC%80%E5%8F%91%E5%A5%97%E4%BB%B6.md) +| 软件 | 版本 | 说明 | +| ------------------- | ------------ | ---------------------------- | +| mxVision | 5.0.0 | mxVision软件包 | +| Ascend-CANN-toolkit | 7.0.0 | Ascend-cann-toolkit开发套件包 | + + +#### 1.4 代码目录结构说明 +本sample工程名称为EdgeDetectionPicture,工程目录如下图所示: + +``` +. +├── model +│ ├── aipp.cfg // 模型转换aipp配置文件 +├── rcfDetection +│ ├── RcfDetection.cpp +│ └── RcfDetection.h +├── rcfPostProcess +│ ├── rcfPostProcess.cpp +│ └── rcfPostProcess.h +├── build.sh +├── main.cpp +├── README.md +├── CMakeLists.txt +└── License +``` + +## 2 设置环境变量 + +在编译运行项目前,需要设置环境变量: + +- 环境变量介绍 + + ``` + . {cann_install_path}/ascend-toolkit/set_env.sh + . {sdk_install_path}/mxVision/set_env.sh + + # 环境变量介绍 + cann_install_path: CANN 安装路径 + sdk_install_path: SDK 安装路径 + ``` + + + +## 3 准备模型 + +**步骤1** 模型获取 +下载RCF模型 。[下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/model.zip) + +**步骤2** 模型存放 +将获取到的RCF模型rcf.prototxt文件和rcf_bsds.caffemodel文件放在edge_detection_picture/model下 + +**步骤3** 执行模型转换命令 + +``` +atc --model=rcf.prototxt --weight=./rcf_bsds.caffemodel --framework=0 --output=rcf --soc_version=Ascend310 --insert_op_conf=./aipp.cfg --input_format=NCHW --output_type=FP32 +``` + +## 4 编译与运行 + +**步骤1** 执行如下编译命令: +bash build.sh + +**步骤2** 进行图像边缘检测 +请自行准备jpg格式的测试图像保存在文件夹中(例如 data/**.jpg)进行边缘检测 +``` +./edge_detection_picture ./data +``` +生成边缘检测图像 result/**.jpg + +## 5 精度验证 +下载开源数据集 BSDS500 [下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/data.zip), 使用 BSR/BSDS500/data/images/test数据进行测试 + + +(1) 下载开源代码 + +``` shell +git clone https://github.com/Walstruzz/edge_eval_python.git +cd edge_eval_python +``` +(2) 编译cxx + +``` shell +cd cxx/src +source build.sh +``` +(3) 将test中的图像经过边缘检测后的结果保存在result文件夹中 + +``` shell +./edge_detection_picture path/to/BSR/BSDS500/data/images/test/ + +``` + + +(4) 修改检测代码 + +vim mian.py +注释第17行代码 nms_process(model_name_list, result_dir, save_dir, key, file_format), +修改18行为 eval_edge(alg, model_name_list, result_dir, gt_dir, workers) + +vim /impl/edges_eval_dir.py +修改155行为 im = os.path.join(res_dir, "{}.jpg".format(i)) + +vim eval_edge.py +修改14行为 res_dir = result_dir + +(5) 测试精度 + +``` shell +python main.py --result_dir path/to/result --gt_dir path/to/BSR/BSDS500/data/groundTruth/test + +``` +注: + result_dir: results directory + + gt_dir : ground truth directory + + +## 6常见问题 +### 6.1 精度测试脚本运行时, ModuleNotFoundError报错问题: +问题描述: +运行精度测试脚本过程中, 出现如下类似报错: +``` +********* +File "***/nms_process.py", line 6 in + from impl.toolbox import conv_tri, grad2 +ModuleNotFoundError: No module named 'impl.toolbox' +``` + +解决措施: +``` +方法一: +将环境变量PYTHONPATH里面的/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe去掉, 该路径根据cann实际安装位置不同可能会不一样,须自行确认 + +方法二: +执行命令: unset PYTHONPATH +``` +### 6.2 检测代码无法修改问题: +问题描述: +修改检测代码中, 出现无法修改问题 + +解决措施: +``` +使用 sudo vim filename进行修改 +``` \ No newline at end of file -- Gitee From 271821b3d23392ae19b03850bf3b00548d45fdad Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:52:32 +0000 Subject: [PATCH 042/129] update contrib/EdgeDetectionPicture/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md index 2be5df9ce..ac3b4626a 100644 --- a/contrib/EdgeDetectionPicture/README.md +++ b/contrib/EdgeDetectionPicture/README.md @@ -130,7 +130,7 @@ python main.py --result_dir path/to/result --gt_dir path/to/BSR/BSDS500/data/g gt_dir : ground truth directory -## 6常见问题 +## 6 常见问题 ### 6.1 精度测试脚本运行时, ModuleNotFoundError报错问题: 问题描述: 运行精度测试脚本过程中, 出现如下类似报错: -- Gitee From 728292955fa2521b950776fd10d25a71164a4588 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:53:28 +0000 Subject: [PATCH 043/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/CrowdCounting/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/CrowdCounting/README.md | 94 --------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 contrib/CrowdCounting/README.md diff --git a/contrib/CrowdCounting/README.md b/contrib/CrowdCounting/README.md deleted file mode 100644 index a7959de12..000000000 --- a/contrib/CrowdCounting/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# C++ 基于MxBase 的人群计数图像检测样例及后处理模块开发 - -## 1 介绍 - -### 1.1 简介 -本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行人群计数目标检测,并把可视化结果保存到本地。开发端到端人群计数-人群密度估计的参考设计,实现图像当中人计数的功能,并达到精度和性能要求。 该Sample的主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit - -### 1.2 支持的产品 - -支持昇腾310芯片 - -### 1.3 支持的版本 - -环境依赖软件和版本如下表: - -表1.1 系统方案中各模块功能: - -| 软件名称 | 版本 | 说明 | -| -------- | ----- | ------------------------------------------------------------ | -| mxVision | 5.0.0 | 封装昇腾计算语言(AscendCL)的高级编程API,简化插件和推理应用开发。 | -| CANN | 7.0.0 | 提供昇腾计算语言(AscendCL)的高级编程API。 | - -### 1.4 软件方案介绍 - -人群计数项目实现:输入类型是图片数据(例如jpg格式的图片),通过调用MindX SDK mxBase提供的接口,使用DVPP进行图像解码,解码后获取图像数据,然后经过图像尺寸大小变换,满足模型的输入尺寸要求;将尺寸变换后的图像数据输入人群计数模型进行推理,模型输出经过后处理后,得到人群密度估计图和人计数估计值,输出人计数的估计值。 - -整个流程需要参考Ascend的参考样例:crowd_count_picture 样例,详见以下链接:https://gitee.com/ascend/samples/tree/master/python/contrib/crowd_count_picture crowd_count_picture 样例是基于ACL实现的,本任务需要参考crowd_count_picture 样例,基于MindX SDK mxBase的接口实现。MindX SDK mxBase是对ACL接口的封装,提供了极简易用的API, 使能AI应用的开发。 - -表1.2 系统方案中各模块功能: - -| 序号 | 子系统 | 功能描述 | -| ---- | ----------------- | ------------------------------------------------------------ | -| 1 | 设备初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的初始化。 | -| 2 | 图像输入 | C++文件IO读取图像文件 | -| 3 | 图像解码/图像缩放 | 调用mxBase::DvppWrappe.DvppJpegDecode()函数完成图像解码,VpcResize()完成缩放。 | -| 4 | 模型推理 | 调用mxBase:: ModelInferenceProcessor 接口完成模型推理 | -| 5 | 后处理 | 获取模型推理输出张量BaseTensor,进行后处理。 | -| 6 | 保存结果 | 输出图像当中的人的数量,保存标记出人数的结果图像。 | -| 7 | 设备去初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的去初始化。 | - -### 1.5 代码目录结构与说明 - -本sample工程名称为 **CrowdCounting**,工程目录如下图所示: - -![image-20210813152252629](image-20210813152252629.png) - -### 1.6 技术实现流程图 - -![image-20210813154111508](image-20210813154111508.png) - -## 2 设置环境变量: - -在编译运行项目前,需要设置环境变量: - - -``` -. {cann_install_path}/ascend-toolkit/set_env.sh -. {sdk_install_path}/mxVision/set_env.sh -``` - -## 3 准备模型 - -**步骤1** - -下载原始模型权重、原始模型网络、对应的cfg文件: - -[模型及配置文件下载链接](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/CrowdCounting/model.zip) - -**步骤2** - -将上述下载得文件统一放在CrowdCounting/model文件夹下,并使用ATC模型转换工具进行模型转换,参考如下指令: - -``` -atc --input_shape="blob1:1,3,800,1408" --weight="count_person.caffe.caffemodel" --input_format=NCHW --output="count_person.caffe" --soc_version=Ascend310 --insert_op_conf=insert_op.cfg --framework=0 --model="count_person.caffe.prototxt" -``` - -得到count_person.caffe.om文件 - -## 4 编译与运行 - -**步骤1** - -cd到CrowdCounting目录下,执行如下编译命令: bash build.sh - - -**步骤2** - -下载人群计数图像,需自行在网络找图,暂支持JPG格式,任意图像分辨率。再将该下载的图片作为推理图片放入CrowdCounting目录下,执行: - -``` -./crowd_counting ./xxx.jpg -``` - - -- Gitee From 202df59701011e6d4556c616583a97d3922161da Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:53:43 +0000 Subject: [PATCH 044/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CrowdCounting/README.md | 98 +++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 contrib/CrowdCounting/README.md diff --git a/contrib/CrowdCounting/README.md b/contrib/CrowdCounting/README.md new file mode 100644 index 000000000..3688aa366 --- /dev/null +++ b/contrib/CrowdCounting/README.md @@ -0,0 +1,98 @@ +# C++ 基于MxBase 的人群计数图像检测样例及后处理模块开发 + +## 1 介绍 + +### 1.1 简介 +本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行人群计数目标检测,并把可视化结果保存到本地。开发端到端人群计数-人群密度估计的参考设计,实现图像当中人计数的功能,并达到精度和性能要求。 该Sample的主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit + +### 1.2 支持的产品 + +支持昇腾310芯片 + +### 1.3 支持的版本 + +环境依赖软件和版本如下表: + +表1.1 系统方案中各模块功能: + +| 软件名称 | 版本 | 说明 | +| -------- | ----- | ------------------------------------------------------------ | +| mxVision | 5.0.0 | 封装昇腾计算语言(AscendCL)的高级编程API,简化插件和推理应用开发。 | +| CANN | 7.0.0 | 提供昇腾计算语言(AscendCL)的高级编程API。 | + +### 1.4 软件方案介绍 + +人群计数项目实现:输入类型是图片数据(例如jpg格式的图片),通过调用MindX SDK mxBase提供的接口,使用DVPP进行图像解码,解码后获取图像数据,然后经过图像尺寸大小变换,满足模型的输入尺寸要求;将尺寸变换后的图像数据输入人群计数模型进行推理,模型输出经过后处理后,得到人群密度估计图和人计数估计值,输出人计数的估计值。 + +整个流程需要参考Ascend的参考样例:crowd_count_picture 样例,详见以下链接:https://gitee.com/ascend/samples/tree/master/python/contrib/crowd_count_picture crowd_count_picture 样例是基于ACL实现的,本任务需要参考crowd_count_picture 样例,基于MindX SDK mxBase的接口实现。MindX SDK mxBase是对ACL接口的封装,提供了极简易用的API, 使能AI应用的开发。 + +表1.2 系统方案中各模块功能: + +| 序号 | 子系统 | 功能描述 | +| ---- | ----------------- | ------------------------------------------------------------ | +| 1 | 设备初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的初始化。 | +| 2 | 图像输入 | C++文件IO读取图像文件 | +| 3 | 图像解码/图像缩放 | 调用mxBase::DvppWrappe.DvppJpegDecode()函数完成图像解码,VpcResize()完成缩放。 | +| 4 | 模型推理 | 调用mxBase:: ModelInferenceProcessor 接口完成模型推理 | +| 5 | 后处理 | 获取模型推理输出张量BaseTensor,进行后处理。 | +| 6 | 保存结果 | 输出图像当中的人的数量,保存标记出人数的结果图像。 | +| 7 | 设备去初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的去初始化。 | + +### 1.5 代码目录结构与说明 + +本sample工程名称为 **CrowdCounting**,工程目录如下图所示: + +![image-20210813152252629](image-20210813152252629.png) + +### 1.6 技术实现流程图 + +![image-20210813154111508](image-20210813154111508.png) + +## 2 设置环境变量: + +在编译运行项目前,需要设置环境变量: + + +``` +. {cann_install_path}/ascend-toolkit/set_env.sh +. {sdk_install_path}/mxVision/set_env.sh + + # 环境变量介绍 + cann_install_path: CANN 安装路径 + sdk_install_path: SDK 安装路径 +``` + +## 3 准备模型 + +**步骤1** + +下载原始模型权重、原始模型网络、对应的cfg文件: + +[模型及配置文件下载链接](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/CrowdCounting/model.zip) + +**步骤2** + +将上述下载得文件统一放在CrowdCounting/model文件夹下,并使用ATC模型转换工具进行模型转换,参考如下指令: + +``` +atc --input_shape="blob1:1,3,800,1408" --weight="count_person.caffe.caffemodel" --input_format=NCHW --output="count_person.caffe" --soc_version=Ascend310 --insert_op_conf=insert_op.cfg --framework=0 --model="count_person.caffe.prototxt" +``` + +得到count_person.caffe.om文件 + +## 4 编译与运行 + +**步骤1** + +cd到CrowdCounting目录下,执行如下编译命令: bash build.sh + + +**步骤2** + +下载人群计数图像,需自行在网络找图,暂支持JPG格式,任意图像分辨率。再将该下载的图片作为推理图片放入CrowdCounting目录下,执行: + +``` +./crowd_counting ./xxx.jpg +``` + + -- Gitee From 20b74128070442d68a9f5459f8e3f4bca7548565 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:54:32 +0000 Subject: [PATCH 045/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/CamouflagedObjectDetection/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/CamouflagedObjectDetection/README.md | 126 ------------------- 1 file changed, 126 deletions(-) delete mode 100644 contrib/CamouflagedObjectDetection/README.md diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md deleted file mode 100644 index dca79fabd..000000000 --- a/contrib/CamouflagedObjectDetection/README.md +++ /dev/null @@ -1,126 +0,0 @@ -# MindX SDK -- 伪装目标分割参考设计案例 - -## 1 介绍 - -### 1.1 简介 - -在本系统中,目的是基于MindX SDK,在华为云昇腾平台上,开发端到端**伪装目标分割**的参考设计,实现**对图像中的伪装目标进行识别检测**的功能,达到功能要求。 - -### 1.2 支持的产品 - -昇腾Atlas310 - -### 1.3 支持的版本 - -环境依赖软件和版本如下表: - -| 软件名称 | 版本 | -| :-----------: | :---------: | -| MindX SDK | 2.0.4 | -| Python | 3.9.2 | -| CANN | 5.0.4 | -| numpy | 1.21.2 | -| opencv-python | 4.5.3.56 | -| mindspore (cpu) | 1.9.0 | - -### 1.4 代码目录结构与说明 - -本工程名称为DGNet,工程目录如下列表所示: - -``` -./ -├── assets # 文件 -│ ├── 74.jpg -│ └── 74.png -├── data # 数据集存放路径 -│ └── NC4K -├── inference_om.py # 昇腾离线模型推理python脚本文件 -├── README.md # 本文件 -├── seg_results_om -│ ├── Exp-DGNet-OM # 预测结果图存放路径 -├── snapshots -│ ├── DGNet # 模型文件存放路径 -``` - -## 2 设置环境变量 - -在编译运行项目前,需要设置环境变量 - -```bash -# MindXSDK 环境变量: -. ${SDK-path}/set_env.sh - -# CANN 环境变量: -. ${ascend-toolkit-path}/set_env.sh - -# 环境变量介绍 -SDK-path: SDK mxVision 安装路径 -ascend-toolkit-path: CANN 安装路径 -``` - - -## 3 准备模型 - -### 模型转换 - -**步骤1** 下载DGNet (Efficient-B4) 的ONNX模型:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/DGNet.zip - -**步骤2** 将下载获取到的DGNet模型onxx文件存放至`./snapshots/DGNet/DGNet.onnx`。 - -**步骤3** 模型转换具体步骤 - -```bash -# 进入对应目录 -cd ./snapshots/DGNet/ -# 执行以下命令将ONNX模型(.onnx)转换为昇腾离线模型(.om) -atc --framework=5 --model=DGNet.onnx --output=DGNet --input_shape="image:1,3,352,352" --log=debug --soc_version=Ascend310 -``` -执行完模型转换脚本后,会在对应目录中获取到如下转化模型:DGNet.om(本项目中在Ascend平台上所使用的离线模型文件)。 - -## 4 编译与运行 -示例步骤如下: - -**步骤0** - -下载一份测试数据集合:下载链接:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/data.tar - -**步骤1** - -执行离线推理Python脚本 - -```bash -python inference_om.py --om_path ./snapshots/DGNet/DGNet.om --save_path ./seg_results_om/Exp-DGNet-OM/NC4K/ --data_path ./data/NC4K/Imgs -``` - -**步骤2** - -- 定量性能验证: - -使用原始GitHub仓库中提供的标准评测代码进行测评,具体操作步骤如下: - -```bash -# 拉取原始仓库 -git clone https://github.com/GewelsJI/DGNet.git - -# 将如下两个文件夹放入当前 -mv ./DGNet/lib_ascend/eval ./contrib/CamouflagedObjectDetection/ -mv ./DGNet/lib_ascend/evaluation.py ./contrib/CamouflagedObjectDetection/ - -# 运行如下命令进行测评 -python evaluation.py -``` - -然后可以生成评测指标数值表格。可以看出DGNet模型的Smeasure指标数值为0.856,已经超过了项目交付中提到的“大于0.84”的要求。 - -```text -+---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ -| Dataset | Method | Smeasure | wFmeasure | MAE | adpEm | meanEm | maxEm | adpFm | meanFm | maxFm | -+---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ -| NC4K | Exp-DGNet-OM | 0.856 | 0.782 | 0.043 | 0.909 | 0.91 | 0.921 | 0.8 | 0.812 | 0.833 | -+---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ -``` - -- 定性性能验证: - -输入伪装图片:![](./assets/74.jpg) -预测分割结果:![](./assets/74.png) \ No newline at end of file -- Gitee From 74baee97d5dfc6a8281ec218b7d7e3c544322b56 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:54:44 +0000 Subject: [PATCH 046/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CamouflagedObjectDetection/README.md | 126 +++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 contrib/CamouflagedObjectDetection/README.md diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md new file mode 100644 index 000000000..269965bc7 --- /dev/null +++ b/contrib/CamouflagedObjectDetection/README.md @@ -0,0 +1,126 @@ +# MindX SDK -- 伪装目标分割参考设计案例 + +## 1 介绍 + +### 1.1 简介 + +在本系统中,目的是基于MindX SDK,在华为昇腾平台上,开发端到端**伪装目标分割**的参考设计,实现**对图像中的伪装目标进行识别检测**的功能,达到功能要求。 + +### 1.2 支持的产品 + +昇腾Atlas310 + +### 1.3 支持的版本 + +环境依赖软件和版本如下表: + +| 软件名称 | 版本 | +| :-----------: | :---------: | +| mxVision | 5.0.0 | +| Python | 3.9.2 | +| CANN | 7.0.0 | +| numpy | 1.21.2 | +| opencv-python | 4.5.3.56 | +| mindspore (cpu) | 1.9.0 | + +### 1.4 代码目录结构与说明 + +本工程名称为DGNet,工程目录如下列表所示: + +``` +./ +├── assets # 文件 +│ ├── 74.jpg +│ └── 74.png +├── data # 数据集存放路径 +│ └── NC4K +├── inference_om.py # 昇腾离线模型推理python脚本文件 +├── README.md # 本文件 +├── seg_results_om +│ ├── Exp-DGNet-OM # 预测结果图存放路径 +├── snapshots +│ ├── DGNet # 模型文件存放路径 +``` + +## 2 设置环境变量 + +在编译运行项目前,需要设置环境变量 + +```bash +# MindXSDK 环境变量: +. ${SDK-path}/set_env.sh + +# CANN 环境变量: +. ${ascend-toolkit-path}/set_env.sh + +# 环境变量介绍 +SDK-path: SDK mxVision 安装路径 +ascend-toolkit-path: CANN 安装路径 +``` + + +## 3 准备模型 + +### 模型转换 + +**步骤1** 下载DGNet (Efficient-B4) 的ONNX模型:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/DGNet.zip + +**步骤2** 将下载获取到的DGNet模型onxx文件存放至`./snapshots/DGNet/DGNet.onnx`。 + +**步骤3** 模型转换具体步骤 + +```bash +# 进入对应目录 +cd ./snapshots/DGNet/ +# 执行以下命令将ONNX模型(.onnx)转换为昇腾离线模型(.om) +atc --framework=5 --model=DGNet.onnx --output=DGNet --input_shape="image:1,3,352,352" --log=debug --soc_version=Ascend310 +``` +执行完模型转换脚本后,会在对应目录中获取到如下转化模型:DGNet.om(本项目中在Ascend平台上所使用的离线模型文件)。 + +## 4 编译与运行 +示例步骤如下: + +**步骤0** + +下载一份测试数据集合:下载链接:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/data.tar + +**步骤1** + +执行离线推理Python脚本 + +```bash +python inference_om.py --om_path ./snapshots/DGNet/DGNet.om --save_path ./seg_results_om/Exp-DGNet-OM/NC4K/ --data_path ./data/NC4K/Imgs +``` + +## 5 性能验证 + +- 定量性能验证: + +使用原始GitHub仓库中提供的标准评测代码进行测评,具体操作步骤如下: + +```bash +# 拉取原始仓库 +git clone https://github.com/GewelsJI/DGNet.git + +# 将如下两个文件夹放入当前 +mv ./DGNet/lib_ascend/eval ./contrib/CamouflagedObjectDetection/ +mv ./DGNet/lib_ascend/evaluation.py ./contrib/CamouflagedObjectDetection/ + +# 运行如下命令进行测评 +python evaluation.py +``` + +然后可以生成评测指标数值表格。可以看出DGNet模型的Smeasure指标数值为0.856,已经超过了项目交付中提到的“大于0.84”的要求。 + +```text ++---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ +| Dataset | Method | Smeasure | wFmeasure | MAE | adpEm | meanEm | maxEm | adpFm | meanFm | maxFm | ++---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ +| NC4K | Exp-DGNet-OM | 0.856 | 0.782 | 0.043 | 0.909 | 0.91 | 0.921 | 0.8 | 0.812 | 0.833 | ++---------+-----------------------+----------+-----------+-------+-------+--------+-------+-------+--------+-------+ +``` + +- 定性性能验证: + +输入伪装图片:![](./assets/74.jpg) +预测分割结果:![](./assets/74.png) \ No newline at end of file -- Gitee From 2a9153e6610a05f8e4ac5e76546e35bb35e283b9 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:55:13 +0000 Subject: [PATCH 047/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/IAT/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/IAT/README.md | 121 ------------------------------------------ 1 file changed, 121 deletions(-) delete mode 100644 contrib/IAT/README.md diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md deleted file mode 100644 index 1f652e8f8..000000000 --- a/contrib/IAT/README.md +++ /dev/null @@ -1,121 +0,0 @@ -# MindX SDK -- RGB图像的夜间增强参考设计 - -## 1 介绍 - -### 1.1 简介 -基于 MindX SDK 实现 IAT 模型的推理,把可视化结果保存到本地,达到预期的功能和精度要求。 - -### 1.2 支持的产品 - -支持昇腾310芯片 - -### 1.3 支持的版本 - -| 名称 | 版本 | -| ------------- | ---------------- | -| MindX SDK | mxVision-3.0.RC3 | -| Python | 3.9.2 | -| CANN | 5.1.RC2.alpha008 | -| numpy | 1.22.3 | -| opencv-python | 4.5.5 | -| onnxsim | 0.4.10 | - - -### 1.4 代码目录结构与说明 - -eg:本sample工程名称为XXX,工程目录如下图所示: - -``` -├── images # README图片文件夹 -├── data # 推理图片文件夹 - ├──.keepme -├── models # 模型文件夹 - ├──.keepme -├── main.py # 推理文件 -├── pth2onnx.py # 模型转换文件 -└── README.md - -``` - -## 2 设置环境变量 - -在编译运行项目前,需要设置环境变量: - -- 环境变量介绍 - -``` -列出具体执行命令(简化) -. ${sdk_path}/set_env.sh -. ${ascend_toolkit_path}/set_env.sh -``` - - -## 3 编译与运行 -### 3.1 推理示例代码 - -**步骤1** (下载原模型代码) - -- 下载 PyTorch 版本 [IAT代码](https://github.com/cuiziteng/illumination-adaptive-transformer) - -- 根据原模型目录下的README.md文件配置原模型环境,具体代码如下: - - ``` - $ conda create -n IAT python==3.7.0 - $ conda activate IAT - $ conda install --yes -c pytorch pytorch=1.7.1 torchvision cudatoolkit=11.0 - $ pip install timm matplotlib IQA_pytorch tqdm - ``` - - -**步骤2** (配置项目环境) - -退出原模型环境,根据第2节环境依赖所述安装相应的项目环境,并设置环境变量。 - -``` -source ${sdk_path}/set_env.sh -source ${ascend_toolkit_path}/set_env.sh -``` - -**步骤3** (执行编译的步骤) - -​ 1.pytorch 模型转换 onnx 文件 - -​ 将 `pth2onnx.py` 放到 Illumination-Adaptive_Transformer/IAT_enhance/项目目录下,并切换到原模型环境,运行: - -``` -python pth2onnx.py -``` - -​ 在该目录下会生成名为IAT_lol.onnx的onnx模型文件 - -​ 2.简化 onnx 文件 - -​ 在上述目录下继续运行: - -``` -onnxsim IAT_lol.onnx IAT_lol-sim.onnx -``` - -​ 会在路径下生成简化后的IAT_lol-sim.onnx模型文件 - -​ 已经简化好的onnx模型可供参考:[IAT_lol-sim.onnx](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/IAT/IAT_lol-sim.onnx) - -​ 3.onnx 文件转换 om 文件 - -​ 将环境从原模型环境切换到当前项目环境,然后运行: - -``` -atc --framework=5 --model=./IAT_lol-sim.onnx --input_shape="input_1:1,3,400,600" --output=IAT_lol-sim --soc_version=Ascend310 -``` - -**步骤4** (运行及输出结果) - -将要推理的图片放到本项目./data/文件夹下, 并将其改为test.png, 将.om模型放到./models/文件夹下, 命名为iatsim.om。运行: - -``` -python main.py -``` - -即可在./data/目录下得到推理后的结果. - - -- Gitee From 01f48758151f7ac3603bc4465623e475306093f9 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:55:22 +0000 Subject: [PATCH 048/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/IAT/README.md | 125 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 contrib/IAT/README.md diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md new file mode 100644 index 000000000..b5be74106 --- /dev/null +++ b/contrib/IAT/README.md @@ -0,0 +1,125 @@ +# MindX SDK -- RGB图像的夜间增强参考设计 + +## 1 介绍 + +### 1.1 简介 +基于 MindX SDK 实现 IAT 模型的推理,把可视化结果保存到本地。 + +### 1.2 支持的产品 + +支持昇腾310芯片 + +### 1.3 支持的版本 + +| 名称 | 版本 | +| ------------- | ---------------- | +| mxVision | 5.0.0 | +| Python | 3.9.2 | +| CANN | 7.0.0 | +| numpy | 1.22.3 | +| opencv-python | 4.5.5 | +| onnxsim | 0.4.10 | + + +### 1.4 代码目录结构与说明 + +eg:本sample工程名称为XXX,工程目录如下图所示: + +``` +├── images # README图片文件夹 +├── data # 推理图片文件夹 + ├──.keepme +├── models # 模型文件夹 + ├──.keepme +├── main.py # 推理文件 +├── pth2onnx.py # 模型转换文件 +└── README.md + +``` + +## 2 设置环境变量 + +在编译运行项目前,需要设置环境变量: + +- 环境变量介绍 + +``` +列出具体执行命令(简化) +. ${sdk_path}/set_env.sh +. ${ascend_toolkit_path}/set_env.sh + +# 环境变量介绍 +sdk_path: SDK mxVision安装路径 +ascend_toolkit_path: CANN 安装路径 +``` + + +## 3 编译与运行 +### 3.1 推理示例代码 + +**步骤1** (下载原模型代码) + +- 下载 PyTorch 版本 [IAT代码](https://github.com/cuiziteng/illumination-adaptive-transformer) + +- 根据原模型目录下的README.md文件配置原模型环境,具体代码如下: + + ``` + $ conda create -n IAT python==3.7.0 + $ conda activate IAT + $ conda install --yes -c pytorch pytorch=1.7.1 torchvision cudatoolkit=11.0 + $ pip install timm matplotlib IQA_pytorch tqdm + ``` + + +**步骤2** (配置项目环境) + +退出原模型环境,根据第2节环境依赖所述安装相应的项目环境,并设置环境变量。 + +``` +source ${sdk_path}/set_env.sh +source ${ascend_toolkit_path}/set_env.sh +``` + +**步骤3** (执行编译的步骤) + +​ 1.pytorch 模型转换 onnx 文件 + +​ 将 `pth2onnx.py` 放到 Illumination-Adaptive_Transformer/IAT_enhance/项目目录下,并切换到原模型环境,运行: + +``` +python pth2onnx.py +``` + +​ 在该目录下会生成名为IAT_lol.onnx的onnx模型文件 + +​ 2.简化 onnx 文件 + +​ 在上述目录下继续运行: + +``` +onnxsim IAT_lol.onnx IAT_lol-sim.onnx +``` + +​ 会在路径下生成简化后的IAT_lol-sim.onnx模型文件 + +​ 已经简化好的onnx模型可供参考:[IAT_lol-sim.onnx](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/IAT/IAT_lol-sim.onnx) + +​ 3.onnx 文件转换 om 文件 + +​ 将环境从原模型环境切换到当前项目环境,然后运行: + +``` +atc --framework=5 --model=./IAT_lol-sim.onnx --input_shape="input_1:1,3,400,600" --output=IAT_lol-sim --soc_version=Ascend310 +``` + +**步骤4** (运行及输出结果) + +将要推理的图片放到本项目./data/文件夹下, 并将其改为test.png, 将.om模型放到./models/文件夹下, 命名为iatsim.om。运行: + +``` +python main.py +``` + +即可在./data/目录下得到推理后的结果. + + -- Gitee From 7550b2099db67dba6880aa7dfa28ffc863b3e42f Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:55:49 +0000 Subject: [PATCH 049/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/TSM/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/TSM/README.md | 141 ------------------------------------------ 1 file changed, 141 deletions(-) delete mode 100644 contrib/TSM/README.md diff --git a/contrib/TSM/README.md b/contrib/TSM/README.md deleted file mode 100644 index cc2c0f52b..000000000 --- a/contrib/TSM/README.md +++ /dev/null @@ -1,141 +0,0 @@ -# TSM视频分类参考设计 - -## 1 介绍 - -### 1.1 简介 -使用TSM模型,在MindX SDK环境下实现视频分类功能。将测试视频传入脚本进行前处理,模型推理,后处理等功能,最终得到模型推理的结果。 - -### 1.2 支持的产品 - -以昇腾Atlas310卡为主要的硬件平台 - -### 1.3 支持的版本 -环境依赖软件和版本如下表: - -| 软件名称 | 版本 | -|----------|--------| -| cmake | 3.5+ | -| mxVision | 5.0.RC3 | -| Python | 3.9 | -| torch | 1.10.0 | -| ffmpeg | 4.2.1 | - -### 1.4 软件方案介绍 - -项目主要由离线精度测试文件,在线功能测试文件,离线单视频推理性能测试文件,模型文件,测试数据集预处理文件组成。 - -### 1.5 代码目录结构与说明 - -```text -├── TSM - ├── README.md // 所有模型相关说明 - ├── model - ├── onnx2om.sh // 转om模型脚本 - ├── onnx2om1.sh // 在线模型转om模型脚本 - ├── label - ├── kinetics_val.csv // label文件 - ├── download_data - ├── k400_extractor.sh // 解压数据集脚本 - ├── offline.png // 离线推理技术实现流程 - ├── online.png // 在线推理技术实现流程 - ├── online_infer.py // 在线推理精度脚本 - ├── offline_infer.py // 离线推理精度脚本 - ├── speed.py // 离线单视频推理NPU性能脚本 - ├── speed_gpu.py // 离线单视频推理GPU性能脚本 -``` - -### 1.6技术实现流程 - -在线推理流程: - -![离线推理流程](./online.png) - -### 1.7特性及适用场景 - -在线模型: - -本案例中的在线模型适用于26中手势识别,并可以返回识别手势的名称。 - -## 2 设置环境变量 - -- 环境变量搭建 - -在运行项目前,需要设置环境变量: - -MindSDK 环境变量: - -```Shell -. ${SDK-path}/set_env.sh -``` - -CANN 环境变量: - -```Shell -. ${ascend-toolkit-path}/set_env.sh -``` - -环境变量介绍 - -SDK-path: mxVision SDK 安装路径 - -ascend-toolkit-path: CANN 安装路径。 - -下载[ffmpeg](https://github.com/FFmpeg/FFmpeg/archive/n4.2.1.tar.gz),解压进入并执行以下命令安装: - -```Shell -./configure --prefix=/usr/local/ffmpeg --enable-shared -make -j -make install -``` - -安装完毕后导入环境变量 - -```Shell -export PATH=/usr/local/ffmpeg/bin:$PATH -export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH -``` - -## 3 在线推理 - -**步骤1** 安装[视频流工具](https://gitee.com/ascend/docs-openmind/blob/master/guide/mindx/sdk/tutorials/reference_material/Live555%E7%A6%BB%E7%BA%BF%E8%A7%86%E9%A2%91%E8%BD%ACRTSP%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md) - -**步骤2** 生成视频流 - -根据提示当前只支持部分视频格式,并不支持.mp4后缀的文件,但可以通过ffmpeg转换生成[ffmpeg安装教程](https://gitee.com/ascend/docs-openmind/blob/master/guide/mindx/sdk/tutorials/reference_material/pc%E7%AB%AFffmpeg%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B.md),如下所示为MP4转换为h.264命令: - -使用ffmpeg工具将带有手势的“jester.mp4”的mp4格式视频转换生成为“jester.264”的264格式视频: - -```shell -ffmpeg -i jester.mp4 -vcodec h264 -bf 0 -g 25 -r 10 -s 1280*720 -an -f h264 jester.264 - -//-bf B帧数目控制,-g 关键帧间隔控制,-s 分辨率控制 -an关闭音频, -r 指定帧率 -``` - -使用live555生成视频流。 - -**步骤3** 模型转换 - -下载[在线模型](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/TSM/online_models.zip) jester.onnx - -将下载好的模型放在参考设计代码根目录的“model”目录下。 - -将模型转换为om模型,在“model”目录下,运行脚本生成om模型 - -```shell -bash onnx2om1.sh -``` - -**步骤4** 程序测试 - -```shell -python3 online_infer.py -``` - -修改参数,'ip:port/jester.264'为测试视频流,其中ip为起流的机器ip地址,port为起流的机器端口地址,jester.264为测试视频jester.mp4通过ffmpeg转换后的视频。 - -```python -def video2img(): - cmd = 'ffmpeg -i \"{}\" -threads 1 -vf scale=-1:331 -q:v 0 \"{}/img_%05d.jpg\"'.format('rtsp://ip:port/jester.264', './image') - subprocess.call(cmd, shell=True, - stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) -``` -- Gitee From aef2253c8f5e2a5731c5160bac7f61ec23bc40f3 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:55:59 +0000 Subject: [PATCH 050/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/TSM/README.md | 142 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 contrib/TSM/README.md diff --git a/contrib/TSM/README.md b/contrib/TSM/README.md new file mode 100644 index 000000000..d3828738c --- /dev/null +++ b/contrib/TSM/README.md @@ -0,0 +1,142 @@ +# TSM视频分类参考设计 + +## 1 介绍 + +### 1.1 简介 +使用TSM模型,在MindX SDK环境下实现视频分类功能。将测试视频传入脚本进行前处理,模型推理,后处理等功能,最终得到模型推理的结果。 + +### 1.2 支持的产品 + +以昇腾Atlas310卡为主要的硬件平台 + +### 1.3 支持的版本 +环境依赖软件和版本如下表: + +| 软件名称 | 版本 | +|----------|--------| +| cmake | 3.5+ | +| mxVision | 5.0.0 | +| CANN | 7.0.0 | +| Python | 3.9 | +| torch | 1.10.0 | +| ffmpeg | 4.2.1 | + +### 1.4 软件方案介绍 + +项目主要由离线精度测试文件,在线功能测试文件,离线单视频推理性能测试文件,模型文件,测试数据集预处理文件组成。 + +### 1.5 代码目录结构与说明 + +```text +├── TSM + ├── README.md // 所有模型相关说明 + ├── model + ├── onnx2om.sh // 转om模型脚本 + ├── onnx2om1.sh // 在线模型转om模型脚本 + ├── label + ├── kinetics_val.csv // label文件 + ├── download_data + ├── k400_extractor.sh // 解压数据集脚本 + ├── offline.png // 离线推理技术实现流程 + ├── online.png // 在线推理技术实现流程 + ├── online_infer.py // 在线推理精度脚本 + ├── offline_infer.py // 离线推理精度脚本 + ├── speed.py // 离线单视频推理NPU性能脚本 + ├── speed_gpu.py // 离线单视频推理GPU性能脚本 +``` + +### 1.6技术实现流程 + +在线推理流程: + +![离线推理流程](./online.png) + +### 1.7特性及适用场景 + +在线模型: + +本案例中的在线模型适用于26中手势识别,并可以返回识别手势的名称。 + +## 2 设置环境变量 + +- 环境变量搭建 + +在运行项目前,需要设置环境变量: + +MindSDK 环境变量: + +```Shell +. ${SDK-path}/set_env.sh +``` + +CANN 环境变量: + +```Shell +. ${ascend-toolkit-path}/set_env.sh +``` + +环境变量介绍 + +SDK-path: mxVision SDK 安装路径 + +ascend-toolkit-path: CANN 安装路径。 + +下载[ffmpeg](https://github.com/FFmpeg/FFmpeg/archive/n4.2.1.tar.gz),解压进入并执行以下命令安装: + +```Shell +./configure --prefix=/usr/local/ffmpeg --enable-shared +make -j +make install +``` + +安装完毕后导入环境变量 + +```Shell +export PATH=/usr/local/ffmpeg/bin:$PATH +export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib:$LD_LIBRARY_PATH +``` + +## 3 编译与运行 + +**步骤1** 安装[视频流工具](https://gitee.com/ascend/docs-openmind/blob/master/guide/mindx/sdk/tutorials/reference_material/Live555%E7%A6%BB%E7%BA%BF%E8%A7%86%E9%A2%91%E8%BD%ACRTSP%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md) + +**步骤2** 生成视频流 + +根据提示当前只支持部分视频格式,并不支持.mp4后缀的文件,但可以通过ffmpeg转换生成[ffmpeg安装教程](https://gitee.com/ascend/docs-openmind/blob/master/guide/mindx/sdk/tutorials/reference_material/pc%E7%AB%AFffmpeg%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B.md),如下所示为MP4转换为h.264命令: + +使用ffmpeg工具将带有手势的“jester.mp4”的mp4格式视频转换生成为“jester.264”的264格式视频: + +```shell +ffmpeg -i jester.mp4 -vcodec h264 -bf 0 -g 25 -r 10 -s 1280*720 -an -f h264 jester.264 + +//-bf B帧数目控制,-g 关键帧间隔控制,-s 分辨率控制 -an关闭音频, -r 指定帧率 +``` + +使用live555生成视频流。 + +**步骤3** 模型转换 + +下载[在线模型](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/TSM/online_models.zip) jester.onnx + +将下载好的模型放在参考设计代码根目录的“model”目录下。 + +将模型转换为om模型,在“model”目录下,运行脚本生成om模型 + +```shell +bash onnx2om1.sh +``` + +**步骤4** 程序测试 + +```shell +python3 online_infer.py +``` + +修改参数,'ip:port/jester.264'为测试视频流,其中ip为起流的机器ip地址,port为起流的机器端口地址,jester.264为测试视频jester.mp4通过ffmpeg转换后的视频。 + +```python +def video2img(): + cmd = 'ffmpeg -i \"{}\" -threads 1 -vf scale=-1:331 -q:v 0 \"{}/img_%05d.jpg\"'.format('rtsp://ip:port/jester.264', './image') + subprocess.call(cmd, shell=True, + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) +``` -- Gitee From 2d6ae50821e598f513420c4bb46bc52728c92117 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:56:25 +0000 Subject: [PATCH 051/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/VCOD=5FSLTNet/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/VCOD_SLTNet/README.md | 290 ---------------------------------- 1 file changed, 290 deletions(-) delete mode 100644 contrib/VCOD_SLTNet/README.md diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md deleted file mode 100644 index 8ed86814f..000000000 --- a/contrib/VCOD_SLTNet/README.md +++ /dev/null @@ -1,290 +0,0 @@ -# 视频伪装物体检测 - -## 1 介绍 - -### 1.1 简介 - -基于 MindX SDK 实现 SLT-Net 模型的推理,在 MoCA-Mask 数据集上 Sm 达到大于 0.6。输入连续几帧伪装物体的视频序列,输出伪装物体掩膜 Mask 图。 - - -### 1.2 支持的产品 - -支持昇腾310芯片 - - -### 1.3 支持的版本 - -| 软件名称 | 版本 | -| -------- | ------ | -| MindX SDK | 5.0.RC3 | -| Python | 3.9.2 | -| CANN | 7.0RC1 | -| PyTorch | 1.12.1 | -| numpy | 1.21.5 | -| imageio | 2.22.3| -| Pillow | 9.3.0 | -| cv2 | 4.5.5 | -| timm | 0.4.12 | -| tqdm | 4.64.1 | -| mindspore | 2.0.0| - - -### 1.4 软件方案介绍 - - -本方案中,先通过 `torch2onnx.py` 脚本将 PyTorch 版本的伪装视频物体检测模型 SLT-Net 转换为 onnx 模型;然后通过 `inference.py` 脚本调用晟腾om模型,将输入视频帧进行图像处理,最终生成视频伪装物体的掩膜 Mask 图。 - - -### 1.5 代码目录结构与说明 - -本sample工程名称为 VCOD_SLTNet,工程目录如下图所示: - -``` -──VCOD_SLTNet - ├── flowchart.jpeg - ├── inference.py # 推理文件 - ├── torch2onnx.py # 模型转换脚本 - └── README.md -``` - - -### 1.6 技术实现流程图 - -![Flowchart](./flowchart.jpeg) - -图1 视频伪装物体检测流程图 - - -### 1.7 特性及适用场景 - -对于伪装视频数据的分割任务均适用,输入视频需要转换为图片序列输入到模型中,具体可以参考 MoCA 数据格式与目录结构(如下所示),详见 [SLT-Net](https://xueliancheng.github.io/SLT-Net-project/) 与 [MoCA 数据集主页](https://www.robots.ox.ac.uk/~vgg/data/MoCA/)。 - - -``` ---data - └── TestDataset_per_sq # 测试数据集 - ├── flower_crab_spider_1 # 不同场景 - ├── GT # Ground Truth - ├── 00000.png - ├── ..... - └── Imgs # 输入图片序列 - ├── 00000.jpg - ├── ..... - ...... - -``` - - -## 2 设置环境变量 - -在运行项目前,需要设置环境变量: - -MindSDK 环境变量: - -```Shell -. ${SDK-path}/set_env.sh -``` - -CANN 环境变量: - -```Shell -. ${ascend-toolkit-path}/set_env.sh -``` - -环境变量介绍 - -SDK-path: mxVision SDK 安装路径 - -ascend-toolkit-path: CANN 安装路径。 - - - -## 3. 数据准备 - -### 3.1 准备相关文件 - -1、SLT-Net代码包准备 - -点击访问 [SLT-Net](https://github.com/XuelianCheng/SLT-Net) 并下载 SLT-Net-master.zip 代码压缩包,上传服务器并解压得到“SLT-Net-master”目录及文件; - -2、SLT-Net模型文件准备 - -方法一:通过访问 [SLT-Net 模型官方链接](https://drive.google.com/file/d/1_u4dEdxM4AKuuh6EcWHAlo8EtR7e8q5v/view) 下载模型压缩包 (注意,需要访问 Google Drive ),解压后将 `Net_epoch_MoCA_short_term_pseudo.pth` 模型拷贝至 `SLT-Net-master` 目录下; - -方法二:下载 [models.zip 备份模型压缩包](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/models.zip) 并解压获得 `sltnet.pth`、`sltnet.onnx`、`sltnet.om` 三个模型文件,将 `sltnet.pth` 模型拷贝至 `SLT-Net-master` 目录下 - - -3、数据集准备 - -通过访问[MoCA官方链接](https://xueliancheng.github.io/SLT-Net-project/)下载 `MoCA_Video` 数据集,或者通过[数据集备份链接](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/MoCA_Video.zip)来下载 `MoCA_Video.zip` 数据集压缩包并解压; - - -### 3.2 模型转换 - -1、SLT-Net代码预处理 - -进入 `SLT-Net-master/lib` 目录下,对 `__init__.py`、`short_term_model.py`、`pvtv2_afterTEM.py`三个文件做以下修改: - -1)`__init__.py`文件注释如下: - -``` -from .short_term_model import VideoModel as VideoModel_pvtv2 -# from .long_term_model import VideoModel as VideoModel_long_term -``` - -注:因为长期模型依赖 CUDA,并且需要在 CUDA 平台进行编译,而本项目基于 MindX SDK 实现,因此使用短期模型。并且,短期模型的评价指标满足预期。 - - -2)修改 `short_term_model.py` 文件中,如下代码行: - -修改 - -``` -def forward(self, x): - image1, image2, image3 = x[:, :3], x[:, 3:6], x[:, 6:] # 替换之前的 image1, image2, image3 = x[0],x[1],x[2] - fmap1=self.backbone.feat_net(image1) - fmap2=self.backbone.feat_net(image2) - fmap3=self.backbone.feat_net(image3) -``` - -修改 - -``` - def __init__(self, args): - super(ImageModel, self).__init__() - self.args = args - # self.backbone = Network(pvtv2_pretrained=self.args.pvtv2_pretrained, imgsize=self.args.trainsize) - self.backbone = Network(pvtv2_pretrained=self.args.pvtv2_pretrained, imgsize=352) # 指定图片大小 - - .... - - # self.backbone = Network(pvtv2_pretrained=False, imgsize=self.args.trainsize) - self.backbone = Network(pvtv2_pretrained=False, imgsize=352) # 指定图片大小 - if self.args.pretrained_cod10k is not None: - self.load_backbone(self.args.pretrained_cod10k ) -``` - - -删除 - -``` -if self.args.pretrained_cod10k is not None: - self.load_backbone(self.args.pretrained_cod10k ) -``` - - -3)`pvtv2_afterTEM.py` 文件注释如下: - -``` -from timm.models import create_model -#from mmseg.models import build_segmentor -#from mmcv import ConfigDict -import pdb -``` - - -修改“SLT-Net-master/mypath.py”文件如下: - -``` -elif dataset == 'MoCA': - return './dataset/MoCA-Mask/' # 将此处路径修改指定为“MoCA_Video”目录的相对路径 -``` - - -可参考已经完成修改的 [SLT_Net_MindXsdk_torch](https://github.com/shuowang-ai/SLT_Net_MindXsdk_torch),也可直接使用该项目进行下面的 onnx 模型转换操作,替代以上步骤。 - - -2、模型转换 - -步骤一、pth模型转onnx模型 - -将 `VCOD_SLTNet` 代码包中的 `torch2onnx.py` 脚本拷贝至 `SLT-Net-master` 目录下,并在 `SLT-Net-master` 目录下执行以下命令将 pth 模型转换成 onnx 模型: - -``` -python torch2onnx.py --pth_path ${pth模型文件路径} --onnx_path ./sltnet.onnx -``` - -参数说明: - -pth_path:pth模型文件名称及所在路径 - -onnx_path:生成输出的onnx模型文件 - - -注意,timm 的版本为 `0.4.12`,其他版本可能有兼容性问题。 - - -步骤二、简化onnx文件(可选操作) - -``` -python -m onnxsim --input-shape="1,9,352,352" --dynamic-input-shape sltnet.onnx sltnet_sim.onnx -``` - -步骤三、onnx模型转om模型 - -``` -atc --framework=5 --model=sltnet.onnx --output=sltnet --input_shape="image:1,9,352,352" --soc_version=Ascend310 --log=error -``` - -注意: - -1. 若想使用转换好的onnx模型或om模型,可通过下载 [models.zip备份模型压缩包](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/models.zip) 解压获得转换好的 onnx 模型或 om 模型。 - -2. pth模型转onnx模型,onnx模型转om模型,均可能花费约1小时左右,视不同运行环境而定。如无报错,请耐心等待。 - - -## 4. 运行推理 - - -使用如下命令,运行 `inference.py` 脚本: - -``` -python inference.py --datapath ${MoCA_Video数据集路径} --save_root ./results/ --om_path ./sltnet.om --testsize 352 --device_id 0 -``` - -参数说明: - -datapath:下载数据以后,目录中 `TestDataset_per_sq` 的上一级目录, - -save_root:结果保存路径 - -om_path:om 模型路径 - -testsize:图片 resize 的大小,当前固定为 352 - -device_id:设备编号 - - -注意,该脚本无需放入修改的 SLT-Net 目录,在任意位置均可执行,只需设置好上述参数即可。 - - -运行输出如下: - -``` - 0%| | 0/713 [00:00 ./results/arctic_fox/Pred/00000.png - 0%|▏ | 1/713 [00:00<10:31, 1.13it/s]> ./results/arctic_fox/Pred/00005.png - 0%|▎ | 2/713 [00:01<09:01, 1.31it/s]> ./results/arctic_fox/Pred/00010.png - 0%|▍ | 3/713 [00:02<08:30, 1.39it/s]> ./results/arctic_fox/Pred/00015.png - 1%|▌ | 4/713 [00:02<08:13, 1.44it/s]> ./results/arctic_fox/Pred/00020.png -``` - -将展示剩余运行时间以及生成图片的路径。 - - -## 5. 精度评估 - -点击访问 [SLT_Net_MindXsdk_torch](https://github.com/shuowang-ai/SLT_Net_MindXsdk_torch) 并下载 `SLT_Net_MindXsdk_torch-master.zip` 代码压缩包,上传服务器并解压获得 `SLT_Net_MindXsdk_torch-master` 目录及相关文件; - -进入 `SLT_Net_MindXsdk_torch-master` 目录,修改 `eval_python/run_eval.py` 脚本中的 `gt_dir` 为本地的 `MoCA_Video/TestDataset_per_sq/` 目录的绝对路径,`pred_dir` 为预测结果目录的绝对路径,并执行以下命令进行精度评估: - -``` -python eval_python/run_eval.py -``` - -完成评估后的结果如下: - -{'Smeasure': 0.6539, 'wFmeasure': 0.3245, 'MAE': 0.0161, 'adpEm': 0.6329, 'meanEm': 0.7229, 'maxEm': 0.7554, 'adpFm': 0.3025, 'meanFm': 0.3577, 'maxFm': 0.3738} - -评测结果高于交付所要求的 Smeasure 0.6 的指标。 - -注:评估还可参考基于 基于 [MATLAB](https://github.com/XuelianCheng/SLT-Net/tree/master/eval) 的 SLT-Net 的评测代码或参考基于 Python 的 [PySODEvalToolkit](https://github.com/lartpang/PySODEvalToolkit) 的评测代码。 -- Gitee From b1147776d5a4ea7ba610d83aa3ff1772630f649a Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:56:41 +0000 Subject: [PATCH 052/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VCOD_SLTNet/README.md | 290 ++++++++++++++++++++++++++++++++++ 1 file changed, 290 insertions(+) create mode 100644 contrib/VCOD_SLTNet/README.md diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md new file mode 100644 index 000000000..6eec8cb1d --- /dev/null +++ b/contrib/VCOD_SLTNet/README.md @@ -0,0 +1,290 @@ +# 视频伪装物体检测 + +## 1 介绍 + +### 1.1 简介 + +基于 MindX SDK 实现 SLT-Net 模型的推理,在 MoCA-Mask 数据集上 Sm 达到大于 0.6。输入连续几帧伪装物体的视频序列,输出伪装物体掩膜 Mask 图。 + + +### 1.2 支持的产品 + +支持昇腾310芯片 + + +### 1.3 支持的版本 + +| 软件名称 | 版本 | +| -------- | ------ | +| mxVision | 5.0.0 | +| Python | 3.9.2 | +| CANN | 7.0.0 | +| PyTorch | 1.12.1 | +| numpy | 1.21.5 | +| imageio | 2.22.3| +| Pillow | 9.3.0 | +| cv2 | 4.5.5 | +| timm | 0.4.12 | +| tqdm | 4.64.1 | +| mindspore | 2.0.0| + + +### 1.4 软件方案介绍 + + +本方案中,先通过 `torch2onnx.py` 脚本将 PyTorch 版本的伪装视频物体检测模型 SLT-Net 转换为 onnx 模型;然后通过 `inference.py` 脚本调用昇腾om模型,将输入视频帧进行图像处理,最终生成视频伪装物体的掩膜 Mask 图。 + + +### 1.5 代码目录结构与说明 + +本sample工程名称为 VCOD_SLTNet,工程目录如下图所示: + +``` +──VCOD_SLTNet + ├── flowchart.jpeg + ├── inference.py # 推理文件 + ├── torch2onnx.py # 模型转换脚本 + └── README.md +``` + + +### 1.6 技术实现流程图 + +![Flowchart](./flowchart.jpeg) + +图1 视频伪装物体检测流程图 + + +### 1.7 特性及适用场景 + +对于伪装视频数据的分割任务均适用,输入视频需要转换为图片序列输入到模型中,具体可以参考 MoCA 数据格式与目录结构(如下所示),详见 [SLT-Net](https://xueliancheng.github.io/SLT-Net-project/) 与 [MoCA 数据集主页](https://www.robots.ox.ac.uk/~vgg/data/MoCA/)。 + + +``` +--data + └── TestDataset_per_sq # 测试数据集 + ├── flower_crab_spider_1 # 不同场景 + ├── GT # Ground Truth + ├── 00000.png + ├── ..... + └── Imgs # 输入图片序列 + ├── 00000.jpg + ├── ..... + ...... + +``` + + +## 2 设置环境变量 + +在运行项目前,需要设置环境变量: + +MindSDK 环境变量: + +```Shell +. ${SDK-path}/set_env.sh +``` + +CANN 环境变量: + +```Shell +. ${ascend-toolkit-path}/set_env.sh +``` + +环境变量介绍 + +SDK-path: mxVision SDK 安装路径 + +ascend-toolkit-path: CANN 安装路径。 + + + +## 3. 准备模型 + +### 3.1 准备相关文件 + +1、SLT-Net代码包准备 + +点击访问 [SLT-Net](https://github.com/XuelianCheng/SLT-Net) 并下载 SLT-Net-master.zip 代码压缩包,上传服务器并解压得到“SLT-Net-master”目录及文件; + +2、SLT-Net模型文件准备 + +方法一:通过访问 [SLT-Net 模型官方链接](https://drive.google.com/file/d/1_u4dEdxM4AKuuh6EcWHAlo8EtR7e8q5v/view) 下载模型压缩包 (注意,需要访问 Google Drive ),解压后将 `Net_epoch_MoCA_short_term_pseudo.pth` 模型拷贝至 `SLT-Net-master` 目录下; + +方法二:下载 [models.zip 备份模型压缩包](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/models.zip) 并解压获得 `sltnet.pth`、`sltnet.onnx`、`sltnet.om` 三个模型文件,将 `sltnet.pth` 模型拷贝至 `SLT-Net-master` 目录下 + + +3、数据集准备 + +通过访问[MoCA官方链接](https://xueliancheng.github.io/SLT-Net-project/)下载 `MoCA_Video` 数据集,或者通过[数据集备份链接](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/MoCA_Video.zip)来下载 `MoCA_Video.zip` 数据集压缩包并解压; + + +### 3.2 模型转换 + +1、SLT-Net代码预处理 + +进入 `SLT-Net-master/lib` 目录下,对 `__init__.py`、`short_term_model.py`、`pvtv2_afterTEM.py`三个文件做以下修改: + +1)`__init__.py`文件注释如下: + +``` +from .short_term_model import VideoModel as VideoModel_pvtv2 +# from .long_term_model import VideoModel as VideoModel_long_term +``` + +注:因为长期模型依赖 CUDA,并且需要在 CUDA 平台进行编译,而本项目基于 MindX SDK 实现,因此使用短期模型。并且,短期模型的评价指标满足预期。 + + +2)修改 `short_term_model.py` 文件中,如下代码行: + +修改 + +``` +def forward(self, x): + image1, image2, image3 = x[:, :3], x[:, 3:6], x[:, 6:] # 替换之前的 image1, image2, image3 = x[0],x[1],x[2] + fmap1=self.backbone.feat_net(image1) + fmap2=self.backbone.feat_net(image2) + fmap3=self.backbone.feat_net(image3) +``` + +修改 + +``` + def __init__(self, args): + super(ImageModel, self).__init__() + self.args = args + # self.backbone = Network(pvtv2_pretrained=self.args.pvtv2_pretrained, imgsize=self.args.trainsize) + self.backbone = Network(pvtv2_pretrained=self.args.pvtv2_pretrained, imgsize=352) # 指定图片大小 + + .... + + # self.backbone = Network(pvtv2_pretrained=False, imgsize=self.args.trainsize) + self.backbone = Network(pvtv2_pretrained=False, imgsize=352) # 指定图片大小 + if self.args.pretrained_cod10k is not None: + self.load_backbone(self.args.pretrained_cod10k ) +``` + + +删除 + +``` +if self.args.pretrained_cod10k is not None: + self.load_backbone(self.args.pretrained_cod10k ) +``` + + +3)`pvtv2_afterTEM.py` 文件注释如下: + +``` +from timm.models import create_model +#from mmseg.models import build_segmentor +#from mmcv import ConfigDict +import pdb +``` + + +修改“SLT-Net-master/mypath.py”文件如下: + +``` +elif dataset == 'MoCA': + return './dataset/MoCA-Mask/' # 将此处路径修改指定为“MoCA_Video”目录的相对路径 +``` + + +可参考已经完成修改的 [SLT_Net_MindXsdk_torch](https://github.com/shuowang-ai/SLT_Net_MindXsdk_torch),也可直接使用该项目进行下面的 onnx 模型转换操作,替代以上步骤。 + + +2、模型转换 + +步骤一、pth模型转onnx模型 + +将 `VCOD_SLTNet` 代码包中的 `torch2onnx.py` 脚本拷贝至 `SLT-Net-master` 目录下,并在 `SLT-Net-master` 目录下执行以下命令将 pth 模型转换成 onnx 模型: + +``` +python torch2onnx.py --pth_path ${pth模型文件路径} --onnx_path ./sltnet.onnx +``` + +参数说明: + +pth_path:pth模型文件名称及所在路径 + +onnx_path:生成输出的onnx模型文件 + + +注意,timm 的版本为 `0.4.12`,其他版本可能有兼容性问题。 + + +步骤二、简化onnx文件(可选操作) + +``` +python -m onnxsim --input-shape="1,9,352,352" --dynamic-input-shape sltnet.onnx sltnet_sim.onnx +``` + +步骤三、onnx模型转om模型 + +``` +atc --framework=5 --model=sltnet.onnx --output=sltnet --input_shape="image:1,9,352,352" --soc_version=Ascend310 --log=error +``` + +注意: + +1. 若想使用转换好的onnx模型或om模型,可通过下载 [models.zip备份模型压缩包](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/sltnet/models.zip) 解压获得转换好的 onnx 模型或 om 模型。 + +2. pth模型转onnx模型,onnx模型转om模型,均可能花费约1小时左右,视不同运行环境而定。如无报错,请耐心等待。 + + +## 4. 运行 + + +使用如下命令,运行 `inference.py` 脚本: + +``` +python inference.py --datapath ${MoCA_Video数据集路径} --save_root ./results/ --om_path ./sltnet.om --testsize 352 --device_id 0 +``` + +参数说明: + +datapath:下载数据以后,目录中 `TestDataset_per_sq` 的上一级目录, + +save_root:结果保存路径 + +om_path:om 模型路径 + +testsize:图片 resize 的大小,当前固定为 352 + +device_id:设备编号 + + +注意,该脚本无需放入修改的 SLT-Net 目录,在任意位置均可执行,只需设置好上述参数即可。 + + +运行输出如下: + +``` + 0%| | 0/713 [00:00 ./results/arctic_fox/Pred/00000.png + 0%|▏ | 1/713 [00:00<10:31, 1.13it/s]> ./results/arctic_fox/Pred/00005.png + 0%|▎ | 2/713 [00:01<09:01, 1.31it/s]> ./results/arctic_fox/Pred/00010.png + 0%|▍ | 3/713 [00:02<08:30, 1.39it/s]> ./results/arctic_fox/Pred/00015.png + 1%|▌ | 4/713 [00:02<08:13, 1.44it/s]> ./results/arctic_fox/Pred/00020.png +``` + +将展示剩余运行时间以及生成图片的路径。 + + +## 5. 精度验证 + +点击访问 [SLT_Net_MindXsdk_torch](https://github.com/shuowang-ai/SLT_Net_MindXsdk_torch) 并下载 `SLT_Net_MindXsdk_torch-master.zip` 代码压缩包,上传服务器并解压获得 `SLT_Net_MindXsdk_torch-master` 目录及相关文件; + +进入 `SLT_Net_MindXsdk_torch-master` 目录,修改 `eval_python/run_eval.py` 脚本中的 `gt_dir` 为本地的 `MoCA_Video/TestDataset_per_sq/` 目录的绝对路径,`pred_dir` 为预测结果目录的绝对路径,并执行以下命令进行精度评估: + +``` +python eval_python/run_eval.py +``` + +完成评估后的结果如下: + +{'Smeasure': 0.6539, 'wFmeasure': 0.3245, 'MAE': 0.0161, 'adpEm': 0.6329, 'meanEm': 0.7229, 'maxEm': 0.7554, 'adpFm': 0.3025, 'meanFm': 0.3577, 'maxFm': 0.3738} + +评测结果高于交付所要求的 Smeasure 0.6 的指标。 + +注:评估还可参考基于 基于 [MATLAB](https://github.com/XuelianCheng/SLT-Net/tree/master/eval) 的 SLT-Net 的评测代码或参考基于 Python 的 [PySODEvalToolkit](https://github.com/lartpang/PySODEvalToolkit) 的评测代码。 -- Gitee From cb4510d55393dc2f96f2650a9566e5142ee77a1f Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:57:16 +0000 Subject: [PATCH 053/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?tutorials/DvppWrapperSample/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tutorials/DvppWrapperSample/README.md | 34 --------------------------- 1 file changed, 34 deletions(-) delete mode 100644 tutorials/DvppWrapperSample/README.md diff --git a/tutorials/DvppWrapperSample/README.md b/tutorials/DvppWrapperSample/README.md deleted file mode 100644 index f2a780367..000000000 --- a/tutorials/DvppWrapperSample/README.md +++ /dev/null @@ -1,34 +0,0 @@ - -# DvppWrapper接口样例 - -## 1 介绍 -提供DvppWrapper接口样例,对图片实现编码,解码,缩放,抠图,以及把样例图片编码为264视频文件。 - -## 2 设置环境变量 -ASCEND_HOME Ascend安装的路径,一般为/usr/local/Ascend -LD_LIBRARY_PATH 指定程序运行时依赖的动态库查找路径 -``` -export ASCEND_HOME=/usr/local/Ascend -export ASCEND_VERSION=nnrt/latest -export ARCH_PATTERN=. -export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib/modelpostprocessors:${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:${LD_LIBRARY_PATH} -``` - -## 3 准备模型 -打开百度图片https://image.baidu.com/,输入任何关键字,然后搜索,右击任意图片,点击另存为。把图片保存在DvppWrapperSample目录下。 - -## 4 编译与运行 -**步骤1** 修改CMakeLists.txt文件 将set(MX_SDK_HOME ${SDK安装路径}) 中的${SDK安装路径}替换为实际的SDK安装路径 - -**步骤2** cd到DvppWrapperSample目录下,执行如下编译命令: -``` -mkdir build -cd build -cmake .. -make -``` -**步骤3** cd到DvppWrapperSample目录下,可看到可执行文件DvppWrapperSample, 实行命令: -``` -./DvppWrapperSample ./保存的图片 -``` -最后会生成缩放resize_result.jpg、抠图后保存的图片write_result_crop.jpg,以及编码保存的视频test.h264。 \ No newline at end of file -- Gitee From fe549f997044947b0c3f405090a80e7c217b1b5d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 18 Oct 2024 08:57:35 +0000 Subject: [PATCH 054/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/DvppWrapperSample/README.md | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tutorials/DvppWrapperSample/README.md diff --git a/tutorials/DvppWrapperSample/README.md b/tutorials/DvppWrapperSample/README.md new file mode 100644 index 000000000..3c113b057 --- /dev/null +++ b/tutorials/DvppWrapperSample/README.md @@ -0,0 +1,47 @@ + +# DvppWrapper接口样例 + +## 1 介绍 + +### 1.1 简介 +提供DvppWrapper接口样例,对图片实现编码,解码,缩放,抠图,以及把样例图片编码为264视频文件。 + +### 1.2 支持的产品 + +本项目以昇腾Atlas310卡为主要的硬件平台。 + +### 1.3 支持的版本 + +| 软件名称 | 版本 | +| -------- | ------ | +| mxVision | 5.0.0 | +| CANN | 7.0.0 | + +## 2 设置环境变量 +ASCEND_HOME Ascend安装的路径,一般为/usr/local/Ascend +LD_LIBRARY_PATH 指定程序运行时依赖的动态库查找路径 +``` +export ASCEND_HOME=/usr/local/Ascend +export ASCEND_VERSION=nnrt/latest +export ARCH_PATTERN=. +export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib/modelpostprocessors:${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:${LD_LIBRARY_PATH} +``` + +## 3 准备模型 +打开百度图片https://image.baidu.com/,输入任何关键字,然后搜索,右击任意图片,点击另存为。把图片保存在DvppWrapperSample目录下。 + +## 4 编译与运行 +**步骤1** 修改CMakeLists.txt文件 将set(MX_SDK_HOME ${SDK安装路径}) 中的${SDK安装路径}替换为实际的SDK安装路径 + +**步骤2** cd到DvppWrapperSample目录下,执行如下编译命令: +``` +mkdir build +cd build +cmake .. +make +``` +**步骤3** cd到DvppWrapperSample目录下,可看到可执行文件DvppWrapperSample, 实行命令: +``` +./DvppWrapperSample ./保存的图片 +``` +最后会生成缩放resize_result.jpg、抠图后保存的图片write_result_crop.jpg,以及编码保存的视频test.h264。 \ No newline at end of file -- Gitee From 38b708f8dd5792129e5943f5a84fa181ec4681b0 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:42:26 +0000 Subject: [PATCH 055/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?tutorials/mxBaseSample/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tutorials/mxBaseSample/README.md | 53 -------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 tutorials/mxBaseSample/README.md diff --git a/tutorials/mxBaseSample/README.md b/tutorials/mxBaseSample/README.md deleted file mode 100644 index 5defb7274..000000000 --- a/tutorials/mxBaseSample/README.md +++ /dev/null @@ -1,53 +0,0 @@ - -# C++ 基于MxBase 的yolov3图像检测样例及yolov3的后处理模块开发 - -## 介绍 -本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行 yolov3 目标检测,并把可视化结果保存到本地。其中包含yolov3的后处理模块开发。 -该Sample的主要处理流程为: -Init > ReadImage >Resize > Inference >PostProcess >DeInit - -## 模型转换 - -**步骤1** 模型获取 -在ModelZoo上下载YOLOv3模型。[下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/ActionRecognition/ATC%20YOLOv3%28FP16%29%20from%20TensorFlow%20-%20Ascend310.zip) -**步骤2** 模型存放 -将获取到的YOLOv3模型pb文件放至上一级的models文件夹中 -**步骤3** 执行模型转换命令 - -(1) 配置环境变量 -#### 设置环境变量(请确认install_path路径是否正确) -#### Set environment PATH (Please confirm that the install_path is correct). -```c -export install_path=/usr/local/Ascend/ascend-toolkit/latest -export PATH=/usr/local/python3.9.2/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH -export PYTHONPATH=${install_path}/atc/python/site-packages:${install_path}/atc/python/site-packages/auto_tune.egg/auto_tune:${install_path}/atc/python/site-packages/schedule_search.egg:$PYTHONPATH -export LD_LIBRARY_PATH=${install_path}/atc/lib64:$LD_LIBRARY_PATH -export ASCEND_OPP_PATH=${install_path}/opp - -``` -(2) 转换模型 -``` -atc --model=./yolov3_tf.pb --framework=3 --output=./yolov3_tf_bs1_fp16 --soc_version=Ascend310 --insert_op_conf=./aipp_yolov3_416_416.aippconfig --input_shape="input:1,416,416,3" --out_nodes="yolov3/yolov3_head/Conv_6/BiasAdd:0;yolov3/yolov3_head/Conv_14/BiasAdd:0;yolov3/yolov3_head/Conv_22/BiasAdd:0" -``` - -## 编译与运行 -**步骤1** 修改CMakeLists.txt文件 将set(MX_SDK_HOME ${SDK安装路径}) 中的${SDK安装路径}替换为实际的SDK安装路径 - -**步骤2** 设置环境变量 -ASCEND_HOME Ascend安装的路径,一般为/usr/local/Ascend -LD_LIBRARY_PATH 指定程序运行时依赖的动态库查找路径,包括ACL,开源软件库,libmxbase.so以及libyolov3postprocess.so的路径 -``` -export ASCEND_HOME=/usr/local/Ascend -export ASCEND_VERSION=nnrt/latest -export ARCH_PATTERN=. -export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib/modelpostprocessors:${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:${LD_LIBRARY_PATH} -``` - -**步骤3** cd到mxbase目录下,执行如下编译命令: -bash build.sh - -**步骤4** 制定jpg图片进行推理,准备一张推理图片放入mxbase 目录下。eg:推理图片为test.jpg -cd 到mxbase 目录下 -``` -./mxBase_sample ./test.jpg -``` -- Gitee From eb3a0c83032252035f147ece7427ef0c1789e52a Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:42:53 +0000 Subject: [PATCH 056/129] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/mxBaseSample/README.md | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tutorials/mxBaseSample/README.md diff --git a/tutorials/mxBaseSample/README.md b/tutorials/mxBaseSample/README.md new file mode 100644 index 000000000..431ae7d8f --- /dev/null +++ b/tutorials/mxBaseSample/README.md @@ -0,0 +1,65 @@ + +# C++ 基于MxBase 的yolov3图像检测样例及yolov3的后处理模块开发 + +## 1 介绍 +### 1.1 简介 +本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行 yolov3 目标检测,并把可视化结果保存到本地。其中包含yolov3的后处理模块开发。 + +### 1.2 支持的产品 +本项目以昇腾Atlas310p为主要的硬件平台。 + +### 1.3 支持的版本 + +| 软件名称 | 版本 | +| -------- | ------ | +| mxVision | 6.0.RC2 | +| CANN | 7.0.0 | + + +## 2 设置环境变量 +确保环境中正确安装mxVision SDK。 + +在编译运行项目前,需要设置环境变量: + +``` +# 设置环境变量 +. ${ascend-toolkit-path}/set_env.sh +. ${SDK-path}/set_env.sh + +# 环境变量介绍 +ascend-toolkit-path: CANN 安装路径 +SDK-path: SDK mxVision 安装路径 +``` + +## 3 准备模型 +**步骤1** 模型获取 +在ModelZoo上下载YOLOv3模型。[下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/ActionRecognition/ATC%20YOLOv3%28FP16%29%20from%20TensorFlow%20-%20Ascend310.zip) +**步骤2** 模型存放 +将获取到的YOLOv3模型pb文件放至上一级的models文件夹中 +**步骤3** 执行模型转换命令 + +``` +atc --model=./yolov3_tf.pb --framework=3 --output=./yolov3_tf_bs1_fp16 --soc_version=Ascend310 --insert_op_conf=./aipp_yolov3_416_416.aippconfig --input_shape="input:1,416,416,3" --out_nodes="yolov3/yolov3_head/Conv_6/BiasAdd:0;yolov3/yolov3_head/Conv_14/BiasAdd:0;yolov3/yolov3_head/Conv_22/BiasAdd:0" +``` + +## 4 编译与运行 +**步骤1** 修改CMakeLists.txt文件 将set(MX_SDK_HOME ${SDK安装路径}) 中的${SDK安装路径}替换为实际的SDK安装路径 + +**步骤2** 设置环境变量 +ASCEND_HOME Ascend安装的路径,一般为/usr/local/Ascend +LD_LIBRARY_PATH 指定程序运行时依赖的动态库查找路径,包括ACL,开源软件库,libmxbase.so以及libyolov3postprocess.so的路径 +``` +export ASCEND_HOME=/usr/local/Ascend +export ASCEND_VERSION=nnrt/latest +export ARCH_PATTERN=. +export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib/modelpostprocessors:${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:${LD_LIBRARY_PATH} +``` + +**步骤3** cd到mxbase目录下,执行如下编译命令: +bash build.sh + +**步骤4** 制定jpg图片进行推理,准备一张推理图片放入mxbase 目录下。eg:推理图片为test.jpg +cd 到mxbase 目录下 +``` +./mxBase_sample ./test.jpg +``` -- Gitee From 755a96bdaabc09596004fdccf7682bd05969dea0 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:44:04 +0000 Subject: [PATCH 057/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index f3a3bbd3d..9380c36cd 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -12,8 +12,6 @@ ### 1.3 支持的版本 -推荐系统为ubuntu 18.04。 - 表1.1 环境依赖软件和版本: | 软件名称 | 版本 | -- Gitee From 8ea3413ecea93fd2889d652093af7d66bc9068a7 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:52:15 +0000 Subject: [PATCH 058/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yolov3Detection/Yolov3Detection.cpp | 342 ------------------ 1 file changed, 342 deletions(-) delete mode 100644 tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.cpp diff --git a/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.cpp b/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.cpp deleted file mode 100644 index 761be3d81..000000000 --- a/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "opencv2/opencv.hpp" -#include "Yolov3Detection.h" -#include "MxBase/DeviceManager/DeviceManager.h" -#include "MxBase/Log/Log.h" -#include -#include -#include - -namespace{ - const uint32_t YUV_BYTE_NU = 3; - const uint32_t YUV_BYTE_DE = 2; - const uint32_t VPC_H_ALIGN = 2; -} - -// 加载标签文件 -APP_ERROR Yolov3Detection::LoadLabels(const std::string &labelPath, std::map &labelMap) { - std::ifstream infile; - // open label file - infile.open(labelPath, std::ios_base::in); - std::string s; - // check label file validity - if (infile.fail()) { - LogError << "Failed to open label file: " << labelPath << "."; - return APP_ERR_COMM_OPEN_FAIL; - } - labelMap.clear(); - // construct label map - int count = 0; - while (std::getline(infile, s)) { - if (s.find('#') <= 1) { - continue; - } - size_t eraseIndex = s.find_last_not_of("\r\n\t"); - if (eraseIndex != std::string::npos) { - s.erase(eraseIndex + 1, s.size() - eraseIndex); - } - labelMap.insert(std::pair(count, s)); - count++; - } - infile.close(); - return APP_ERR_OK; -} - -// 设置配置参数 -void Yolov3Detection::SetYolov3PostProcessConfig(const InitParam &initParam, - std::map> &config) { - MxBase::ConfigData configData; - const std::string checkTensor = initParam.checkTensor ? "true" : "false"; - configData.SetJsonValue("CLASS_NUM", std::to_string(initParam.classNum)); - configData.SetJsonValue("BIASES_NUM", std::to_string(initParam.biasesNum)); - configData.SetJsonValue("BIASES", initParam.biases); - configData.SetJsonValue("OBJECTNESS_THRESH", initParam.objectnessThresh); - configData.SetJsonValue("IOU_THRESH", initParam.iouThresh); - configData.SetJsonValue("SCORE_THRESH", initParam.scoreThresh); - configData.SetJsonValue("YOLO_TYPE", std::to_string(initParam.yoloType)); - configData.SetJsonValue("MODEL_TYPE", std::to_string(initParam.modelType)); - configData.SetJsonValue("INPUT_TYPE", std::to_string(initParam.inputType)); - configData.SetJsonValue("ANCHOR_DIM", std::to_string(initParam.anchorDim)); - configData.SetJsonValue("CHECK_MODEL", checkTensor); - - auto jsonStr = configData.GetCfgJson().serialize(); - config["postProcessConfigContent"] = std::make_shared(jsonStr); - config["labelPath"] = std::make_shared(initParam.labelPath); -} - -APP_ERROR Yolov3Detection::Init(const InitParam &initParam) { - deviceId_ = initParam.deviceId; - APP_ERROR ret = MxBase::DeviceManager::GetInstance()->InitDevices(); - if (ret != APP_ERR_OK) { - LogError << "Init devices failed, ret=" << ret << "."; - return ret; - } - ret = MxBase::TensorContext::GetInstance()->SetContext(initParam.deviceId); - if (ret != APP_ERR_OK) { - LogError << "Set context failed, ret=" << ret << "."; - return ret; - } - dvppWrapper_ = std::make_shared(); - ret = dvppWrapper_->Init(); - if (ret != APP_ERR_OK) { - LogError << "DvppWrapper init failed, ret=" << ret << "."; - return ret; - } - model_ = std::make_shared(); - ret = model_->Init(initParam.modelPath, modelDesc_); - if (ret != APP_ERR_OK) { - LogError << "ModelInferenceProcessor init failed, ret=" << ret << "."; - return ret; - } - - std::map> config; - SetYolov3PostProcessConfig(initParam, config); - // 初始化yolov3后处理对象 - post_ = std::make_shared(); - ret = post_->Init(config); - if (ret != APP_ERR_OK) { - LogError << "Yolov3PostProcess init failed, ret=" << ret << "."; - return ret; - } - // load labels from file - ret = LoadLabels(initParam.labelPath, labelMap_); - if (ret != APP_ERR_OK) { - LogError << "Failed to load labels, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR Yolov3Detection::DeInit() { - dvppWrapper_->DeInit(); - model_->DeInit(); - post_->DeInit(); - MxBase::DeviceManager::GetInstance()->DestroyDevices(); - return APP_ERR_OK; -} - -// 获取图像数据,将数据存入TensorBase中 -APP_ERROR Yolov3Detection::ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor) { - MxBase::DvppDataInfo output = {}; - // 图像解码 - APP_ERROR ret = dvppWrapper_->DvppJpegDecode(imgPath, output); - if (ret != APP_ERR_OK) { - LogError << "DvppWrapper DvppJpegDecode failed, ret=" << ret << "."; - return ret; - } - // 将数据转为到DEVICE侧,以便后续处理 - MxBase::MemoryData memoryData((void*)output.data, output.dataSize, - MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - // 对解码后图像对齐尺寸进行判定 - if (output.heightStride % VPC_H_ALIGN != 0) { - LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; - MxBase::MemoryHelper::MxbsFree(memoryData); - return APP_ERR_COMM_INVALID_PARAM; - } - std::vector shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; - tensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); - return APP_ERR_OK; -} - -APP_ERROR Yolov3Detection::Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor) { - auto shape = inputTensor.GetShape(); - MxBase::DvppDataInfo input = {}; - // 还原为原始尺寸 - input.height = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; - input.width = shape[1]; - input.heightStride = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; - input.widthStride = shape[1]; - input.dataSize = inputTensor.GetByteSize(); - input.data = (uint8_t*)inputTensor.GetBuffer(); - const uint32_t resizeHeight = 416; - const uint32_t resizeWidth = 416; - MxBase::ResizeConfig resize = {}; - resize.height = resizeHeight; - resize.width = resizeWidth; - MxBase::DvppDataInfo output = {}; - // 图像缩放 - APP_ERROR ret = dvppWrapper_->VpcResize(input, output, resize); - if (ret != APP_ERR_OK) { - LogError << "VpcResize failed, ret=" << ret << "."; - return ret; - } - MxBase::MemoryData memoryData((void*)output.data, output.dataSize, - MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - // 对缩放后图像对齐尺寸进行判定 - if (output.heightStride % VPC_H_ALIGN != 0) { - LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; - MxBase::MemoryHelper::MxbsFree(memoryData); - return APP_ERR_COMM_INVALID_PARAM; - } - shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; - outputTensor = MxBase::TensorBase(memoryData, false, shape,MxBase::TENSOR_DTYPE_UINT8); - return APP_ERR_OK; -} - -// 模型推理 -APP_ERROR Yolov3Detection::Inference(const std::vector &inputs, - std::vector &outputs) { - auto dtypes = model_->GetOutputDataType(); - for (size_t i = 0; i < modelDesc_.outputTensors.size(); ++i) { - std::vector shape = {}; - // yolov3模型3个检测特征图尺寸(13 * 13 26 * 26 52 *52) - for (size_t j = 0; j < modelDesc_.outputTensors[i].tensorDims.size(); ++j) { - shape.push_back((uint32_t)modelDesc_.outputTensors[i].tensorDims[j]); - } - // 用3个检测特征图尺寸分别构建3个数据为空的tensor - MxBase::TensorBase tensor(shape, dtypes[i], MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); - APP_ERROR ret = MxBase::TensorBase::TensorBaseMalloc(tensor); - if (ret != APP_ERR_OK) { - LogError << "TensorBaseMalloc failed, ret=" << ret << "."; - return ret; - } - // 将tensor存入outputs中 - outputs.push_back(tensor); - } - MxBase::DynamicInfo dynamicInfo = {}; - // 设置类型为静态batch - dynamicInfo.dynamicType = MxBase::DynamicType::STATIC_BATCH; - APP_ERROR ret = model_->ModelInference(inputs, outputs, dynamicInfo); - if (ret != APP_ERR_OK) { - LogError << "ModelInference failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} - -// 后处理 -APP_ERROR Yolov3Detection::PostProcess(const MxBase::TensorBase &tensor, - const std::vector &outputs, - std::vector> &objInfos) -{ - // 通过原始图像tensor构建ResizedImageInfo - auto shape = tensor.GetShape(); - MxBase::ResizedImageInfo imgInfo; - imgInfo.widthOriginal = shape[1]; - imgInfo.heightOriginal = shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; - imgInfo.widthResize = 416; - imgInfo.heightResize = 416; - imgInfo.resizeType = MxBase::RESIZER_STRETCHING; - std::vector imageInfoVec = {}; - imageInfoVec.push_back(imgInfo); - // use Yolov3PostProcess post_; - APP_ERROR ret = post_->Process(outputs, objInfos, imageInfoVec); - - if (ret != APP_ERR_OK) { - LogError << "Process failed, ret=" << ret << "."; - return ret; - } - - ret = post_->DeInit(); - if (ret != APP_ERR_OK) { - LogError << "Yolov3PostProcess DeInit failed"; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR Yolov3Detection::WriteResult(MxBase::TensorBase &tensor, - const std::vector> &objInfos) -{ - APP_ERROR ret = tensor.ToHost(); - if (ret != APP_ERR_OK) { - LogError << "ToHost faile"; - return ret; - } - auto shape = tensor.GetShape(); - // 初始化OpenCV图像信息矩阵 - cv::Mat imgYuv = cv::Mat(shape[0], shape[1], CV_8UC1, tensor.GetBuffer()); - cv::Mat imgBgr = cv::Mat(shape[0] * YUV_BYTE_DE / YUV_BYTE_NU, shape[1], CV_8UC3); - // 颜色空间转换 - cv::cvtColor(imgYuv, imgBgr, cv::COLOR_YUV2BGR_NV12); - - uint32_t batchSize = objInfos.size(); - std::vector resultInfo; - for (uint32_t i = 0; i < batchSize; i++) { - float maxConfidence = 0; - uint32_t index; - for (uint32_t j = 0; j < objInfos[i].size(); j++) { - if(objInfos[i][j].confidence > maxConfidence) { - maxConfidence = objInfos[i][j].confidence; - index = j; - } - } - resultInfo.push_back(objInfos[i][index]); - // 打印置信度最大推理结果 - LogInfo << "id: " << resultInfo[i].classId << "; lable: " << resultInfo[i].className - << "; confidence: " << resultInfo[i].confidence - << "; box: [ (" << resultInfo[i].x0 << "," << resultInfo[i].y0 << ") " - << "(" << resultInfo[i].x1 << "," << resultInfo[i].y1 << ") ]" ; - - const cv::Scalar green = cv::Scalar(0, 255, 0); - const uint32_t thickness = 4; - const uint32_t xOffset = 10; - const uint32_t yOffset = 10; - const uint32_t lineType = 8; - const float fontScale = 1.0; - - // 在图像上绘制文字 - cv::putText(imgBgr, resultInfo[i].className, cv::Point(resultInfo[i].x0 + xOffset, resultInfo[i].y0 + yOffset), - cv::FONT_HERSHEY_SIMPLEX, fontScale, green, thickness, lineType); - // 绘制矩形 - cv::rectangle(imgBgr,cv::Rect(resultInfo[i].x0, resultInfo[i].y0, - resultInfo[i].x1 - resultInfo[i].x0, resultInfo[i].y1 - resultInfo[i].y0), - green, thickness); - } - // 把Mat类型的图像矩阵保存为图像到指定位置。 - cv::imwrite("./result.jpg", imgBgr); - return APP_ERR_OK; -} - -APP_ERROR Yolov3Detection::Process(const std::string &imgPath) { - MxBase::TensorBase inTensor; - APP_ERROR ret = ReadImage(imgPath, inTensor); - if (ret != APP_ERR_OK) { - LogError << "ReadImage failed, ret=" << ret << "."; - return ret; - } - - MxBase::TensorBase outTensor; - ret = Resize(inTensor, outTensor); - if (ret != APP_ERR_OK) { - LogError << "Resize failed, ret=" << ret << "."; - return ret; - } - - std::vector inputs = {}; - std::vector outputs = {}; - inputs.push_back(outTensor); - ret = Inference(inputs, outputs); - if (ret != APP_ERR_OK) { - LogError << "Inference failed, ret=" << ret << "."; - return ret; - } - - std::vector> objInfos; - ret = PostProcess(inTensor, outputs, objInfos); - if (ret != APP_ERR_OK) { - LogError << "PostProcess failed, ret=" << ret << "."; - return ret; - } - - ret = WriteResult(inTensor, objInfos); - if (ret != APP_ERR_OK) { - LogError << "Save result failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} \ No newline at end of file -- Gitee From 32f7c0662062ca8b36a3150ecce2384ae891c1a6 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:52:33 +0000 Subject: [PATCH 059/129] =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- .../yolov3Detection/Yolov3Detection.cpp | 342 ++++++++++++++++++ 1 file changed, 342 insertions(+) create mode 100644 tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.cpp diff --git a/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.cpp b/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.cpp new file mode 100644 index 000000000..c93b873cd --- /dev/null +++ b/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.cpp @@ -0,0 +1,342 @@ +/* + * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "opencv2/opencv.hpp" +#include "Yolov3Detection.h" +#include "MxBase/DeviceManager/DeviceManager.h" +#include "MxBase/Log/Log.h" +#include +#include +#include + +namespace{ + const uint32_t YUV_BYTE_NU = 3; + const uint32_t YUV_BYTE_DE = 2; + const uint32_t VPC_H_ALIGN = 2; +} + +// 加载标签文件 +APP_ERROR Yolov3Detection::LoadLabels(const std::string &labelPath, std::map &labelMap) { + std::ifstream infile; + // open label file + infile.open(labelPath, std::ios_base::in); + std::string s; + // check label file validity + if (infile.fail()) { + LogError << "Failed to open label file: " << labelPath << "."; + return APP_ERR_COMM_OPEN_FAIL; + } + labelMap.clear(); + // construct label map + int count = 0; + while (std::getline(infile, s)) { + if (s.find('#') <= 1) { + continue; + } + size_t eraseIndex = s.find_last_not_of("\r\n\t"); + if (eraseIndex != std::string::npos) { + s.erase(eraseIndex + 1, s.size() - eraseIndex); + } + labelMap.insert(std::pair(count, s)); + count++; + } + infile.close(); + return APP_ERR_OK; +} + +// 设置配置参数 +void Yolov3Detection::SetYolov3PostProcessConfig(const InitParam &initParam, + std::map &config) { + MxBase::ConfigData configData; + const std::string checkTensor = initParam.checkTensor ? "true" : "false"; + configData.SetJsonValue("CLASS_NUM", std::to_string(initParam.classNum)); + configData.SetJsonValue("BIASES_NUM", std::to_string(initParam.biasesNum)); + configData.SetJsonValue("BIASES", initParam.biases); + configData.SetJsonValue("OBJECTNESS_THRESH", initParam.objectnessThresh); + configData.SetJsonValue("IOU_THRESH", initParam.iouThresh); + configData.SetJsonValue("SCORE_THRESH", initParam.scoreThresh); + configData.SetJsonValue("YOLO_TYPE", std::to_string(initParam.yoloType)); + configData.SetJsonValue("MODEL_TYPE", std::to_string(initParam.modelType)); + configData.SetJsonValue("INPUT_TYPE", std::to_string(initParam.inputType)); + configData.SetJsonValue("ANCHOR_DIM", std::to_string(initParam.anchorDim)); + configData.SetJsonValue("CHECK_MODEL", checkTensor); + + auto jsonStr = configData.GetCfgJson(); + config["postProcessConfigContent"] = jsonStr; + config["labelPath"] = initParam.labelPath; +} + +APP_ERROR Yolov3Detection::Init(const InitParam &initParam) { + deviceId_ = initParam.deviceId; + APP_ERROR ret = MxBase::DeviceManager::GetInstance()->InitDevices(); + if (ret != APP_ERR_OK) { + LogError << "Init devices failed, ret=" << ret << "."; + return ret; + } + ret = MxBase::TensorContext::GetInstance()->SetContext(initParam.deviceId); + if (ret != APP_ERR_OK) { + LogError << "Set context failed, ret=" << ret << "."; + return ret; + } + dvppWrapper_ = std::make_shared(); + ret = dvppWrapper_->Init(); + if (ret != APP_ERR_OK) { + LogError << "DvppWrapper init failed, ret=" << ret << "."; + return ret; + } + model_ = std::make_shared(); + ret = model_->Init(initParam.modelPath, modelDesc_); + if (ret != APP_ERR_OK) { + LogError << "ModelInferenceProcessor init failed, ret=" << ret << "."; + return ret; + } + + std::map config; + SetYolov3PostProcessConfig(initParam, config); + // 初始化yolov3后处理对象 + post_ = std::make_shared(); + ret = post_->Init(config); + if (ret != APP_ERR_OK) { + LogError << "Yolov3PostProcess init failed, ret=" << ret << "."; + return ret; + } + // load labels from file + ret = LoadLabels(initParam.labelPath, labelMap_); + if (ret != APP_ERR_OK) { + LogError << "Failed to load labels, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} + +APP_ERROR Yolov3Detection::DeInit() { + dvppWrapper_->DeInit(); + model_->DeInit(); + post_->DeInit(); + MxBase::DeviceManager::GetInstance()->DestroyDevices(); + return APP_ERR_OK; +} + +// 获取图像数据,将数据存入TensorBase中 +APP_ERROR Yolov3Detection::ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor) { + MxBase::DvppDataInfo output = {}; + // 图像解码 + APP_ERROR ret = dvppWrapper_->DvppJpegDecode(imgPath, output); + if (ret != APP_ERR_OK) { + LogError << "DvppWrapper DvppJpegDecode failed, ret=" << ret << "."; + return ret; + } + // 将数据转为到DEVICE侧,以便后续处理 + MxBase::MemoryData memoryData((void*)output.data, output.dataSize, + MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + // 对解码后图像对齐尺寸进行判定 + if (output.heightStride % VPC_H_ALIGN != 0) { + LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; + MxBase::MemoryHelper::MxbsFree(memoryData); + return APP_ERR_COMM_INVALID_PARAM; + } + std::vector shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; + tensor = MxBase::TensorBase(memoryData, false, shape, MxBase::TENSOR_DTYPE_UINT8); + return APP_ERR_OK; +} + +APP_ERROR Yolov3Detection::Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor) { + auto shape = inputTensor.GetShape(); + MxBase::DvppDataInfo input = {}; + // 还原为原始尺寸 + input.height = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; + input.width = shape[1]; + input.heightStride = (uint32_t)shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; + input.widthStride = shape[1]; + input.dataSize = inputTensor.GetByteSize(); + input.data = (uint8_t*)inputTensor.GetBuffer(); + const uint32_t resizeHeight = 416; + const uint32_t resizeWidth = 416; + MxBase::ResizeConfig resize = {}; + resize.height = resizeHeight; + resize.width = resizeWidth; + MxBase::DvppDataInfo output = {}; + // 图像缩放 + APP_ERROR ret = dvppWrapper_->VpcResize(input, output, resize); + if (ret != APP_ERR_OK) { + LogError << "VpcResize failed, ret=" << ret << "."; + return ret; + } + MxBase::MemoryData memoryData((void*)output.data, output.dataSize, + MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + // 对缩放后图像对齐尺寸进行判定 + if (output.heightStride % VPC_H_ALIGN != 0) { + LogError << "Output data height(" << output.heightStride << ") can't be divided by " << VPC_H_ALIGN << "."; + MxBase::MemoryHelper::MxbsFree(memoryData); + return APP_ERR_COMM_INVALID_PARAM; + } + shape = {output.heightStride * YUV_BYTE_NU / YUV_BYTE_DE, output.widthStride}; + outputTensor = MxBase::TensorBase(memoryData, false, shape,MxBase::TENSOR_DTYPE_UINT8); + return APP_ERR_OK; +} + +// 模型推理 +APP_ERROR Yolov3Detection::Inference(const std::vector &inputs, + std::vector &outputs) { + auto dtypes = model_->GetOutputDataType(); + for (size_t i = 0; i < modelDesc_.outputTensors.size(); ++i) { + std::vector shape = {}; + // yolov3模型3个检测特征图尺寸(13 * 13 26 * 26 52 *52) + for (size_t j = 0; j < modelDesc_.outputTensors[i].tensorDims.size(); ++j) { + shape.push_back((uint32_t)modelDesc_.outputTensors[i].tensorDims[j]); + } + // 用3个检测特征图尺寸分别构建3个数据为空的tensor + MxBase::TensorBase tensor(shape, dtypes[i], MxBase::MemoryData::MemoryType::MEMORY_DEVICE, deviceId_); + APP_ERROR ret = MxBase::TensorBase::TensorBaseMalloc(tensor); + if (ret != APP_ERR_OK) { + LogError << "TensorBaseMalloc failed, ret=" << ret << "."; + return ret; + } + // 将tensor存入outputs中 + outputs.push_back(tensor); + } + MxBase::DynamicInfo dynamicInfo = {}; + // 设置类型为静态batch + dynamicInfo.dynamicType = MxBase::DynamicType::STATIC_BATCH; + APP_ERROR ret = model_->ModelInference(inputs, outputs, dynamicInfo); + if (ret != APP_ERR_OK) { + LogError << "ModelInference failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} + +// 后处理 +APP_ERROR Yolov3Detection::PostProcess(const MxBase::TensorBase &tensor, + const std::vector &outputs, + std::vector> &objInfos) +{ + // 通过原始图像tensor构建ResizedImageInfo + auto shape = tensor.GetShape(); + MxBase::ResizedImageInfo imgInfo; + imgInfo.widthOriginal = shape[1]; + imgInfo.heightOriginal = shape[0] * YUV_BYTE_DE / YUV_BYTE_NU; + imgInfo.widthResize = 416; + imgInfo.heightResize = 416; + imgInfo.resizeType = MxBase::RESIZER_STRETCHING; + std::vector imageInfoVec = {}; + imageInfoVec.push_back(imgInfo); + // use Yolov3PostProcess post_; + APP_ERROR ret = post_->Process(outputs, objInfos, imageInfoVec); + + if (ret != APP_ERR_OK) { + LogError << "Process failed, ret=" << ret << "."; + return ret; + } + + ret = post_->DeInit(); + if (ret != APP_ERR_OK) { + LogError << "Yolov3PostProcess DeInit failed"; + return ret; + } + return APP_ERR_OK; +} + +APP_ERROR Yolov3Detection::WriteResult(MxBase::TensorBase &tensor, + const std::vector> &objInfos) +{ + APP_ERROR ret = tensor.ToHost(); + if (ret != APP_ERR_OK) { + LogError << "ToHost faile"; + return ret; + } + auto shape = tensor.GetShape(); + // 初始化OpenCV图像信息矩阵 + cv::Mat imgYuv = cv::Mat(shape[0], shape[1], CV_8UC1, tensor.GetBuffer()); + cv::Mat imgBgr = cv::Mat(shape[0] * YUV_BYTE_DE / YUV_BYTE_NU, shape[1], CV_8UC3); + // 颜色空间转换 + cv::cvtColor(imgYuv, imgBgr, cv::COLOR_YUV2BGR_NV12); + + uint32_t batchSize = objInfos.size(); + std::vector resultInfo; + for (uint32_t i = 0; i < batchSize; i++) { + float maxConfidence = 0; + uint32_t index; + for (uint32_t j = 0; j < objInfos[i].size(); j++) { + if(objInfos[i][j].confidence > maxConfidence) { + maxConfidence = objInfos[i][j].confidence; + index = j; + } + } + resultInfo.push_back(objInfos[i][index]); + // 打印置信度最大推理结果 + LogInfo << "id: " << resultInfo[i].classId << "; lable: " << resultInfo[i].className + << "; confidence: " << resultInfo[i].confidence + << "; box: [ (" << resultInfo[i].x0 << "," << resultInfo[i].y0 << ") " + << "(" << resultInfo[i].x1 << "," << resultInfo[i].y1 << ") ]" ; + + const cv::Scalar green = cv::Scalar(0, 255, 0); + const uint32_t thickness = 4; + const uint32_t xOffset = 10; + const uint32_t yOffset = 10; + const uint32_t lineType = 8; + const float fontScale = 1.0; + + // 在图像上绘制文字 + cv::putText(imgBgr, resultInfo[i].className, cv::Point(resultInfo[i].x0 + xOffset, resultInfo[i].y0 + yOffset), + cv::FONT_HERSHEY_SIMPLEX, fontScale, green, thickness, lineType); + // 绘制矩形 + cv::rectangle(imgBgr,cv::Rect(resultInfo[i].x0, resultInfo[i].y0, + resultInfo[i].x1 - resultInfo[i].x0, resultInfo[i].y1 - resultInfo[i].y0), + green, thickness); + } + // 把Mat类型的图像矩阵保存为图像到指定位置。 + cv::imwrite("./result.jpg", imgBgr); + return APP_ERR_OK; +} + +APP_ERROR Yolov3Detection::Process(const std::string &imgPath) { + MxBase::TensorBase inTensor; + APP_ERROR ret = ReadImage(imgPath, inTensor); + if (ret != APP_ERR_OK) { + LogError << "ReadImage failed, ret=" << ret << "."; + return ret; + } + + MxBase::TensorBase outTensor; + ret = Resize(inTensor, outTensor); + if (ret != APP_ERR_OK) { + LogError << "Resize failed, ret=" << ret << "."; + return ret; + } + + std::vector inputs = {}; + std::vector outputs = {}; + inputs.push_back(outTensor); + ret = Inference(inputs, outputs); + if (ret != APP_ERR_OK) { + LogError << "Inference failed, ret=" << ret << "."; + return ret; + } + + std::vector> objInfos; + ret = PostProcess(inTensor, outputs, objInfos); + if (ret != APP_ERR_OK) { + LogError << "PostProcess failed, ret=" << ret << "."; + return ret; + } + + ret = WriteResult(inTensor, objInfos); + if (ret != APP_ERR_OK) { + LogError << "Save result failed, ret=" << ret << "."; + return ret; + } + return APP_ERR_OK; +} -- Gitee From a30d66faed218dab44701ebb6479dcbc73689457 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:53:59 +0000 Subject: [PATCH 060/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yolov3Detection/Yolov3Detection.h | 66 ------------------- 1 file changed, 66 deletions(-) delete mode 100644 tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.h diff --git a/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.h b/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.h deleted file mode 100644 index a0ca54c42..000000000 --- a/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MXBASE_YOLOV3DETECTION_H -#define MXBASE_YOLOV3DETECTION_H - -#include -#include "MxBase/DvppWrapper/DvppWrapper.h" -#include "MxBase/ModelInfer/ModelInferenceProcessor.h" -#include "MxBase/Tensor/TensorContext/TensorContext.h" - -struct InitParam { - uint32_t deviceId; - std::string labelPath; - bool checkTensor; - std::string modelPath; - uint32_t classNum; - uint32_t biasesNum; - std::string biases; - std::string objectnessThresh; - std::string iouThresh; - std::string scoreThresh; - uint32_t yoloType; - uint32_t modelType; - uint32_t inputType; - uint32_t anchorDim; -}; - -class Yolov3Detection { -public: - APP_ERROR Init(const InitParam &initParam); - APP_ERROR DeInit(); - APP_ERROR Inference(const std::vector &inputs, std::vector &outputs); - APP_ERROR PostProcess(const MxBase::TensorBase &tensor, const std::vector &outputs, - std::vector> &objInfos); - APP_ERROR Process(const std::string &imgPath); -protected: - APP_ERROR ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor); - APP_ERROR Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor); - APP_ERROR LoadLabels(const std::string &labelPath, std::map &labelMap); - APP_ERROR WriteResult(MxBase::TensorBase &tensor, - const std::vector> &objInfos); - void SetYolov3PostProcessConfig(const InitParam &initParam, std::map> &config); -private: - std::shared_ptr dvppWrapper_; // 封装DVPP基本编码、解码、扣图功能 - std::shared_ptr model_; // 模型推理功能处理 - std::shared_ptr post_; - MxBase::ModelDesc modelDesc_ = {}; // 模型描述信息 - std::map labelMap_ = {}; - uint32_t deviceId_ = 0; - -}; -#endif \ No newline at end of file -- Gitee From 522f2d1aadc0969e079f961da16e99bb43fcee39 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:54:10 +0000 Subject: [PATCH 061/129] =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- .../yolov3Detection/Yolov3Detection.h | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.h diff --git a/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.h b/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.h new file mode 100644 index 000000000..69bbc31d3 --- /dev/null +++ b/tutorials/mxBaseSample/yolov3Detection/Yolov3Detection.h @@ -0,0 +1,66 @@ +/* + * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MXBASE_YOLOV3DETECTION_H +#define MXBASE_YOLOV3DETECTION_H + +#include +#include "MxBase/DvppWrapper/DvppWrapper.h" +#include "MxBase/ModelInfer/ModelInferenceProcessor.h" +#include "MxBase/Tensor/TensorContext/TensorContext.h" + +struct InitParam { + uint32_t deviceId; + std::string labelPath; + bool checkTensor; + std::string modelPath; + uint32_t classNum; + uint32_t biasesNum; + std::string biases; + std::string objectnessThresh; + std::string iouThresh; + std::string scoreThresh; + uint32_t yoloType; + uint32_t modelType; + uint32_t inputType; + uint32_t anchorDim; +}; + +class Yolov3Detection { +public: + APP_ERROR Init(const InitParam &initParam); + APP_ERROR DeInit(); + APP_ERROR Inference(const std::vector &inputs, std::vector &outputs); + APP_ERROR PostProcess(const MxBase::TensorBase &tensor, const std::vector &outputs, + std::vector> &objInfos); + APP_ERROR Process(const std::string &imgPath); +protected: + APP_ERROR ReadImage(const std::string &imgPath, MxBase::TensorBase &tensor); + APP_ERROR Resize(const MxBase::TensorBase &inputTensor, MxBase::TensorBase &outputTensor); + APP_ERROR LoadLabels(const std::string &labelPath, std::map &labelMap); + APP_ERROR WriteResult(MxBase::TensorBase &tensor, + const std::vector> &objInfos); + void SetYolov3PostProcessConfig(const InitParam &initParam, std::map &config); +private: + std::shared_ptr dvppWrapper_; // 封装DVPP基本编码、解码、扣图功能 + std::shared_ptr model_; // 模型推理功能处理 + std::shared_ptr post_; + MxBase::ModelDesc modelDesc_ = {}; // 模型描述信息 + std::map labelMap_ = {}; + uint32_t deviceId_ = 0; + +}; +#endif -- Gitee From 1a92ac3ef4c7fbd343deb22efbe8e472f52d0a1c Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:54:42 +0000 Subject: [PATCH 062/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yolov3PostProcess/Yolov3PostProcess.cpp | 439 ------------------ 1 file changed, 439 deletions(-) delete mode 100644 tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.cpp diff --git a/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.cpp b/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.cpp deleted file mode 100644 index b8b67efdc..000000000 --- a/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.cpp +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Yolov3PostProcess.h" -#include "MxBase/Log/Log.h" -#include "MxBase/Maths/FastMath.h" -#include "MxBase/CV/ObjectDetection/Nms/Nms.h" - -namespace { - const int SCALE = 32; - const int BIASESDIM = 2; - const int OFFSETWIDTH = 2; - const int OFFSETHEIGHT = 3; - const int OFFSETBIASES = 1; - const int OFFSETOBJECTNESS = 1; - - const int NHWC_HEIGHTINDEX = 1; - const int NHWC_WIDTHINDEX = 2; - const int NCHW_HEIGHTINDEX = 2; - const int NCHW_WIDTHINDEX = 3; - const int YOLO_INFO_DIM = 5; - - auto uint8Deleter = [](uint8_t *p) {}; -} -using namespace MxBase; - -Yolov3PostProcess &Yolov3PostProcess::operator=(const Yolov3PostProcess &other) { - if (this == &other) { - return *this; - } - ObjectPostProcessBase::operator=(other); - objectnessThresh_ = other.objectnessThresh_; // Threshold of objectness value - iouThresh_ = other.iouThresh_; - anchorDim_ = other.anchorDim_; - biasesNum_ = other.biasesNum_; - yoloType_ = other.yoloType_; - modelType_ = other.modelType_; - yoloType_ = other.yoloType_; - inputType_ = other.inputType_; - biases_ = other.biases_; - return *this; -} - -APP_ERROR Yolov3PostProcess::Init(const std::map> &postConfig) { - LogDebug << "Start to Init Yolov3PostProcess."; - APP_ERROR ret = ObjectPostProcessBase::Init(postConfig); - if (ret != APP_ERR_OK) { - LogError << GetError(ret) << "Fail to superInit in ObjectPostProcessBase."; - return ret; - } - - configData_.GetFileValue("BIASES_NUM", biasesNum_); - std::string str; - configData_.GetFileValue("BIASES", str); - configData_.GetFileValue("OBJECTNESS_THRESH", objectnessThresh_); - configData_.GetFileValue("IOU_THRESH", iouThresh_); - configData_.GetFileValue("YOLO_TYPE", yoloType_); - configData_.GetFileValue("MODEL_TYPE", modelType_); - configData_.GetFileValue("YOLO_VERSION", yoloVersion_); - configData_.GetFileValue("INPUT_TYPE", inputType_); - configData_.GetFileValue("ANCHOR_DIM", anchorDim_); - ret = GetBiases(str); - if (ret != APP_ERR_OK) { - LogError << GetError(ret) << "Failed to get biases."; - return ret; - } - LogDebug << "End to Init Yolov3PostProcess."; - return APP_ERR_OK; -} - -APP_ERROR Yolov3PostProcess::DeInit() { - return APP_ERR_OK; -} - -// 判断Tensor是否合法 -bool Yolov3PostProcess::IsValidTensors(const std::vector &tensors) const { - if (tensors.size() != (size_t) yoloType_) { - LogError << "number of tensors (" << tensors.size() << ") " << "is unequal to yoloType_(" - << yoloType_ << ")"; - return false; - } - if (yoloVersion_ == YOLOV3_VERSION) { - for (size_t i = 0; i < tensors.size(); i++) { - auto shape = tensors[i].GetShape(); - if (shape.size() < VECTOR_FIFTH_INDEX) { - LogError << "dimensions of tensor [" << i << "] is less than " << VECTOR_FIFTH_INDEX << "."; - return false; - } - uint32_t channelNumber = 1; - int startIndex = modelType_ ? VECTOR_SECOND_INDEX : VECTOR_FOURTH_INDEX; - int endIndex = modelType_ ? (shape.size() - VECTOR_THIRD_INDEX) : shape.size(); - for (int i = startIndex; i < endIndex; i++) { - channelNumber *= shape[i]; - } - if (channelNumber != anchorDim_ * (classNum_ + YOLO_INFO_DIM)) { - LogError << "channelNumber(" << channelNumber << ") != anchorDim_ * (classNum_ + 5)."; - return false; - } - } - return true; - } else { - return true; - } -} - -// 将处理好的推理结果放入ObjectInfo -void Yolov3PostProcess::ObjectDetectionOutput(const std::vector &tensors, - std::vector> &objectInfos, - const std::vector &resizedImageInfos) { - LogDebug << "Yolov3PostProcess start to write results."; - if (tensors.size() == 0) { - return; - } - - auto shape = tensors[0].GetShape(); - if (shape.size() == 0) { - return; - } - uint32_t batchSize = shape[0]; - for (uint32_t i = 0; i < batchSize; i++) { - std::vector> featLayerData = {}; - std::vector> featLayerShapes = {}; - for (uint32_t j = 0; j < tensors.size(); j++) { - auto dataPtr = (uint8_t *) GetBuffer(tensors[j], i); - std::shared_ptr tmpPointer; - tmpPointer.reset(dataPtr, uint8Deleter); - featLayerData.push_back(tmpPointer); - shape = tensors[j].GetShape(); - std::vector featLayerShape = {}; - for (auto s : shape) { - featLayerShape.push_back((size_t) s); - } - featLayerShapes.push_back(featLayerShape); - } - std::vector objectInfo; - GenerateBbox(featLayerData, objectInfo, featLayerShapes, resizedImageInfos[i].widthResize, - resizedImageInfos[i].heightResize); - MxBase::NmsSort(objectInfo, iouThresh_); - objectInfos.push_back(objectInfo); - } - LogDebug << "Yolov3PostProcess write results successed."; -} - -APP_ERROR Yolov3PostProcess::Process(const std::vector &tensors, - std::vector> &objectInfos, - const std::vector &resizedImageInfos, - const std::map> ¶mMap) { - LogDebug << "Start to Process Yolov3PostProcess."; - APP_ERROR ret = APP_ERR_OK; - if (resizedImageInfos.size() == 0) { - ret = APP_ERR_INPUT_NOT_MATCH; - LogError << GetError(ret) << "resizedImageInfos is not provided which is necessary for Yolov3PostProcess."; - return ret; - } - auto inputs = tensors; - ret = CheckAndMoveTensors(inputs); - if (ret != APP_ERR_OK) { - LogError << GetError(ret) << "CheckAndMoveTensors failed."; - return ret; - } - - ObjectDetectionOutput(inputs, objectInfos, resizedImageInfos); - - for (uint32_t i = 0; i < resizedImageInfos.size(); i++) { - CoordinatesReduction(i, resizedImageInfos[i], objectInfos[i]); - } - LogObjectInfos(objectInfos); - LogDebug << "End to Process Yolov3PostProcess."; - return APP_ERR_OK; -} - -/* - * @description: Compare the confidences between 2 classes and get the larger one - * @描述:比较两个类之间的置信度,得到较大的一个 - */ -void Yolov3PostProcess::CompareProb(int &classID, float &maxProb, float classProb, int classNum) { - if (classProb > maxProb) { - maxProb = classProb; - classID = classNum; - } -} - -void Yolov3PostProcess::CodeDuplicationSetDet(float &x, float &y, float &width, float &height) { - MxBase::ObjectInfo det; - det.x0 = std::max(0.0f, x - width / COORDINATE_PARAM); - det.x1 = std::min(1.0f, x + width / COORDINATE_PARAM); - det.y0 = std::max(0.0f, y - height / COORDINATE_PARAM); - det.y1 = std::min(1.0f, y + height / COORDINATE_PARAM); -} - -void Yolov3PostProcess::SelectClassNCHW(std::shared_ptr netout, NetInfo info, - std::vector &detBoxes, int stride, OutputLayer layer) { - for (int j = 0; j < stride; ++j) { - for (int k = 0; k < info.anchorDim; ++k) { - int bIdx = (info.bboxDim + 1 + info.classNum) * stride * k + j; - int oIdx = bIdx + info.bboxDim * stride; - - float objectness = fastmath::sigmoid(static_cast(netout.get())[oIdx]); - if (objectness <= objectnessThresh_) { - continue; - } - int classID = -1; - float maxProb = scoreThresh_; - float classProb = 0.0; - - for (int c = 0; c < info.classNum; ++c) { - classProb = fastmath::sigmoid(static_cast - (netout.get())[bIdx + (info.bboxDim + OFFSETOBJECTNESS + c) * stride]) * objectness; - CompareProb(classID, maxProb, classProb, c); - } - if (classID < 0) {continue;} - - MxBase::ObjectInfo det; - int row = j / layer.width; - int col = j % layer.width; - float x = (col + fastmath::sigmoid(static_cast(netout.get())[bIdx])) / layer.width; - float y = (row + fastmath::sigmoid(static_cast(netout.get())[bIdx + stride])) / layer.height; - float width = fastmath::exp(static_cast(netout.get())[bIdx + OFFSETWIDTH * stride]) * - layer.anchors[BIASESDIM * k] / info.netWidth; - float height = fastmath::exp(static_cast(netout.get())[bIdx + OFFSETHEIGHT * stride]) * - layer.anchors[BIASESDIM * k + OFFSETBIASES] / info.netHeight; - - CodeDuplicationSetDet(x, y, width, height); - det.classId = classID; - det.className = configData_.GetClassName(classID); - det.confidence = maxProb; - if (det.confidence < separateScoreThresh_[classID]) { - continue; - } - detBoxes.emplace_back(det); - } - } -} - -void Yolov3PostProcess::SelectClassNCHWC(std::shared_ptr netout, NetInfo info, - std::vector &detBoxes, int stride, OutputLayer layer) { - LogDebug << " out size " << sizeof(netout.get()); - const int offsetY = 1; - for (int j = 0; j < stride; ++j) { - for (int k = 0; k < info.anchorDim; ++k) { - int bIdx = (info.bboxDim + 1 + info.classNum) * stride * k + - j * (info.bboxDim + 1 + info.classNum); - int oIdx = bIdx + info.bboxDim; - float objectness = fastmath::sigmoid(static_cast(netout.get())[oIdx]); - if (objectness <= objectnessThresh_) {continue;} - int classID = -1; - float maxProb = scoreThresh_; - float classProb = 0.0; - - for (int c = 0; c < info.classNum; ++c) { - classProb = fastmath::sigmoid(static_cast(netout.get())[bIdx + - (info.bboxDim + OFFSETOBJECTNESS + - c)]) * objectness; - CompareProb(classID, maxProb, classProb, c); - } - if (classID < 0) continue; - MxBase::ObjectInfo det; - int row = j / layer.width; - int col = j % layer.width; - float x = (col + fastmath::sigmoid(static_cast(netout.get())[bIdx]) * COORDINATE_PARAM - - MEAN_PARAM) / layer.width; - float y = (row + fastmath::sigmoid(static_cast(netout.get())[bIdx + offsetY]) * - COORDINATE_PARAM - MEAN_PARAM) / layer.height; - float width = (fastmath::sigmoid(static_cast(netout.get())[bIdx + OFFSETWIDTH]) * - COORDINATE_PARAM) * (fastmath::sigmoid(static_cast(netout.get())[bIdx + - OFFSETWIDTH]) * - COORDINATE_PARAM) * layer.anchors[BIASESDIM * k] / info.netWidth; - float height = (fastmath::sigmoid(static_cast(netout.get())[bIdx + OFFSETHEIGHT]) * - COORDINATE_PARAM) * (fastmath::sigmoid(static_cast(netout.get())[bIdx + - OFFSETHEIGHT]) * - COORDINATE_PARAM) * layer.anchors[BIASESDIM * k + OFFSETBIASES] / - info.netHeight; - CodeDuplicationSetDet(x, y, width, height); - det.classId = classID; - det.className = configData_.GetClassName(classID); - det.confidence = maxProb; - if (det.confidence < separateScoreThresh_[classID]) continue; - detBoxes.emplace_back(det); - } - } -} - -/* - * @description: Select the highest confidence class label for each predicted box and save into detBoxes - * @param netout The feature data which contains box coordinates, objectness value and confidence of each class - * @param info Yolo layer info which contains class number, box dim and so on - * @param detBoxes ObjectInfo vector where all ObjectInfoes's confidences are greater than threshold - * @param stride Stride of output feature data - * @param layer Yolo output layer - */ -/* - * @description:为每个预测框选择置信度最高的类名 - * @param netout 特征数据,包括盒子坐标、目标值和每个类的置信度 - * @param info Yolo Yolo层信息,包含类号、框尺寸等 - * @param detBoxes ObjectInfo容器,其中所有ObjectInfo的置信度都大于阈值 - * @param stride 输出特征数据的步长 - * @param layer Yolo输出层 - */ -void Yolov3PostProcess::SelectClassNHWC(std::shared_ptr netout, NetInfo info, - std::vector &detBoxes, int stride, OutputLayer layer) { - const int offsetY = 1; - for (int j = 0; j < stride; ++j) { - for (int k = 0; k < info.anchorDim; ++k) { - // begin index - int bIdx = (info.bboxDim + 1 + info.classNum) * info.anchorDim * j + - k * (info.bboxDim + 1 + info.classNum); - // objectness index - int oIdx = bIdx + info.bboxDim; - // check obj - float objectness = fastmath::sigmoid(static_cast(netout.get())[oIdx]); - if (objectness <= objectnessThresh_) { - continue; - } - int classID = -1; - float maxProb = scoreThresh_; - float classProb; - // Compare the confidence of the 3 anchors, select the largest one - for (int c = 0; c < info.classNum; ++c) { - classProb = fastmath::sigmoid(static_cast - (netout.get())[bIdx + (info.bboxDim + OFFSETOBJECTNESS + c)]) * objectness; - CompareProb(classID, maxProb, classProb, c); - } - - if (classID < 0) {continue;} - MxBase::ObjectInfo det; - int row = j / layer.width; - int col = j % layer.width; - // 计算检测对象的中心点 - float x = (col + fastmath::sigmoid(static_cast(netout.get())[bIdx])) / layer.width; - float y = (row + fastmath::sigmoid(static_cast(netout.get())[bIdx + offsetY])) / layer.height; - float width = fastmath::exp(static_cast(netout.get())[bIdx + OFFSETWIDTH]) * - layer.anchors[BIASESDIM * k] / info.netWidth; - float height = fastmath::exp(static_cast(netout.get())[bIdx + OFFSETHEIGHT]) * - layer.anchors[BIASESDIM * k + OFFSETBIASES] / info.netHeight; - // 根据中心计算对象框坐标 - det.x0 = std::max(0.0f, x - width / COORDINATE_PARAM); - det.x1 = std::min(1.0f, x + width / COORDINATE_PARAM); - det.y0 = std::max(0.0f, y - height / COORDINATE_PARAM); - det.y1 = std::min(1.0f, y + height / COORDINATE_PARAM); - - det.classId = classID; - det.className = configData_.GetClassName(classID); - det.confidence = maxProb; - if (det.confidence < separateScoreThresh_[classID]) { - continue; - } - detBoxes.emplace_back(det); - } - } -} - -/* - * @description: According to the yolo layer structure, encapsulate the anchor box data of each feature into detBoxes - * @param featLayerData Vector of 3 output feature data - * @param info Yolo layer info which contains anchors dim, bbox dim, class number, net width, net height and - 3 outputlayer(eg. 13*13, 26*26, 52*52) - * @param detBoxes ObjectInfo vector where all ObjectInfoes's confidences are greater than threshold - */ -/* - * @description:根据yolo层结构,将每个特征的锚盒数据封装到detBoxes中 - * @param featLayerData 包含3个输出特征数据的容器 - * @param detBoxes ObjectInfo容器,其中所有ObjectInfo的置信度都大于阈值 - */ -void Yolov3PostProcess::GenerateBbox(std::vector> featLayerData, - std::vector &detBoxes, - const std::vector> &featLayerShapes, const int netWidth, - const int netHeight) { - NetInfo netInfo; - netInfo.anchorDim = anchorDim_; - netInfo.bboxDim = BOX_DIM; - netInfo.classNum = classNum_; - netInfo.netWidth = netWidth; - netInfo.netHeight = netHeight; - for (int i = 0; i < yoloType_; ++i) { - int widthIndex_ = modelType_ ? NCHW_WIDTHINDEX : NHWC_WIDTHINDEX; - int heightIndex_ = modelType_ ? NCHW_HEIGHTINDEX : NHWC_HEIGHTINDEX; - // OutputLayer是yolov3每个输出池对应的信息 - OutputLayer layer = {featLayerShapes[i][widthIndex_], featLayerShapes[i][heightIndex_]}; - - int logOrder = log(featLayerShapes[i][widthIndex_] * SCALE / netWidth) / log(BIASESDIM); - int startIdx = (yoloType_ - 1 - logOrder) * netInfo.anchorDim * BIASESDIM; - int endIdx = startIdx + netInfo.anchorDim * BIASESDIM; - int idx = 0; - for (int j = startIdx; j < endIdx; ++j) { - layer.anchors[idx++] = biases_[j]; - } - - int stride = layer.width * layer.height; // 13*13 26*26 52*52 - std::shared_ptr netout = featLayerData[i]; - if (modelType_ == 0) { - SelectClassNHWC(netout, netInfo, detBoxes, stride, layer); - } else { - if (yoloVersion_ == YOLOV3_VERSION) { - SelectClassNCHW(netout, netInfo, detBoxes, stride, layer); - } else { - SelectClassNCHWC(netout, netInfo, detBoxes, stride, layer); - } - } - } -} - -// 将biases字符串解析为int型数组存入biases_中 -APP_ERROR Yolov3PostProcess::GetBiases(std::string &strBiases) { - if (biasesNum_ <= 0) { - LogError << GetError(APP_ERR_COMM_INVALID_PARAM) << "Failed to get biasesNum (" << biasesNum_ << ")."; - return APP_ERR_COMM_INVALID_PARAM; - } - biases_.clear(); - int i = 0; - int num = strBiases.find(","); - while (num >= 0 && i < biasesNum_) { - std::string tmp = strBiases.substr(0, num); - num++; - strBiases = strBiases.substr(num, strBiases.size()); - biases_.push_back(stof(tmp)); - i++; - num = strBiases.find(","); - } - if (i != biasesNum_ - 1 || strBiases.size() <= 0) { - LogError << GetError(APP_ERR_COMM_INVALID_PARAM) << "biasesNum (" << biasesNum_ - << ") is not equal to total number of biases (" << strBiases << ")."; - return APP_ERR_COMM_INVALID_PARAM; - } - biases_.push_back(stof(strBiases)); - return APP_ERR_OK; -} -- Gitee From 2b14a7fa58bc3ce585aa6d2dc3347a84fdb43173 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:54:54 +0000 Subject: [PATCH 063/129] =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- .../yolov3PostProcess/Yolov3PostProcess.cpp | 439 ++++++++++++++++++ 1 file changed, 439 insertions(+) create mode 100644 tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.cpp diff --git a/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.cpp b/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.cpp new file mode 100644 index 000000000..c4869a809 --- /dev/null +++ b/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.cpp @@ -0,0 +1,439 @@ +/* + * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "Yolov3PostProcess.h" +#include "MxBase/Log/Log.h" +#include "MxBase/Maths/FastMath.h" +#include "MxBase/CV/ObjectDetection/Nms/Nms.h" + +namespace { + const int SCALE = 32; + const int BIASESDIM = 2; + const int OFFSETWIDTH = 2; + const int OFFSETHEIGHT = 3; + const int OFFSETBIASES = 1; + const int OFFSETOBJECTNESS = 1; + + const int NHWC_HEIGHTINDEX = 1; + const int NHWC_WIDTHINDEX = 2; + const int NCHW_HEIGHTINDEX = 2; + const int NCHW_WIDTHINDEX = 3; + const int YOLO_INFO_DIM = 5; + + auto uint8Deleter = [](uint8_t *p) {}; +} +using namespace MxBase; + +Yolov3PostProcess &Yolov3PostProcess::operator=(const Yolov3PostProcess &other) { + if (this == &other) { + return *this; + } + ObjectPostProcessBase::operator=(other); + objectnessThresh_ = other.objectnessThresh_; // Threshold of objectness value + iouThresh_ = other.iouThresh_; + anchorDim_ = other.anchorDim_; + biasesNum_ = other.biasesNum_; + yoloType_ = other.yoloType_; + modelType_ = other.modelType_; + yoloType_ = other.yoloType_; + inputType_ = other.inputType_; + biases_ = other.biases_; + return *this; +} + +APP_ERROR Yolov3PostProcess::Init(const std::map &postConfig) { + LogDebug << "Start to Init Yolov3PostProcess."; + APP_ERROR ret = ObjectPostProcessBase::Init(postConfig); + if (ret != APP_ERR_OK) { + LogError << GetError(ret) << "Fail to superInit in ObjectPostProcessBase."; + return ret; + } + + configData_.GetFileValue("BIASES_NUM", biasesNum_); + std::string str; + configData_.GetFileValue("BIASES", str); + configData_.GetFileValue("OBJECTNESS_THRESH", objectnessThresh_); + configData_.GetFileValue("IOU_THRESH", iouThresh_); + configData_.GetFileValue("YOLO_TYPE", yoloType_); + configData_.GetFileValue("MODEL_TYPE", modelType_); + configData_.GetFileValue("YOLO_VERSION", yoloVersion_); + configData_.GetFileValue("INPUT_TYPE", inputType_); + configData_.GetFileValue("ANCHOR_DIM", anchorDim_); + ret = GetBiases(str); + if (ret != APP_ERR_OK) { + LogError << GetError(ret) << "Failed to get biases."; + return ret; + } + LogDebug << "End to Init Yolov3PostProcess."; + return APP_ERR_OK; +} + +APP_ERROR Yolov3PostProcess::DeInit() { + return APP_ERR_OK; +} + +// 判断Tensor是否合法 +bool Yolov3PostProcess::IsValidTensors(const std::vector &tensors) const { + if (tensors.size() != (size_t) yoloType_) { + LogError << "number of tensors (" << tensors.size() << ") " << "is unequal to yoloType_(" + << yoloType_ << ")"; + return false; + } + if (yoloVersion_ == YOLOV3_VERSION) { + for (size_t i = 0; i < tensors.size(); i++) { + auto shape = tensors[i].GetShape(); + if (shape.size() < VECTOR_FIFTH_INDEX) { + LogError << "dimensions of tensor [" << i << "] is less than " << VECTOR_FIFTH_INDEX << "."; + return false; + } + uint32_t channelNumber = 1; + int startIndex = modelType_ ? VECTOR_SECOND_INDEX : VECTOR_FOURTH_INDEX; + int endIndex = modelType_ ? (shape.size() - VECTOR_THIRD_INDEX) : shape.size(); + for (int i = startIndex; i < endIndex; i++) { + channelNumber *= shape[i]; + } + if (channelNumber != anchorDim_ * (classNum_ + YOLO_INFO_DIM)) { + LogError << "channelNumber(" << channelNumber << ") != anchorDim_ * (classNum_ + 5)."; + return false; + } + } + return true; + } else { + return true; + } +} + +// 将处理好的推理结果放入ObjectInfo +void Yolov3PostProcess::ObjectDetectionOutput(const std::vector &tensors, + std::vector> &objectInfos, + const std::vector &resizedImageInfos) { + LogDebug << "Yolov3PostProcess start to write results."; + if (tensors.size() == 0) { + return; + } + + auto shape = tensors[0].GetShape(); + if (shape.size() == 0) { + return; + } + uint32_t batchSize = shape[0]; + for (uint32_t i = 0; i < batchSize; i++) { + std::vector> featLayerData = {}; + std::vector> featLayerShapes = {}; + for (uint32_t j = 0; j < tensors.size(); j++) { + auto dataPtr = (uint8_t *) GetBuffer(tensors[j], i); + std::shared_ptr tmpPointer; + tmpPointer.reset(dataPtr, uint8Deleter); + featLayerData.push_back(tmpPointer); + shape = tensors[j].GetShape(); + std::vector featLayerShape = {}; + for (auto s : shape) { + featLayerShape.push_back((size_t) s); + } + featLayerShapes.push_back(featLayerShape); + } + std::vector objectInfo; + GenerateBbox(featLayerData, objectInfo, featLayerShapes, resizedImageInfos[i].widthResize, + resizedImageInfos[i].heightResize); + MxBase::NmsSort(objectInfo, iouThresh_); + objectInfos.push_back(objectInfo); + } + LogDebug << "Yolov3PostProcess write results successed."; +} + +APP_ERROR Yolov3PostProcess::Process(const std::vector &tensors, + std::vector> &objectInfos, + const std::vector &resizedImageInfos, + const std::map> ¶mMap) { + LogDebug << "Start to Process Yolov3PostProcess."; + APP_ERROR ret = APP_ERR_OK; + if (resizedImageInfos.size() == 0) { + ret = APP_ERR_INPUT_NOT_MATCH; + LogError << GetError(ret) << "resizedImageInfos is not provided which is necessary for Yolov3PostProcess."; + return ret; + } + auto inputs = tensors; + ret = CheckAndMoveTensors(inputs); + if (ret != APP_ERR_OK) { + LogError << GetError(ret) << "CheckAndMoveTensors failed."; + return ret; + } + + ObjectDetectionOutput(inputs, objectInfos, resizedImageInfos); + + for (uint32_t i = 0; i < resizedImageInfos.size(); i++) { + CoordinatesReduction(i, resizedImageInfos[i], objectInfos[i]); + } + LogObjectInfos(objectInfos); + LogDebug << "End to Process Yolov3PostProcess."; + return APP_ERR_OK; +} + +/* + * @description: Compare the confidences between 2 classes and get the larger one + * @描述:比较两个类之间的置信度,得到较大的一个 + */ +void Yolov3PostProcess::CompareProb(int &classID, float &maxProb, float classProb, int classNum) { + if (classProb > maxProb) { + maxProb = classProb; + classID = classNum; + } +} + +void Yolov3PostProcess::CodeDuplicationSetDet(float &x, float &y, float &width, float &height) { + MxBase::ObjectInfo det; + det.x0 = std::max(0.0f, x - width / COORDINATE_PARAM); + det.x1 = std::min(1.0f, x + width / COORDINATE_PARAM); + det.y0 = std::max(0.0f, y - height / COORDINATE_PARAM); + det.y1 = std::min(1.0f, y + height / COORDINATE_PARAM); +} + +void Yolov3PostProcess::SelectClassNCHW(std::shared_ptr netout, NetInfo info, + std::vector &detBoxes, int stride, OutputLayer layer) { + for (int j = 0; j < stride; ++j) { + for (int k = 0; k < info.anchorDim; ++k) { + int bIdx = (info.bboxDim + 1 + info.classNum) * stride * k + j; + int oIdx = bIdx + info.bboxDim * stride; + + float objectness = fastmath::sigmoid(static_cast(netout.get())[oIdx]); + if (objectness <= objectnessThresh_) { + continue; + } + int classID = -1; + float maxProb = scoreThresh_; + float classProb = 0.0; + + for (int c = 0; c < info.classNum; ++c) { + classProb = fastmath::sigmoid(static_cast + (netout.get())[bIdx + (info.bboxDim + OFFSETOBJECTNESS + c) * stride]) * objectness; + CompareProb(classID, maxProb, classProb, c); + } + if (classID < 0) {continue;} + + MxBase::ObjectInfo det; + int row = j / layer.width; + int col = j % layer.width; + float x = (col + fastmath::sigmoid(static_cast(netout.get())[bIdx])) / layer.width; + float y = (row + fastmath::sigmoid(static_cast(netout.get())[bIdx + stride])) / layer.height; + float width = fastmath::exp(static_cast(netout.get())[bIdx + OFFSETWIDTH * stride]) * + layer.anchors[BIASESDIM * k] / info.netWidth; + float height = fastmath::exp(static_cast(netout.get())[bIdx + OFFSETHEIGHT * stride]) * + layer.anchors[BIASESDIM * k + OFFSETBIASES] / info.netHeight; + + CodeDuplicationSetDet(x, y, width, height); + det.classId = classID; + det.className = configData_.GetClassName(classID); + det.confidence = maxProb; + if (det.confidence < separateScoreThresh_[classID]) { + continue; + } + detBoxes.emplace_back(det); + } + } +} + +void Yolov3PostProcess::SelectClassNCHWC(std::shared_ptr netout, NetInfo info, + std::vector &detBoxes, int stride, OutputLayer layer) { + LogDebug << " out size " << sizeof(netout.get()); + const int offsetY = 1; + for (int j = 0; j < stride; ++j) { + for (int k = 0; k < info.anchorDim; ++k) { + int bIdx = (info.bboxDim + 1 + info.classNum) * stride * k + + j * (info.bboxDim + 1 + info.classNum); + int oIdx = bIdx + info.bboxDim; + float objectness = fastmath::sigmoid(static_cast(netout.get())[oIdx]); + if (objectness <= objectnessThresh_) {continue;} + int classID = -1; + float maxProb = scoreThresh_; + float classProb = 0.0; + + for (int c = 0; c < info.classNum; ++c) { + classProb = fastmath::sigmoid(static_cast(netout.get())[bIdx + + (info.bboxDim + OFFSETOBJECTNESS + + c)]) * objectness; + CompareProb(classID, maxProb, classProb, c); + } + if (classID < 0) continue; + MxBase::ObjectInfo det; + int row = j / layer.width; + int col = j % layer.width; + float x = (col + fastmath::sigmoid(static_cast(netout.get())[bIdx]) * COORDINATE_PARAM - + MEAN_PARAM) / layer.width; + float y = (row + fastmath::sigmoid(static_cast(netout.get())[bIdx + offsetY]) * + COORDINATE_PARAM - MEAN_PARAM) / layer.height; + float width = (fastmath::sigmoid(static_cast(netout.get())[bIdx + OFFSETWIDTH]) * + COORDINATE_PARAM) * (fastmath::sigmoid(static_cast(netout.get())[bIdx + + OFFSETWIDTH]) * + COORDINATE_PARAM) * layer.anchors[BIASESDIM * k] / info.netWidth; + float height = (fastmath::sigmoid(static_cast(netout.get())[bIdx + OFFSETHEIGHT]) * + COORDINATE_PARAM) * (fastmath::sigmoid(static_cast(netout.get())[bIdx + + OFFSETHEIGHT]) * + COORDINATE_PARAM) * layer.anchors[BIASESDIM * k + OFFSETBIASES] / + info.netHeight; + CodeDuplicationSetDet(x, y, width, height); + det.classId = classID; + det.className = configData_.GetClassName(classID); + det.confidence = maxProb; + if (det.confidence < separateScoreThresh_[classID]) continue; + detBoxes.emplace_back(det); + } + } +} + +/* + * @description: Select the highest confidence class label for each predicted box and save into detBoxes + * @param netout The feature data which contains box coordinates, objectness value and confidence of each class + * @param info Yolo layer info which contains class number, box dim and so on + * @param detBoxes ObjectInfo vector where all ObjectInfoes's confidences are greater than threshold + * @param stride Stride of output feature data + * @param layer Yolo output layer + */ +/* + * @description:为每个预测框选择置信度最高的类名 + * @param netout 特征数据,包括盒子坐标、目标值和每个类的置信度 + * @param info Yolo Yolo层信息,包含类号、框尺寸等 + * @param detBoxes ObjectInfo容器,其中所有ObjectInfo的置信度都大于阈值 + * @param stride 输出特征数据的步长 + * @param layer Yolo输出层 + */ +void Yolov3PostProcess::SelectClassNHWC(std::shared_ptr netout, NetInfo info, + std::vector &detBoxes, int stride, OutputLayer layer) { + const int offsetY = 1; + for (int j = 0; j < stride; ++j) { + for (int k = 0; k < info.anchorDim; ++k) { + // begin index + int bIdx = (info.bboxDim + 1 + info.classNum) * info.anchorDim * j + + k * (info.bboxDim + 1 + info.classNum); + // objectness index + int oIdx = bIdx + info.bboxDim; + // check obj + float objectness = fastmath::sigmoid(static_cast(netout.get())[oIdx]); + if (objectness <= objectnessThresh_) { + continue; + } + int classID = -1; + float maxProb = scoreThresh_; + float classProb; + // Compare the confidence of the 3 anchors, select the largest one + for (int c = 0; c < info.classNum; ++c) { + classProb = fastmath::sigmoid(static_cast + (netout.get())[bIdx + (info.bboxDim + OFFSETOBJECTNESS + c)]) * objectness; + CompareProb(classID, maxProb, classProb, c); + } + + if (classID < 0) {continue;} + MxBase::ObjectInfo det; + int row = j / layer.width; + int col = j % layer.width; + // 计算检测对象的中心点 + float x = (col + fastmath::sigmoid(static_cast(netout.get())[bIdx])) / layer.width; + float y = (row + fastmath::sigmoid(static_cast(netout.get())[bIdx + offsetY])) / layer.height; + float width = fastmath::exp(static_cast(netout.get())[bIdx + OFFSETWIDTH]) * + layer.anchors[BIASESDIM * k] / info.netWidth; + float height = fastmath::exp(static_cast(netout.get())[bIdx + OFFSETHEIGHT]) * + layer.anchors[BIASESDIM * k + OFFSETBIASES] / info.netHeight; + // 根据中心计算对象框坐标 + det.x0 = std::max(0.0f, x - width / COORDINATE_PARAM); + det.x1 = std::min(1.0f, x + width / COORDINATE_PARAM); + det.y0 = std::max(0.0f, y - height / COORDINATE_PARAM); + det.y1 = std::min(1.0f, y + height / COORDINATE_PARAM); + + det.classId = classID; + det.className = configData_.GetClassName(classID); + det.confidence = maxProb; + if (det.confidence < separateScoreThresh_[classID]) { + continue; + } + detBoxes.emplace_back(det); + } + } +} + +/* + * @description: According to the yolo layer structure, encapsulate the anchor box data of each feature into detBoxes + * @param featLayerData Vector of 3 output feature data + * @param info Yolo layer info which contains anchors dim, bbox dim, class number, net width, net height and + 3 outputlayer(eg. 13*13, 26*26, 52*52) + * @param detBoxes ObjectInfo vector where all ObjectInfoes's confidences are greater than threshold + */ +/* + * @description:根据yolo层结构,将每个特征的锚盒数据封装到detBoxes中 + * @param featLayerData 包含3个输出特征数据的容器 + * @param detBoxes ObjectInfo容器,其中所有ObjectInfo的置信度都大于阈值 + */ +void Yolov3PostProcess::GenerateBbox(std::vector> featLayerData, + std::vector &detBoxes, + const std::vector> &featLayerShapes, const int netWidth, + const int netHeight) { + NetInfo netInfo; + netInfo.anchorDim = anchorDim_; + netInfo.bboxDim = BOX_DIM; + netInfo.classNum = classNum_; + netInfo.netWidth = netWidth; + netInfo.netHeight = netHeight; + for (int i = 0; i < yoloType_; ++i) { + int widthIndex_ = modelType_ ? NCHW_WIDTHINDEX : NHWC_WIDTHINDEX; + int heightIndex_ = modelType_ ? NCHW_HEIGHTINDEX : NHWC_HEIGHTINDEX; + // OutputLayer是yolov3每个输出池对应的信息 + OutputLayer layer = {featLayerShapes[i][widthIndex_], featLayerShapes[i][heightIndex_]}; + + int logOrder = log(featLayerShapes[i][widthIndex_] * SCALE / netWidth) / log(BIASESDIM); + int startIdx = (yoloType_ - 1 - logOrder) * netInfo.anchorDim * BIASESDIM; + int endIdx = startIdx + netInfo.anchorDim * BIASESDIM; + int idx = 0; + for (int j = startIdx; j < endIdx; ++j) { + layer.anchors[idx++] = biases_[j]; + } + + int stride = layer.width * layer.height; // 13*13 26*26 52*52 + std::shared_ptr netout = featLayerData[i]; + if (modelType_ == 0) { + SelectClassNHWC(netout, netInfo, detBoxes, stride, layer); + } else { + if (yoloVersion_ == YOLOV3_VERSION) { + SelectClassNCHW(netout, netInfo, detBoxes, stride, layer); + } else { + SelectClassNCHWC(netout, netInfo, detBoxes, stride, layer); + } + } + } +} + +// 将biases字符串解析为int型数组存入biases_中 +APP_ERROR Yolov3PostProcess::GetBiases(std::string &strBiases) { + if (biasesNum_ <= 0) { + LogError << GetError(APP_ERR_COMM_INVALID_PARAM) << "Failed to get biasesNum (" << biasesNum_ << ")."; + return APP_ERR_COMM_INVALID_PARAM; + } + biases_.clear(); + int i = 0; + int num = strBiases.find(","); + while (num >= 0 && i < biasesNum_) { + std::string tmp = strBiases.substr(0, num); + num++; + strBiases = strBiases.substr(num, strBiases.size()); + biases_.push_back(stof(tmp)); + i++; + num = strBiases.find(","); + } + if (i != biasesNum_ - 1 || strBiases.size() <= 0) { + LogError << GetError(APP_ERR_COMM_INVALID_PARAM) << "biasesNum (" << biasesNum_ + << ") is not equal to total number of biases (" << strBiases << ")."; + return APP_ERR_COMM_INVALID_PARAM; + } + biases_.push_back(stof(strBiases)); + return APP_ERR_OK; +} -- Gitee From 6503bf53162ba0301f6af46f17dd128c452f89a7 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:54:58 +0000 Subject: [PATCH 064/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yolov3PostProcess/Yolov3PostProcess.h | 97 ------------------- 1 file changed, 97 deletions(-) delete mode 100644 tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.h diff --git a/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.h b/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.h deleted file mode 100644 index ec9f7ca11..000000000 --- a/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef YOLOV3_POST_PROCESS_H -#define YOLOV3_POST_PROCESS_H -#include "MxBase/PostProcessBases/ObjectPostProcessBase.h" - -namespace { -const float DEFAULT_OBJECTNESS_THRESH = 0.3; -const float DEFAULT_IOU_THRESH = 0.45; -const int DEFAULT_ANCHOR_DIM = 3; -const int DEFAULT_BIASES_NUM = 18; -const int DEFAULT_YOLO_TYPE = 3; -const int DEFAULT_YOLO_VERSION = 3; -const int YOLOV3_VERSION = 3; -const int YOLOV4_VERSION = 4; -const int YOLOV5_VERSION = 5; - -struct OutputLayer { - size_t width; - size_t height; - float anchors[6]; -}; - -struct NetInfo { - int anchorDim; - int classNum; - int bboxDim; - int netWidth; - int netHeight; -}; -} - - -class Yolov3PostProcess : public MxBase::ObjectPostProcessBase { -public: - Yolov3PostProcess() = default; - - ~Yolov3PostProcess() = default; - - Yolov3PostProcess(const Yolov3PostProcess &other) = default; - - Yolov3PostProcess &operator=(const Yolov3PostProcess &other); - - APP_ERROR Init(const std::map> &postConfig) override; - - APP_ERROR DeInit() override; - - APP_ERROR Process(const std::vector &tensors, std::vector> &objectInfos, - const std::vector &resizedImageInfos = {}, - const std::map> ¶mMap = {}) override; -protected: - bool IsValidTensors(const std::vector &tensors) const override; - - void ObjectDetectionOutput(const std::vector &tensors, - std::vector> &objectInfos, - const std::vector &resizedImageInfos = {}); - - void CompareProb(int& classID, float& maxProb, float classProb, int classNum); - void CodeDuplicationSetDet(float& x, float& y, float& width, float& height); - void SelectClassNCHW(std::shared_ptr netout, NetInfo info, std::vector& detBoxes, - int stride, OutputLayer layer); - void SelectClassNHWC(std::shared_ptr netout, NetInfo info, std::vector& detBoxes, - int stride, OutputLayer layer); - void SelectClassNCHWC(std::shared_ptr netout, NetInfo info, std::vector& detBoxes, - int stride, OutputLayer layer); - - void GenerateBbox(std::vector> featLayerData, - std::vector &detBoxes, const std::vector>& featLayerShapes, - const int netWidth, const int netHeight); - APP_ERROR GetBiases(std::string& strBiases); - -protected: - float objectnessThresh_ = DEFAULT_OBJECTNESS_THRESH; // Threshold of objectness value - float iouThresh_ = DEFAULT_IOU_THRESH; // Non-Maximum Suppression threshold - int anchorDim_ = DEFAULT_ANCHOR_DIM; - int biasesNum_ = DEFAULT_BIASES_NUM; // Yolov3 anchors, generate from train data, coco dataset - int yoloType_ = DEFAULT_YOLO_TYPE; - int modelType_ = 0; - int yoloVersion_ = DEFAULT_YOLO_VERSION; - int inputType_ = 0; - std::vector biases_ = {}; -}; -#endif \ No newline at end of file -- Gitee From 6245324e1a7a785f2a0b1f788729c1a4e8d3770d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:55:06 +0000 Subject: [PATCH 065/129] =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- .../yolov3PostProcess/Yolov3PostProcess.h | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.h diff --git a/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.h b/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.h new file mode 100644 index 000000000..3d5fd3366 --- /dev/null +++ b/tutorials/mxBaseSample/yolov3PostProcess/Yolov3PostProcess.h @@ -0,0 +1,97 @@ +/* + * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef YOLOV3_POST_PROCESS_H +#define YOLOV3_POST_PROCESS_H +#include "MxBase/PostProcessBases/ObjectPostProcessBase.h" + +namespace { +const float DEFAULT_OBJECTNESS_THRESH = 0.3; +const float DEFAULT_IOU_THRESH = 0.45; +const int DEFAULT_ANCHOR_DIM = 3; +const int DEFAULT_BIASES_NUM = 18; +const int DEFAULT_YOLO_TYPE = 3; +const int DEFAULT_YOLO_VERSION = 3; +const int YOLOV3_VERSION = 3; +const int YOLOV4_VERSION = 4; +const int YOLOV5_VERSION = 5; + +struct OutputLayer { + size_t width; + size_t height; + float anchors[6]; +}; + +struct NetInfo { + int anchorDim; + int classNum; + int bboxDim; + int netWidth; + int netHeight; +}; +} + + +class Yolov3PostProcess : public MxBase::ObjectPostProcessBase { +public: + Yolov3PostProcess() = default; + + ~Yolov3PostProcess() = default; + + Yolov3PostProcess(const Yolov3PostProcess &other) = default; + + Yolov3PostProcess &operator=(const Yolov3PostProcess &other); + + APP_ERROR Init(const std::map &postConfig) override; + + APP_ERROR DeInit() override; + + APP_ERROR Process(const std::vector &tensors, std::vector> &objectInfos, + const std::vector &resizedImageInfos = {}, + const std::map> ¶mMap = {}) override; +protected: + bool IsValidTensors(const std::vector &tensors) const; + + void ObjectDetectionOutput(const std::vector &tensors, + std::vector> &objectInfos, + const std::vector &resizedImageInfos = {}); + + void CompareProb(int& classID, float& maxProb, float classProb, int classNum); + void CodeDuplicationSetDet(float& x, float& y, float& width, float& height); + void SelectClassNCHW(std::shared_ptr netout, NetInfo info, std::vector& detBoxes, + int stride, OutputLayer layer); + void SelectClassNHWC(std::shared_ptr netout, NetInfo info, std::vector& detBoxes, + int stride, OutputLayer layer); + void SelectClassNCHWC(std::shared_ptr netout, NetInfo info, std::vector& detBoxes, + int stride, OutputLayer layer); + + void GenerateBbox(std::vector> featLayerData, + std::vector &detBoxes, const std::vector>& featLayerShapes, + const int netWidth, const int netHeight); + APP_ERROR GetBiases(std::string& strBiases); + +protected: + float objectnessThresh_ = DEFAULT_OBJECTNESS_THRESH; // Threshold of objectness value + float iouThresh_ = DEFAULT_IOU_THRESH; // Non-Maximum Suppression threshold + int anchorDim_ = DEFAULT_ANCHOR_DIM; + int biasesNum_ = DEFAULT_BIASES_NUM; // Yolov3 anchors, generate from train data, coco dataset + int yoloType_ = DEFAULT_YOLO_TYPE; + int modelType_ = 0; + int yoloVersion_ = DEFAULT_YOLO_VERSION; + int inputType_ = 0; + std::vector biases_ = {}; +}; +#endif -- Gitee From cf749e1a4399d802fdc89255003591e4d9b05aee Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:56:22 +0000 Subject: [PATCH 066/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 9380c36cd..403eabe09 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -1,6 +1,6 @@ # 文本分类 -## 1. 介绍 +## 1、介绍 ### 1.1 简介 文本分类插件基于 MindXSDK 开发,在昇腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 @@ -103,7 +103,7 @@ ![image](sdk/flowChart.png) -## 2 设置环境变量 +## 2、设置环境变量 确保环境中正确安装mxVision SDK。 @@ -118,7 +118,7 @@ ascend-toolkit-path: CANN 安装路径 SDK-path: SDK mxVision 安装路径 ``` -## 3 准备模型 +## 3、准备模型 **步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb 下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 @@ -143,7 +143,7 @@ ATC start working now, please wait for a moment. ATC run success, welcome to the next use. ``` -## 4 编译与运行 +## 4、编译与运行 **步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip 下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 @@ -186,7 +186,7 @@ make 执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 -## 5 精度验证 +## 5、精度验证 **步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 @@ -204,5 +204,5 @@ python3 test.py Test::test_accuracy(); ``` -## 6 常见问题 +## 6、常见问题 1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From 2a0165757702cd479bad27e94eee18b70df0f6f1 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 06:57:34 +0000 Subject: [PATCH 067/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 403eabe09..817d69ff0 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -1,6 +1,6 @@ # 文本分类 -## 1、介绍 +## 1 介绍 ### 1.1 简介 文本分类插件基于 MindXSDK 开发,在昇腾芯片上进行文本分类,将分类结果保存。输入一段新闻,可以判断该新闻属于哪个类别。 @@ -103,7 +103,7 @@ ![image](sdk/flowChart.png) -## 2、设置环境变量 +## 2 设置环境变量 确保环境中正确安装mxVision SDK。 @@ -118,7 +118,7 @@ ascend-toolkit-path: CANN 安装路径 SDK-path: SDK mxVision 安装路径 ``` -## 3、准备模型 +## 3 准备模型 **步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb 下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 @@ -143,7 +143,7 @@ ATC start working now, please wait for a moment. ATC run success, welcome to the next use. ``` -## 4、编译与运行 +## 4 编译与运行 **步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip 下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 @@ -186,7 +186,7 @@ make 执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 -## 5、精度验证 +## 5 精度验证 **步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 @@ -204,5 +204,5 @@ python3 test.py Test::test_accuracy(); ``` -## 6、常见问题 +## 6 常见问题 1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From 4b51343601d0fb91cf517e01b1cbc7781a2d1716 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:02:28 +0000 Subject: [PATCH 068/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 35 ++++-------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 817d69ff0..76a08896d 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -11,32 +11,13 @@ 本项目以昇腾Atlas310卡为主要的硬件平台。 ### 1.3 支持的版本 +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | -表1.1 环境依赖软件和版本: - -| 软件名称 | 版本 | -| -------- | ------ | -| cmake | 3.10.2 | -| mxVision | 5.0.0 | -| python | 3.9.2 | -| CANN | 7.0.0 | - -### 1.4 软件方案介绍 - -基于MindX SDK的文本分类业务流程为:待分类文本通过预处理,将文本根据字典vocab.txt进行编码,组成numpy形式的向量,将向量通过 appsrc 插件输入,然后由模型推理插件mxpi_tensorinfer得到每种类别的得分,再通过后处理插件mxpi_classpostprocessor将模型输出的结果处理,最后得到该文本的类别。本系统的各模块及功能描述如表1.2所示: - - -表1.2 系统方案各子系统功能描述: - -| 序号 | 子系统 | 功能描述 | -| ---- | ------ | ------------ | -| 1 | 文本输入 | 读取输入文本 | -| 2 | 文本编码 | 根据字典对输入文本编码 | -| 3 | 模型推理 | 对文本编码后的张量进行推理 | -| 4 | 后处理 | 从模型推理结果中寻找对应的分类标签 | -| 5 | 保存结果 | 将分类结果保存文件| - -### 1.5 代码目录结构与说明 +### 1.4 代码目录结构与说明 本工程名称为文本分类,工程目录如下图所示: @@ -98,10 +79,6 @@ test.sh test_input.py ``` -### 1.6 技术实现流程图 - -![image](sdk/flowChart.png) - ## 2 设置环境变量 -- Gitee From c3de50c4a84b5effa6cb8baf77dc1ef1974c459d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:02:54 +0000 Subject: [PATCH 069/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 76a08896d..d628138b3 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -15,7 +15,6 @@ | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | -| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ### 1.4 代码目录结构与说明 -- Gitee From 182cef329bb06312323e5308125226e51dc6af71 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:03:51 +0000 Subject: [PATCH 070/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index d628138b3..4cf618cc8 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -100,10 +100,12 @@ SDK-path: SDK mxVision 安装路径 下载模型的pb文件,存放到开发环境普通用户下的任意目录,例如:$HOME/models/bert_text_classification。 **步骤2** 执行以下命令使用atc命令进行模型转换: +``` cd $HOME/models/bert_text_classification atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" +``` **步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: -- Gitee From 249543a2b7eabd3182e98496c4682fe5f4ae5260 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:05:50 +0000 Subject: [PATCH 071/129] update contrib/CamouflagedObjectDetection/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CamouflagedObjectDetection/README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md index 269965bc7..2e6d9f157 100644 --- a/contrib/CamouflagedObjectDetection/README.md +++ b/contrib/CamouflagedObjectDetection/README.md @@ -11,19 +11,20 @@ 昇腾Atlas310 ### 1.3 支持的版本 +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | -环境依赖软件和版本如下表: - +### 1.4 三方依赖 | 软件名称 | 版本 | -| :-----------: | :---------: | -| mxVision | 5.0.0 | +| -----------| --------| | Python | 3.9.2 | -| CANN | 7.0.0 | | numpy | 1.21.2 | | opencv-python | 4.5.3.56 | | mindspore (cpu) | 1.9.0 | -### 1.4 代码目录结构与说明 +### 1.5 代码目录结构说明 本工程名称为DGNet,工程目录如下列表所示: -- Gitee From 96bf95cabe7ab21eab129f88a545687e40b3f80e Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:06:06 +0000 Subject: [PATCH 072/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 4cf618cc8..4de9b64f7 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -16,7 +16,7 @@ | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | -### 1.4 代码目录结构与说明 +### 1.4 代码目录结构说明 本工程名称为文本分类,工程目录如下图所示: -- Gitee From d161b70ff2971e1be953011c29f6570310d5c566 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:07:33 +0000 Subject: [PATCH 073/129] update contrib/CamouflagedObjectDetection/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CamouflagedObjectDetection/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md index 2e6d9f157..9b414d9fc 100644 --- a/contrib/CamouflagedObjectDetection/README.md +++ b/contrib/CamouflagedObjectDetection/README.md @@ -62,7 +62,6 @@ ascend-toolkit-path: CANN 安装路径 ## 3 准备模型 -### 模型转换 **步骤1** 下载DGNet (Efficient-B4) 的ONNX模型:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/DGNet.zip -- Gitee From a1c5f1cbe7c6237ab696f823a8cb8cf7cc103a37 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:08:04 +0000 Subject: [PATCH 074/129] update contrib/CamouflagedObjectDetection/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CamouflagedObjectDetection/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md index 9b414d9fc..4987f8d8c 100644 --- a/contrib/CamouflagedObjectDetection/README.md +++ b/contrib/CamouflagedObjectDetection/README.md @@ -80,11 +80,11 @@ atc --framework=5 --model=DGNet.onnx --output=DGNet --input_shape="image:1,3,352 ## 4 编译与运行 示例步骤如下: -**步骤0** +**步骤1** 下载一份测试数据集合:下载链接:https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/snapshots/data.tar -**步骤1** +**步骤2** 执行离线推理Python脚本 -- Gitee From 7beaf9bd44a8cd9e438f066bada92e8dd589fcb2 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:08:30 +0000 Subject: [PATCH 075/129] update contrib/CamouflagedObjectDetection/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CamouflagedObjectDetection/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md index 4987f8d8c..8e0b324af 100644 --- a/contrib/CamouflagedObjectDetection/README.md +++ b/contrib/CamouflagedObjectDetection/README.md @@ -77,7 +77,7 @@ atc --framework=5 --model=DGNet.onnx --output=DGNet --input_shape="image:1,3,352 ``` 执行完模型转换脚本后,会在对应目录中获取到如下转化模型:DGNet.om(本项目中在Ascend平台上所使用的离线模型文件)。 -## 4 编译与运行 +## 4 运行 示例步骤如下: **步骤1** -- Gitee From b85b2ce63f5e846123b515992b8d36bdebb0ea47 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:09:55 +0000 Subject: [PATCH 076/129] update contrib/CrowdCounting/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CrowdCounting/README.md | 34 +++++---------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/contrib/CrowdCounting/README.md b/contrib/CrowdCounting/README.md index 3688aa366..2c8200716 100644 --- a/contrib/CrowdCounting/README.md +++ b/contrib/CrowdCounting/README.md @@ -11,42 +11,18 @@ ### 1.3 支持的版本 -环境依赖软件和版本如下表: +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | -表1.1 系统方案中各模块功能: -| 软件名称 | 版本 | 说明 | -| -------- | ----- | ------------------------------------------------------------ | -| mxVision | 5.0.0 | 封装昇腾计算语言(AscendCL)的高级编程API,简化插件和推理应用开发。 | -| CANN | 7.0.0 | 提供昇腾计算语言(AscendCL)的高级编程API。 | - -### 1.4 软件方案介绍 - -人群计数项目实现:输入类型是图片数据(例如jpg格式的图片),通过调用MindX SDK mxBase提供的接口,使用DVPP进行图像解码,解码后获取图像数据,然后经过图像尺寸大小变换,满足模型的输入尺寸要求;将尺寸变换后的图像数据输入人群计数模型进行推理,模型输出经过后处理后,得到人群密度估计图和人计数估计值,输出人计数的估计值。 - -整个流程需要参考Ascend的参考样例:crowd_count_picture 样例,详见以下链接:https://gitee.com/ascend/samples/tree/master/python/contrib/crowd_count_picture crowd_count_picture 样例是基于ACL实现的,本任务需要参考crowd_count_picture 样例,基于MindX SDK mxBase的接口实现。MindX SDK mxBase是对ACL接口的封装,提供了极简易用的API, 使能AI应用的开发。 - -表1.2 系统方案中各模块功能: - -| 序号 | 子系统 | 功能描述 | -| ---- | ----------------- | ------------------------------------------------------------ | -| 1 | 设备初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的初始化。 | -| 2 | 图像输入 | C++文件IO读取图像文件 | -| 3 | 图像解码/图像缩放 | 调用mxBase::DvppWrappe.DvppJpegDecode()函数完成图像解码,VpcResize()完成缩放。 | -| 4 | 模型推理 | 调用mxBase:: ModelInferenceProcessor 接口完成模型推理 | -| 5 | 后处理 | 获取模型推理输出张量BaseTensor,进行后处理。 | -| 6 | 保存结果 | 输出图像当中的人的数量,保存标记出人数的结果图像。 | -| 7 | 设备去初始化 | 调用mxBase::DeviceManager接口完成推理卡设备的去初始化。 | - -### 1.5 代码目录结构与说明 +### 1.4 代码目录结构说明 本sample工程名称为 **CrowdCounting**,工程目录如下图所示: ![image-20210813152252629](image-20210813152252629.png) -### 1.6 技术实现流程图 - -![image-20210813154111508](image-20210813154111508.png) ## 2 设置环境变量: -- Gitee From ec7bbe30adc740d91bf15b138df1ed4eb7334017 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:11:43 +0000 Subject: [PATCH 077/129] update contrib/EdgeDetectionPicture/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md index ac3b4626a..7144d8f8c 100644 --- a/contrib/EdgeDetectionPicture/README.md +++ b/contrib/EdgeDetectionPicture/README.md @@ -11,12 +11,10 @@ 昇腾310(推理) #### 1.3 支持的版本 -本样例配套的CANN版本为7.0.0,MindX SDK版本为5.0.0 -MindX SDK安装前准备可参考《用户指南》,[安装教程](https://gitee.com/ascend/mindxsdk-referenceapps/blob/master/docs/quickStart/1-1%E5%AE%89%E8%A3%85SDK%E5%BC%80%E5%8F%91%E5%A5%97%E4%BB%B6.md) -| 软件 | 版本 | 说明 | -| ------------------- | ------------ | ---------------------------- | -| mxVision | 5.0.0 | mxVision软件包 | -| Ascend-CANN-toolkit | 7.0.0 | Ascend-cann-toolkit开发套件包 | +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | #### 1.4 代码目录结构说明 -- Gitee From 2269bd19305e1be6a36c9db815143aceba5b13e5 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:12:37 +0000 Subject: [PATCH 078/129] update contrib/IAT/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/IAT/README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md index b5be74106..acffe06c0 100644 --- a/contrib/IAT/README.md +++ b/contrib/IAT/README.md @@ -11,11 +11,16 @@ ### 1.3 支持的版本 -| 名称 | 版本 | +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | + +### 1.4 三方依赖 + +| 软件名称 | 版本 | | ------------- | ---------------- | -| mxVision | 5.0.0 | | Python | 3.9.2 | -| CANN | 7.0.0 | | numpy | 1.22.3 | | opencv-python | 4.5.5 | | onnxsim | 0.4.10 | -- Gitee From a39c96a9f3a073ff7a672225e55b2b2b66ce9867 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:13:44 +0000 Subject: [PATCH 079/129] update contrib/IAT/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/IAT/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md index acffe06c0..4ac49042a 100644 --- a/contrib/IAT/README.md +++ b/contrib/IAT/README.md @@ -26,7 +26,7 @@ | onnxsim | 0.4.10 | -### 1.4 代码目录结构与说明 +### 1.4 代码目录结构说明 eg:本sample工程名称为XXX,工程目录如下图所示: -- Gitee From aeb336338400a25bff79f44090fa10196ac660bc Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:14:18 +0000 Subject: [PATCH 080/129] update contrib/IAT/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/IAT/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md index 4ac49042a..42d28a9c6 100644 --- a/contrib/IAT/README.md +++ b/contrib/IAT/README.md @@ -59,7 +59,7 @@ ascend_toolkit_path: CANN 安装路径 ``` -## 3 编译与运行 +## 3 运行 ### 3.1 推理示例代码 **步骤1** (下载原模型代码) -- Gitee From fb4b81a1776a2e142d6b214cadd36d4b3bc7df70 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:16:14 +0000 Subject: [PATCH 081/129] update contrib/TSM/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/TSM/README.md | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/contrib/TSM/README.md b/contrib/TSM/README.md index d3828738c..13e99c33d 100644 --- a/contrib/TSM/README.md +++ b/contrib/TSM/README.md @@ -10,22 +10,21 @@ 以昇腾Atlas310卡为主要的硬件平台 ### 1.3 支持的版本 -环境依赖软件和版本如下表: +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | + +### 1.4 三方依赖 | 软件名称 | 版本 | |----------|--------| | cmake | 3.5+ | -| mxVision | 5.0.0 | -| CANN | 7.0.0 | | Python | 3.9 | | torch | 1.10.0 | | ffmpeg | 4.2.1 | -### 1.4 软件方案介绍 - -项目主要由离线精度测试文件,在线功能测试文件,离线单视频推理性能测试文件,模型文件,测试数据集预处理文件组成。 - -### 1.5 代码目录结构与说明 +### 1.5 代码目录结构说明 ```text ├── TSM @@ -45,17 +44,6 @@ ├── speed_gpu.py // 离线单视频推理GPU性能脚本 ``` -### 1.6技术实现流程 - -在线推理流程: - -![离线推理流程](./online.png) - -### 1.7特性及适用场景 - -在线模型: - -本案例中的在线模型适用于26中手势识别,并可以返回识别手势的名称。 ## 2 设置环境变量 -- Gitee From 54b73d77e927db0b687c3bb36a4d39cad5d6a054 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:17:25 +0000 Subject: [PATCH 082/129] update contrib/VCOD_SLTNet/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VCOD_SLTNet/README.md | 44 +++++++---------------------------- 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md index 6eec8cb1d..e718eb802 100644 --- a/contrib/VCOD_SLTNet/README.md +++ b/contrib/VCOD_SLTNet/README.md @@ -14,11 +14,16 @@ ### 1.3 支持的版本 +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | + +### 1.4 三方依赖 + | 软件名称 | 版本 | | -------- | ------ | -| mxVision | 5.0.0 | | Python | 3.9.2 | -| CANN | 7.0.0 | | PyTorch | 1.12.1 | | numpy | 1.21.5 | | imageio | 2.22.3| @@ -29,13 +34,7 @@ | mindspore | 2.0.0| -### 1.4 软件方案介绍 - - -本方案中,先通过 `torch2onnx.py` 脚本将 PyTorch 版本的伪装视频物体检测模型 SLT-Net 转换为 onnx 模型;然后通过 `inference.py` 脚本调用昇腾om模型,将输入视频帧进行图像处理,最终生成视频伪装物体的掩膜 Mask 图。 - - -### 1.5 代码目录结构与说明 +### 1.5 代码目录结构说明 本sample工程名称为 VCOD_SLTNet,工程目录如下图所示: @@ -48,33 +47,6 @@ ``` -### 1.6 技术实现流程图 - -![Flowchart](./flowchart.jpeg) - -图1 视频伪装物体检测流程图 - - -### 1.7 特性及适用场景 - -对于伪装视频数据的分割任务均适用,输入视频需要转换为图片序列输入到模型中,具体可以参考 MoCA 数据格式与目录结构(如下所示),详见 [SLT-Net](https://xueliancheng.github.io/SLT-Net-project/) 与 [MoCA 数据集主页](https://www.robots.ox.ac.uk/~vgg/data/MoCA/)。 - - -``` ---data - └── TestDataset_per_sq # 测试数据集 - ├── flower_crab_spider_1 # 不同场景 - ├── GT # Ground Truth - ├── 00000.png - ├── ..... - └── Imgs # 输入图片序列 - ├── 00000.jpg - ├── ..... - ...... - -``` - - ## 2 设置环境变量 在运行项目前,需要设置环境变量: -- Gitee From 2d25e5b35920de4f2b522bf8d5940394f4df8446 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:19:46 +0000 Subject: [PATCH 083/129] update tutorials/DvppWrapperSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/DvppWrapperSample/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tutorials/DvppWrapperSample/README.md b/tutorials/DvppWrapperSample/README.md index 3c113b057..a495c705b 100644 --- a/tutorials/DvppWrapperSample/README.md +++ b/tutorials/DvppWrapperSample/README.md @@ -12,10 +12,10 @@ ### 1.3 支持的版本 -| 软件名称 | 版本 | -| -------- | ------ | -| mxVision | 5.0.0 | -| CANN | 7.0.0 | +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | ## 2 设置环境变量 ASCEND_HOME Ascend安装的路径,一般为/usr/local/Ascend @@ -27,10 +27,8 @@ export ARCH_PATTERN=. export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib/modelpostprocessors:${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:${LD_LIBRARY_PATH} ``` -## 3 准备模型 -打开百度图片https://image.baidu.com/,输入任何关键字,然后搜索,右击任意图片,点击另存为。把图片保存在DvppWrapperSample目录下。 -## 4 编译与运行 +## 3 编译与运行 **步骤1** 修改CMakeLists.txt文件 将set(MX_SDK_HOME ${SDK安装路径}) 中的${SDK安装路径}替换为实际的SDK安装路径 **步骤2** cd到DvppWrapperSample目录下,执行如下编译命令: @@ -40,7 +38,9 @@ cd build cmake .. make ``` -**步骤3** cd到DvppWrapperSample目录下,可看到可执行文件DvppWrapperSample, 实行命令: +**步骤3** 打开百度图片https://image.baidu.com/,输入任何关键字,然后搜索,右击任意图片,点击另存为。把图片保存在DvppWrapperSample目录下。 + +**步骤4** cd到DvppWrapperSample目录下,可看到可执行文件DvppWrapperSample, 实行命令: ``` ./DvppWrapperSample ./保存的图片 ``` -- Gitee From 2a2fc103efaa2affa06ac206a7c93a4d5bfa91b3 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:20:22 +0000 Subject: [PATCH 084/129] update tutorials/DvppWrapperSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/DvppWrapperSample/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/DvppWrapperSample/README.md b/tutorials/DvppWrapperSample/README.md index a495c705b..1fd332c3f 100644 --- a/tutorials/DvppWrapperSample/README.md +++ b/tutorials/DvppWrapperSample/README.md @@ -38,7 +38,7 @@ cd build cmake .. make ``` -**步骤3** 打开百度图片https://image.baidu.com/,输入任何关键字,然后搜索,右击任意图片,点击另存为。把图片保存在DvppWrapperSample目录下。 +**步骤3** 打开百度图片 https://image.baidu.com/ ,输入任何关键字,然后搜索,右击任意图片,点击另存为。把图片保存在DvppWrapperSample目录下。 **步骤4** cd到DvppWrapperSample目录下,可看到可执行文件DvppWrapperSample, 实行命令: ``` -- Gitee From a0df48d42404661ccaa1c1e91d29ba2affb3dc90 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:21:15 +0000 Subject: [PATCH 085/129] update tutorials/mxBaseSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/mxBaseSample/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tutorials/mxBaseSample/README.md b/tutorials/mxBaseSample/README.md index 431ae7d8f..b1062885e 100644 --- a/tutorials/mxBaseSample/README.md +++ b/tutorials/mxBaseSample/README.md @@ -9,11 +9,11 @@ 本项目以昇腾Atlas310p为主要的硬件平台。 ### 1.3 支持的版本 - -| 软件名称 | 版本 | -| -------- | ------ | -| mxVision | 6.0.RC2 | -| CANN | 7.0.0 | +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ## 2 设置环境变量 -- Gitee From ed83fa85244384fcab89adf807e8ba728f6f19f8 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 21 Oct 2024 07:21:42 +0000 Subject: [PATCH 086/129] update tutorials/mxBaseSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/mxBaseSample/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tutorials/mxBaseSample/README.md b/tutorials/mxBaseSample/README.md index b1062885e..9686ecd3b 100644 --- a/tutorials/mxBaseSample/README.md +++ b/tutorials/mxBaseSample/README.md @@ -34,8 +34,10 @@ SDK-path: SDK mxVision 安装路径 ## 3 准备模型 **步骤1** 模型获取 在ModelZoo上下载YOLOv3模型。[下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/ActionRecognition/ATC%20YOLOv3%28FP16%29%20from%20TensorFlow%20-%20Ascend310.zip) + **步骤2** 模型存放 将获取到的YOLOv3模型pb文件放至上一级的models文件夹中 + **步骤3** 执行模型转换命令 ``` -- Gitee From d756fe03791701a80f46710b732937d70c4f285f Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 02:20:07 +0000 Subject: [PATCH 087/129] update tutorials/DvppWrapperSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/DvppWrapperSample/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tutorials/DvppWrapperSample/README.md b/tutorials/DvppWrapperSample/README.md index 1fd332c3f..4166067b6 100644 --- a/tutorials/DvppWrapperSample/README.md +++ b/tutorials/DvppWrapperSample/README.md @@ -8,7 +8,7 @@ ### 1.2 支持的产品 -本项目以昇腾Atlas310卡为主要的硬件平台。 +本项目以昇腾Atlas310p为主要的硬件平台。 ### 1.3 支持的版本 @@ -16,6 +16,7 @@ | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ## 2 设置环境变量 ASCEND_HOME Ascend安装的路径,一般为/usr/local/Ascend @@ -44,4 +45,4 @@ make ``` ./DvppWrapperSample ./保存的图片 ``` -最后会生成缩放resize_result.jpg、抠图后保存的图片write_result_crop.jpg,以及编码保存的视频test.h264。 \ No newline at end of file +**步骤5** 查看结果:最后会生成缩放resize_result.jpg、抠图后保存的图片write_result_crop.jpg,以及编码保存的视频test.h264。 \ No newline at end of file -- Gitee From 69956472d088220070deefe0aa724a71057e23d9 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 03:47:49 +0000 Subject: [PATCH 088/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 55 +++--------------------- 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 4de9b64f7..08e31c633 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -8,13 +8,14 @@ ### 1.2 支持的产品 -本项目以昇腾Atlas310卡为主要的硬件平台。 +本项目以昇腾Atlas310B为主要的硬件平台。 ### 1.3 支持的版本 本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ### 1.4 代码目录结构说明 @@ -25,28 +26,6 @@ │ build.sh │ README.md │ tree.txt -│ -├─mxBase -│ │ build.sh -│ │ CMakeLists.txt -│ │ main.cpp -│ │ -│ ├─BertClassification -│ │ BertClassification.cpp -│ │ BertClassification.h -│ │ -│ ├─data -│ │ vocab.txt -│ │ -│ ├─model -│ │ bert_text_classification_labels.names -│ │ -│ ├─out -│ │ prediction_label.txt -│ │ -│ └─test -│ Test.cpp -│ Test.h │ └─sdk │ build.sh @@ -104,14 +83,13 @@ SDK-path: SDK mxVision 安装路径 cd $HOME/models/bert_text_classification -atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310 --op_select_implmode="high_precision" +atc --model=bert_text_classification.pb --framework=3 --input_format="ND" --output=bert_text_classification --input_shape="input_1:1,300;input_2:1,300" --out_nodes=dense_1/Softmax:0 --soc_version=Ascend310B1 --op_select_implmode="high_precision" ``` **步骤3** 执行以下命令将转换好的模型复制到项目中model文件夹中: ``` cp ./bert_text_classification.om $HOME/sdk/model/ -cp ./bert_text_classification.om $HOME/mxBase/model/ ``` **步骤4** 执行成功后终端输出为: @@ -145,30 +123,13 @@ sdk/pipeline目录下BertTextClassification.pipeline文件中的第26行: python3 main.py ``` -命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 - -**步骤6** mxBase项目在mxBase目录中,执行以下代码进行编译。 - -``` -mkdir build -cd build -cmake .. -make -``` - -编译完成后,将可执行文件 mxBase_text_classification 移动到mxBase目录下,执行下面代码运行 - -``` -./mxBase_text_classification ./data/sample.txt -``` - -执行成功后在服务器的mxBase/out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 +**步骤6** 查看结果:命令执行成功后在out目录下生成分类结果文件 prediction_label.txt,查看结果文件验证分类结果。 ## 5 精度验证 **步骤1** 已按照上一小节 编译与运行 的步骤将样例运行成功。 -**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件分别放在sdk/data目录和mxBase/data目录。 +**步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件放在sdk/data目录。 **步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 @@ -176,11 +137,5 @@ make python3 test.py ``` -**步骤4** mxBase项目中,将mxBase目录下main.cpp中main方法的全部代码注释,替换为下面代码(即main函数中仅包含以下代码),参考第4小节 编译与运行 中的步骤4重新编译并运行,得到mxBase的精度测试结果。 - -``` -Test::test_accuracy(); -``` - ## 6 常见问题 1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From e722f8e1d9cbaa89e00af8c7e84bfd7a6904aca8 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 03:48:52 +0000 Subject: [PATCH 089/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 08e31c633..98c55ef99 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -101,7 +101,7 @@ ATC run success, welcome to the next use. ## 4 编译与运行 -**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip 下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的mxBase/data和sdk/data目录下。 +**步骤1** 从https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip 下载测试数据并解压,解压后的sample.txt和test.csv文件放在项目的sdk/data目录下。 **步骤2** 按照第 2 小节 环境依赖 中的步骤设置环境变量。 -- Gitee From 16fc57661a0c6c0f47b9bb67777c2c7fac4de0b2 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 03:51:58 +0000 Subject: [PATCH 090/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 98c55ef99..68967b158 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -17,7 +17,14 @@ | 5.0.0 | 7.0.0 | 23.0.0 | | 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | -### 1.4 代码目录结构说明 +### 1.4 三方依赖 + +| 软件名称 | 版本 | +| -------- | ------ | +| cmake | 3.10.2 | +| python | 3.9.2 | + +### 1.5 代码目录结构说明 本工程名称为文本分类,工程目录如下图所示: -- Gitee From 8005abc5b4577be47588d297dfe78c30917ef072 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 04:08:31 +0000 Subject: [PATCH 091/129] update tutorials/mxBaseSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/mxBaseSample/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tutorials/mxBaseSample/README.md b/tutorials/mxBaseSample/README.md index 9686ecd3b..d42fb5a53 100644 --- a/tutorials/mxBaseSample/README.md +++ b/tutorials/mxBaseSample/README.md @@ -6,14 +6,13 @@ 本开发样例是基于mxBase开发的端到端推理的C++应用程序,可在昇腾芯片上进行 yolov3 目标检测,并把可视化结果保存到本地。其中包含yolov3的后处理模块开发。 ### 1.2 支持的产品 -本项目以昇腾Atlas310p为主要的硬件平台。 +本项目以昇腾x86_64 Atlas 300l (型号3010) 和arm Atlas 300l (型号3000)为主要的硬件平台。 ### 1.3 支持的版本 本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | -| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ## 2 设置环境变量 -- Gitee From 8056861b17afb45873fbd6831fe8c8115f5412e6 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 04:09:33 +0000 Subject: [PATCH 092/129] update tutorials/mxBaseSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/mxBaseSample/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/tutorials/mxBaseSample/README.md b/tutorials/mxBaseSample/README.md index d42fb5a53..f2b6414fa 100644 --- a/tutorials/mxBaseSample/README.md +++ b/tutorials/mxBaseSample/README.md @@ -64,3 +64,4 @@ cd 到mxbase 目录下 ``` ./mxBase_sample ./test.jpg ``` +**步骤5** 查看结果:可在mxbase目录下查看到已生成结果result.jpg \ No newline at end of file -- Gitee From 9c02fed29f9b8221d238300af6b88edbcf3ad6bc Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 07:02:34 +0000 Subject: [PATCH 093/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 3 ++- contrib/BertTextClassification/sdk/image.png | Bin 0 -> 4852 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 contrib/BertTextClassification/sdk/image.png diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 68967b158..fdc75dc4d 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -138,11 +138,12 @@ python3 main.py **步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件放在sdk/data目录。 -**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果。 +**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果如下所示。 ``` python3 test.py ``` +![输入图片说明](sdk/image.png) ## 6 常见问题 1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file diff --git a/contrib/BertTextClassification/sdk/image.png b/contrib/BertTextClassification/sdk/image.png new file mode 100644 index 0000000000000000000000000000000000000000..d2ec42671e2e50a54eec5214ecf25378bbe9a7d2 GIT binary patch literal 4852 zcmZvgS5y%%1(9-`P>LA;bXy0Ju$z^{wgaBz?HD z0qOI`%(Z*~fVas+|CVhC!+MrgaDh?f^Y`efGeT{ty4GW@c7REGOUm2LX>jdMt3%(9oP}8!hpNeN^0$Q}hb^en-T28Rgk8 zJtJAr!YgfO@W$9oYvR(xhF;*vs&-OaaO|AziKBkFKX=8a$9~juYRslu90#)2^n5Ag z;#uJ-BqjB-xg+b<}m-{;v6u11?#Kk&rCjVxfqMqi~Mu?;nyqe%d5mEfSW9jvbJd( z*lP;ckbeC!3|#(B!Jr<#Ust*OVFz=JFQzKshHRw|bt&R)PotdnXcE(D=V#xIRd(-W zjGgD2zeW%U(ZPevVIWt(Mb*^{<96_=1g{q+md*4%Lc+0gO>J^(NuR&4KW3{noj$Vr z95c)8;V}R%E@q-l?Tx8#YA^` z(p`w#E&~U~%Pjqf8M<;^kt*{}tS`1~@Is%5&fj0#=^>PnWD?#A-=FZfpLE^KpVeD$ zNeOg7%*1vhaazz$7{g;;<30-=)qKI_g;b(`O8M0%#dW9IvvsEpxFxJi$x zuf}D&2rX?pF;_JOxrH5L`zX1BpfD?@ie=|9Po#B|loo%^wXw73`xiqxBuL@+oOU-M z#H$2pExc0{Y|M$3Pii*KYLQiJR;Mlg7zQjA`N31CKM~`=1UFqoDxw&)X4-vOZvW%H zFe3wUh#zCU+Ynu4P`BUtF z$OAMOk`jC`tmR>~+YwE5kv^+yZLN(r%Q>d=>~bd!tFV!om->+pNXC$gpGEG+Yoa?g zyFFxq%>tdcJD%Oa!xy6*Ud0fNwfMtu24N{QBs{;((2|z79t-ctli*ig??8D25_+t~ZNrCM(9Kq!iqSFs=mi^w|*OUOSJ+(<3b> z`dM2x7Zt*IgJOa$QB#~Pz7V{Rbw&~t#S*wyMqbdze;hh%tU(Bm<{+(HtW)@J(=+QM4uc zkHP5Cvr+dl%?N@XJ`l(4qvTyWNr32GE89%&@*R{oLZ7g-f;ay@gUc&VW&gBEOQw;h zGDc-SE-ySPqD5^)GR~bPz7ktwh8s$rE68LoZ}UyG@SL!i3q}-$>^m$L4A>vB&s;n> zjZz<8!V;e%#+7Xlm9IXfF+z&ADgR@5pMsbLkg`=5xE~r%}`>b@NC^a4N6|_35@bvy20z%yOI?wV*fG8 zz7c;(wUzHJix+&)q)zy3aTIUbjc{RmLMZxziUr&}DmWgd6_tt2#jEa&Ue9UAk3 z5hRf)^>Uqw0h)b4s%Jj%16*eYItgh$Kiw|Ln)VkkG&|h_Z9efWE=u9anPa7WeSHu! zt9q$Z$WT(2m=oY~6LaW_Lkn)9M>@=!2VUdG@z&k+XP@`Ki!_k&OscTg*#oAF=H8R~7h^qb3%zPeo#x_LP3NmFj&f?!x8rvu%i48 z{LYPk9LG#dd{eDvRA*8VMF)2yDs9is&EB6UCwaSQ+bBJ2X7{W3H`&E_UQmC(`h^kz zMRlZI^gbQ$11-&L`2A#Z4FAGQr$d=9wP$PUrNeUVg+S1pJ-$Jgs5Rfgtvna6(da~O zysUH@*uaml>FORSVxsv->oQM*L;rs^w8r0+L(3bB+Q6wRX~qOU30vWXSA??y%N#_a>n3=7M7N(9=OAc_&ddI@CVI@6U){2c#y+qVdz(rm}rjxcn*`5lMSP9z#DclJ$RX4T&t4_ z2xus-cg9Lq2eT!U<(Bh=vO~;i3!$7WxSce>Y5)A%#W!~tRG7Sa@$iI8q0d549K_gi zrb~wGrMBgyH6z{z(?)+V{!ut*+7k)@EHt zxxxM{FwsuXP_T06C{{;%CIDApyuOV^6x*)H3QA;6CY2{g6)E`#u z(`4Lw$*mFx{Lb~iUEkd4>DY>fyT)jaZfU&f?=$QmCwp2bC}Af%ns|OPG!5qc3Y;t9 zjEuOP8O|M0p#6AYd_z30^EU)ZB9K_4xu07AZRC)SOTl|r{llSQ3uyhCC0w2Ht1~tmFOg#Es+h^YM#|O zE62O20V=E_PA8>6rEX1_r_`+qwAlI5!P5ZTCRSf9XNvZ%POcUPQZdq=g_Nt-C_F>Ra{rC`N|h^7n3;_=ivOnC)vk~BDTps zBnWPP{Kck^5;C!KI5H+QTnVrXA5lZSZ6hiOQ07^UWK)T*o(!HXMySs+>QyXRNKdOZ#v_TiG$i}S9>55XEP+_U8PV9t?m`yxFT{RP)l zFdzNES?IrAbp;rEdGM(Uw^MKR4W`0g!z-t#6$d2!-Z}Iic?rp^;>Pgg6)?i<(MWYQ zEE#ph4XI1&nF*4y-Fzs=a)j=@c!20ii`rp;x0PhbYAws(XcVlXbrNf}J*s`faV-~0SvEC2)eU;^*NoTqCh@j!JBpCI zr5xERs5eUo=|H$-e+qpDa+v`mO;x(jPr4yED%8FwO`-2ky1Cz#)I6UYb zg(PJ62cCsCT$&bo<=BPjG6ZZL}Rf@HaX7v6isIJP{Ec6c$ZVmaD8+CG98n#95 zDsAX>%O*yLJeVs(H92n_anl;GUg^$S`qOq93cy#l5r_pqt&-6XYx&W5 zN8AgUQWJPV%rTWpR9p&HZ?26GdmpAMVpYRUF0>@DWKrY>It*OO>~kS$vYc*pS>J!@ z{0VX>Zrpq48(P)5Wnv*u8Qla%9rbdoa~GEN-(s7mc-F^FOI2*xx?bDTL7S!@dZV)*kLl4ZgdNx~6oD87K z{Ic0q6R<0E?=>Nqnh}hT3B918$A<`+=-&Z*sskzYttEe1faBnX`96y&ZO**w{bwGzhPA{2CCZ zi%#568nAJ*MptX3`7@{C+KUN0gZFDm!7{cFL^DFQat{rgBc#JtJRXMZe(r16)fklY z7uoxoX`1od-ujbbDt=$KwvAik(O+kzrlYL=1htJQ$T47ByifEN{Wl9>VqmUcsp}f^ EAD56zr2qf` literal 0 HcmV?d00001 -- Gitee From 123680b440ecba29dee1d5fd315e3cdb37288355 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 07:04:16 +0000 Subject: [PATCH 094/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index fdc75dc4d..ed44ab175 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -138,12 +138,11 @@ python3 main.py **步骤2** 下载[数据集](https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/data.zip)后解压,将解压后的test.csv文件放在sdk/data目录。 -**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果如下所示。 +**步骤3** pipeline项目中的精度测试文件为sdk/test目录下的test.py,将test.py移到sdk目录下,执行下面代码,得到pipeline的精度测试结果,会在out目录下生成精度验证结果文件accuracy.txt。 ``` python3 test.py ``` -![输入图片说明](sdk/image.png) ## 6 常见问题 1.本项目的设计为限制输入样例为txt文件,其他文件如图片、音频输入则会报错。 \ No newline at end of file -- Gitee From b367b47a31cab39e0e43fc9419c1f84ae41b53fd Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 07:04:26 +0000 Subject: [PATCH 095/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/BertTextClassification/sdk/image.png?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/BertTextClassification/sdk/image.png | Bin 4852 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 contrib/BertTextClassification/sdk/image.png diff --git a/contrib/BertTextClassification/sdk/image.png b/contrib/BertTextClassification/sdk/image.png deleted file mode 100644 index d2ec42671e2e50a54eec5214ecf25378bbe9a7d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4852 zcmZvgS5y%%1(9-`P>LA;bXy0Ju$z^{wgaBz?HD z0qOI`%(Z*~fVas+|CVhC!+MrgaDh?f^Y`efGeT{ty4GW@c7REGOUm2LX>jdMt3%(9oP}8!hpNeN^0$Q}hb^en-T28Rgk8 zJtJAr!YgfO@W$9oYvR(xhF;*vs&-OaaO|AziKBkFKX=8a$9~juYRslu90#)2^n5Ag z;#uJ-BqjB-xg+b<}m-{;v6u11?#Kk&rCjVxfqMqi~Mu?;nyqe%d5mEfSW9jvbJd( z*lP;ckbeC!3|#(B!Jr<#Ust*OVFz=JFQzKshHRw|bt&R)PotdnXcE(D=V#xIRd(-W zjGgD2zeW%U(ZPevVIWt(Mb*^{<96_=1g{q+md*4%Lc+0gO>J^(NuR&4KW3{noj$Vr z95c)8;V}R%E@q-l?Tx8#YA^` z(p`w#E&~U~%Pjqf8M<;^kt*{}tS`1~@Is%5&fj0#=^>PnWD?#A-=FZfpLE^KpVeD$ zNeOg7%*1vhaazz$7{g;;<30-=)qKI_g;b(`O8M0%#dW9IvvsEpxFxJi$x zuf}D&2rX?pF;_JOxrH5L`zX1BpfD?@ie=|9Po#B|loo%^wXw73`xiqxBuL@+oOU-M z#H$2pExc0{Y|M$3Pii*KYLQiJR;Mlg7zQjA`N31CKM~`=1UFqoDxw&)X4-vOZvW%H zFe3wUh#zCU+Ynu4P`BUtF z$OAMOk`jC`tmR>~+YwE5kv^+yZLN(r%Q>d=>~bd!tFV!om->+pNXC$gpGEG+Yoa?g zyFFxq%>tdcJD%Oa!xy6*Ud0fNwfMtu24N{QBs{;((2|z79t-ctli*ig??8D25_+t~ZNrCM(9Kq!iqSFs=mi^w|*OUOSJ+(<3b> z`dM2x7Zt*IgJOa$QB#~Pz7V{Rbw&~t#S*wyMqbdze;hh%tU(Bm<{+(HtW)@J(=+QM4uc zkHP5Cvr+dl%?N@XJ`l(4qvTyWNr32GE89%&@*R{oLZ7g-f;ay@gUc&VW&gBEOQw;h zGDc-SE-ySPqD5^)GR~bPz7ktwh8s$rE68LoZ}UyG@SL!i3q}-$>^m$L4A>vB&s;n> zjZz<8!V;e%#+7Xlm9IXfF+z&ADgR@5pMsbLkg`=5xE~r%}`>b@NC^a4N6|_35@bvy20z%yOI?wV*fG8 zz7c;(wUzHJix+&)q)zy3aTIUbjc{RmLMZxziUr&}DmWgd6_tt2#jEa&Ue9UAk3 z5hRf)^>Uqw0h)b4s%Jj%16*eYItgh$Kiw|Ln)VkkG&|h_Z9efWE=u9anPa7WeSHu! zt9q$Z$WT(2m=oY~6LaW_Lkn)9M>@=!2VUdG@z&k+XP@`Ki!_k&OscTg*#oAF=H8R~7h^qb3%zPeo#x_LP3NmFj&f?!x8rvu%i48 z{LYPk9LG#dd{eDvRA*8VMF)2yDs9is&EB6UCwaSQ+bBJ2X7{W3H`&E_UQmC(`h^kz zMRlZI^gbQ$11-&L`2A#Z4FAGQr$d=9wP$PUrNeUVg+S1pJ-$Jgs5Rfgtvna6(da~O zysUH@*uaml>FORSVxsv->oQM*L;rs^w8r0+L(3bB+Q6wRX~qOU30vWXSA??y%N#_a>n3=7M7N(9=OAc_&ddI@CVI@6U){2c#y+qVdz(rm}rjxcn*`5lMSP9z#DclJ$RX4T&t4_ z2xus-cg9Lq2eT!U<(Bh=vO~;i3!$7WxSce>Y5)A%#W!~tRG7Sa@$iI8q0d549K_gi zrb~wGrMBgyH6z{z(?)+V{!ut*+7k)@EHt zxxxM{FwsuXP_T06C{{;%CIDApyuOV^6x*)H3QA;6CY2{g6)E`#u z(`4Lw$*mFx{Lb~iUEkd4>DY>fyT)jaZfU&f?=$QmCwp2bC}Af%ns|OPG!5qc3Y;t9 zjEuOP8O|M0p#6AYd_z30^EU)ZB9K_4xu07AZRC)SOTl|r{llSQ3uyhCC0w2Ht1~tmFOg#Es+h^YM#|O zE62O20V=E_PA8>6rEX1_r_`+qwAlI5!P5ZTCRSf9XNvZ%POcUPQZdq=g_Nt-C_F>Ra{rC`N|h^7n3;_=ivOnC)vk~BDTps zBnWPP{Kck^5;C!KI5H+QTnVrXA5lZSZ6hiOQ07^UWK)T*o(!HXMySs+>QyXRNKdOZ#v_TiG$i}S9>55XEP+_U8PV9t?m`yxFT{RP)l zFdzNES?IrAbp;rEdGM(Uw^MKR4W`0g!z-t#6$d2!-Z}Iic?rp^;>Pgg6)?i<(MWYQ zEE#ph4XI1&nF*4y-Fzs=a)j=@c!20ii`rp;x0PhbYAws(XcVlXbrNf}J*s`faV-~0SvEC2)eU;^*NoTqCh@j!JBpCI zr5xERs5eUo=|H$-e+qpDa+v`mO;x(jPr4yED%8FwO`-2ky1Cz#)I6UYb zg(PJ62cCsCT$&bo<=BPjG6ZZL}Rf@HaX7v6isIJP{Ec6c$ZVmaD8+CG98n#95 zDsAX>%O*yLJeVs(H92n_anl;GUg^$S`qOq93cy#l5r_pqt&-6XYx&W5 zN8AgUQWJPV%rTWpR9p&HZ?26GdmpAMVpYRUF0>@DWKrY>It*OO>~kS$vYc*pS>J!@ z{0VX>Zrpq48(P)5Wnv*u8Qla%9rbdoa~GEN-(s7mc-F^FOI2*xx?bDTL7S!@dZV)*kLl4ZgdNx~6oD87K z{Ic0q6R<0E?=>Nqnh}hT3B918$A<`+=-&Z*sskzYttEe1faBnX`96y&ZO**w{bwGzhPA{2CCZ zi%#568nAJ*MptX3`7@{C+KUN0gZFDm!7{cFL^DFQat{rgBc#JtJRXMZe(r16)fklY z7uoxoX`1od-ujbbDt=$KwvAik(O+kzrlYL=1htJQ$T47ByifEN{Wl9>VqmUcsp}f^ EAD56zr2qf` -- Gitee From 1aca9a697162f36463b51a364be9d38ac328c6a4 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 07:04:35 +0000 Subject: [PATCH 096/129] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?contrib/BertTextClassification/mxBase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BertClassification/BertClassification.cpp | 290 - .../BertClassification/BertClassification.h | 40 - .../mxBase/CMakeLists.txt | 34 - .../BertTextClassification/mxBase/build.sh | 54 - .../mxBase/data/vocab.txt | 21128 ---------------- .../BertTextClassification/mxBase/main.cpp | 94 - .../bert_text_classification_labels.names | 5 - .../mxBase/out/prediction_label.txt | 0 .../mxBase/test/Test.cpp | 151 - .../BertTextClassification/mxBase/test/Test.h | 19 - 10 files changed, 21815 deletions(-) delete mode 100644 contrib/BertTextClassification/mxBase/BertClassification/BertClassification.cpp delete mode 100644 contrib/BertTextClassification/mxBase/BertClassification/BertClassification.h delete mode 100644 contrib/BertTextClassification/mxBase/CMakeLists.txt delete mode 100644 contrib/BertTextClassification/mxBase/build.sh delete mode 100644 contrib/BertTextClassification/mxBase/data/vocab.txt delete mode 100644 contrib/BertTextClassification/mxBase/main.cpp delete mode 100644 contrib/BertTextClassification/mxBase/model/bert_text_classification_labels.names delete mode 100644 contrib/BertTextClassification/mxBase/out/prediction_label.txt delete mode 100644 contrib/BertTextClassification/mxBase/test/Test.cpp delete mode 100644 contrib/BertTextClassification/mxBase/test/Test.h diff --git a/contrib/BertTextClassification/mxBase/BertClassification/BertClassification.cpp b/contrib/BertTextClassification/mxBase/BertClassification/BertClassification.cpp deleted file mode 100644 index 2e4671c6c..000000000 --- a/contrib/BertTextClassification/mxBase/BertClassification/BertClassification.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "BertClassification.h" -#include "MxBase/DeviceManager/DeviceManager.h" -#include -#include - -namespace { - const float TEXT_START_CODE = 101.0; - const float TEXT_END_CODE = 102.0; - const float TEXT_NOT_FOUND_CODE = 100.0; - const int FLOAT32_BYTES = 4; -} - -// Initialize the dictionary of character encoding. -APP_ERROR BertClassification::InitTokenMap(const std::string &vocabTextPath, std::map &tokenMap) { - const std::string text; - std::ifstream infile; - // Open label file. - infile.open(vocabTextPath, std::ios_base::in); - if(!infile.is_open ()) { - std::cout << "Open " << vocabTextPath << " file failure!" << std::endl; - return APP_ERR_COMM_OPEN_FAIL; - } - - std::string s; - int count = 0; - while (std::getline(infile, s)) { - tokenMap.insert(std::pair(s, count)); - count++; - } - infile.close(); - return APP_ERR_OK; -} - -// Load the label file. -APP_ERROR BertClassification::LoadLabels(const std::string &labelPath, std::map &labelMap) { - std::ifstream infile; - // Open label file. - infile.open(labelPath, std::ios_base::in); - std::string s; - // Check label file validity. - if (infile.fail()) { - LogError << "Failed to open label file: " << labelPath << "."; - return APP_ERR_COMM_OPEN_FAIL; - } - labelMap.clear(); - // Construct label map. - int count = 0; - while (std::getline(infile, s)) { - size_t eraseIndex = s.find_last_not_of("\r\n\t"); - if (eraseIndex != std::string::npos) { - s.erase(eraseIndex + 1, s.size() - eraseIndex); - } - labelMap.insert(std::pair(count, s)); - count++; - } - infile.close(); - return APP_ERR_OK; -} - -APP_ERROR BertClassification::Init(const InitParam &initParam) { - deviceId_ = initParam.deviceId; - maxLength_ = initParam.maxLength; - labelNumber_ = initParam.labelNumber; - APP_ERROR ret = MxBase::DeviceManager::GetInstance()->InitDevices(); - if (ret != APP_ERR_OK) { - LogError << "Init devices failed, ret=" << ret << "."; - return ret; - } - ret = MxBase::TensorContext::GetInstance()->SetContext(initParam.deviceId); - if (ret != APP_ERR_OK) { - LogError << "Set context failed, ret=" << ret << "."; - return ret; - } - // Load TokenMap. - ret = InitTokenMap(initParam.vocabTextPath, tokenMap_); - if (ret != APP_ERR_OK) { - LogError << "Failed to load tokenMap, ret=" << ret << "."; - return ret; - } - model_ = std::make_shared(); - ret = model_->Init(initParam.modelPath, modelDesc_); - if (ret != APP_ERR_OK) { - LogError << "ModelInferenceProcessor init failed, ret=" << ret << "."; - return ret; - } - - // Load labels from file. - ret = LoadLabels(initParam.labelPath, labelMap_); - if (ret != APP_ERR_OK) { - LogError << "Failed to load labels, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR BertClassification::DeInit() { - model_->DeInit(); - MxBase::DeviceManager::GetInstance()->DestroyDevices(); - return APP_ERR_OK; -} - -std::vector split_chinese(std::string s) { - std::vector words; - for (size_t i = 0; i < s.length();) { - int cplen = 1; - // The following if-statements are referred to https://en.wikipedia.org/wiki/UTF-8#Description. - if ((s[i] & 0xf8) == 0xf0) - cplen = 4; - else if ((s[i] & 0xf0) == 0xe0) - cplen = 3; - else if ((s[i] & 0xe0) == 0xc0) - cplen = 2; - if ((i + cplen) > s.length()) - cplen = 1; - words.push_back(s.substr(i, cplen)); - i += cplen; - } - return words; -} - -APP_ERROR BertClassification::TextToTensor(const std::string &text, std::vector &inputs) { - MxBase::TensorBase tensor1, tensor2; - std::vector shape = {1, maxLength_}; - std::map::iterator iter; - uint32_t i, value, size, end_index; - std::vector words = split_chinese(text); - - float* tensor1Data = new float [maxLength_]; - // Init data. - for (i = 0;i < maxLength_; i++) { - tensor1Data[i] = 0.0; - } - - size = words.size(); - if (size > maxLength_) { - // Remove start and end characters, length is 2. - size = maxLength_ - 2; - end_index = maxLength_ - 1; - } else { - end_index = size - 1; - } - - tensor1Data[0] = TEXT_START_CODE; - // Text decode. - for (i = 0;i < size; i++) { - iter = tokenMap_.find(words[i]); - if (iter != tokenMap_.end()) { - value = iter->second; - tensor1Data[i+1] = float(value); - } else { - tensor1Data[i+1] = TEXT_NOT_FOUND_CODE; - } - } - tensor1Data[end_index] = TEXT_END_CODE; - - MxBase::MemoryData memoryData1((void*)tensor1Data, maxLength_ * FLOAT32_BYTES, - MxBase::MemoryData::MemoryType::MEMORY_HOST_NEW, deviceId_); - MxBase::MemoryData deviceData1(maxLength_ * FLOAT32_BYTES,MxBase::MemoryData::MEMORY_DEVICE, deviceId_); - // Move data from Host to Device. - APP_ERROR ret = MxBase::MemoryHelper::MxbsMallocAndCopy(deviceData1, memoryData1); - if (ret != APP_ERR_OK) { - LogError << "Failed to MxbsMallocAndCopy"; - return ret; - } - tensor1 = MxBase::TensorBase(deviceData1, false, shape, MxBase::TENSOR_DTYPE_FLOAT32); - inputs.push_back(tensor1); - - // Init second tensor. - float* tensor2Data = new float [maxLength_]; - for (i = 0;i < maxLength_; i++) { - tensor2Data[i] = 0.0; - } - MxBase::MemoryData memoryData2((void*)tensor2Data, maxLength_ * FLOAT32_BYTES, - MxBase::MemoryData::MemoryType::MEMORY_HOST_NEW, deviceId_); - MxBase::MemoryData deviceData2(maxLength_ * FLOAT32_BYTES,MxBase::MemoryData::MEMORY_DEVICE, deviceId_); - ret = MxBase::MemoryHelper::MxbsMallocAndCopy(deviceData2, memoryData2); - if (ret != APP_ERR_OK) { - LogError << "Failed to MxbsMallocAndCopy"; - return ret; - } - tensor2 = MxBase::TensorBase(deviceData2, false, shape, MxBase::TENSOR_DTYPE_FLOAT32); - inputs.push_back(tensor2); - // Release memory. - delete[] tensor1Data; - delete[] tensor2Data; - return APP_ERR_OK; -} - -APP_ERROR BertClassification::Inference(const std::vector &inputs, - std::vector &outputs) { - auto dtypes = model_->GetOutputDataType(); - std::vector shape = {1, labelNumber_}; - - MxBase::TensorBase tensor(shape, dtypes[0], MxBase::MemoryData::MemoryType::MEMORY_DEVICE, - deviceId_); - APP_ERROR ret = MxBase::TensorBase::TensorBaseMalloc(tensor); - if (ret != APP_ERR_OK) { - LogError << "TensorBaseMalloc failed, ret=" << ret << "."; - return ret; - } - // Put tensor into outputs. - outputs.push_back(tensor); - - MxBase::DynamicInfo dynamicInfo = {}; - // Set type STATIC_BATCH - dynamicInfo.dynamicType = MxBase::DynamicType::STATIC_BATCH; - ret = model_->ModelInference(inputs, outputs, dynamicInfo); - - if (ret != APP_ERR_OK) { - LogError << "ModelInference failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} - -APP_ERROR BertClassification::PostProcess(const std::vector &outputs, std::string &label) { - uint32_t i; - uint32_t maxIndex = 0; - float maxValue = 0; - MxBase::TensorBase outTensor = outputs[0]; - outTensor.ToHost(); - // Inference result is tensor(1*5). - float* inferResult = (float *)outTensor.GetBuffer(); - // Find the category with the highest probability. - for (i = 0;i < labelNumber_;i++) { - if (inferResult[i] > maxValue) { - maxValue = inferResult[i]; - maxIndex = i; - } - } - // Get label. - label = labelMap_.at(maxIndex); - return APP_ERR_OK; -} - -APP_ERROR BertClassification::WriteResult(std::string &label) { - std::ofstream ofs; - ofs.open("out/prediction_label.txt", std::ios::out); - ofs << label; - ofs.close(); - return APP_ERR_OK; -} - -APP_ERROR BertClassification::Process(const std::string &text, std::string &label) { - std::vector inputs = {}; - std::vector outputs = {}; - // Convert text to tensor. - APP_ERROR ret = TextToTensor(text, inputs); - if (ret != APP_ERR_OK) { - LogError << "ReadText failed, ret=" << ret << "."; - return ret; - } - - ret = Inference(inputs, outputs); - if (ret != APP_ERR_OK) { - LogError << "Inference failed, ret=" << ret << "."; - return ret; - } - - // Get classification results. - ret = PostProcess(outputs, label); - if (ret != APP_ERR_OK) { - LogError << "PostProcess failed, ret=" << ret << "."; - return ret; - } - - // Write results to file. - ret = WriteResult(label); - if (ret != APP_ERR_OK) { - LogError << "Save result failed, ret=" << ret << "."; - return ret; - } - return APP_ERR_OK; -} diff --git a/contrib/BertTextClassification/mxBase/BertClassification/BertClassification.h b/contrib/BertTextClassification/mxBase/BertClassification/BertClassification.h deleted file mode 100644 index e1fa8df71..000000000 --- a/contrib/BertTextClassification/mxBase/BertClassification/BertClassification.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef MXBASE_TEXT_CLASSIFICATION_BERTCLASSIFICATION_H -#define MXBASE_TEXT_CLASSIFICATION_BERTCLASSIFICATION_H - -#include "MxBase/ModelInfer/ModelInferenceProcessor.h" -#include "MxBase/Tensor/TensorContext/TensorContext.h" - -struct InitParam { - uint32_t deviceId; - std::string labelPath; - std::string modelPath; - std::string vocabTextPath; - uint32_t maxLength; - uint32_t labelNumber; -}; - -class BertClassification { -public: - APP_ERROR InitTokenMap(const std::string &vocabTextPath, std::map &tokenMap); - APP_ERROR LoadLabels(const std::string &labelPath, std::map &labelMap); - APP_ERROR Init(const InitParam &initParam); - APP_ERROR DeInit(); - APP_ERROR Inference(const std::vector &inputs, std::vector &outputs); - APP_ERROR PostProcess(const std::vector &outputs, std::string &label); - APP_ERROR Process(const std::string &textPath, std::string &label); - APP_ERROR TextToTensor(const std::string &text, std::vector &inputs); - APP_ERROR WriteResult(std::string &label); -private: - std::shared_ptr model_; - MxBase::ModelDesc modelDesc_ = {}; - std::map labelMap_ = {}; - std::map tokenMap_ = {}; - uint32_t deviceId_ = 0; - // Maximum length of input sentence. - uint32_t maxLength_ = 300; - // Number of tags for inference results. - uint32_t labelNumber_ = 5; -}; - - -#endif // MXBASE_TEXT_CLASSIFICATION_BERTCLASSIFICATION_H diff --git a/contrib/BertTextClassification/mxBase/CMakeLists.txt b/contrib/BertTextClassification/mxBase/CMakeLists.txt deleted file mode 100644 index 327619a1f..000000000 --- a/contrib/BertTextClassification/mxBase/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(mxBase_text_classification) - -set(CMAKE_CXX_STANDARD 14) -include_directories(./BertClassification) -file(GLOB_RECURSE BertClassification ${PROJECT_SOURCE_DIR}/BertClassification/*cpp) -include_directories(./test) -file(GLOB_RECURSE Test ${PROJECT_SOURCE_DIR}/test/*cpp) -set(TARGET mxBase_text_classification) -add_compile_options(-std=c++11 -fPIE -fstack-protector-all -fPIC -Wl,-z,relro,-z,now,-z,noexecstack -s -pie -Wall) -add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=mindxsdk_private) - -set(MX_SDK_HOME ${SDK目录}) -include_directories( - ${MX_SDK_HOME}/include - ${MX_SDK_HOME}/opensource/include - ${MX_SDK_HOME}/opensource/include/opencv4 -) - -link_directories( - ${MX_SDK_HOME}/lib - ${MX_SDK_HOME}/opensource/lib - ${MX_SDK_HOME}/lib/modelpostprocessors - /usr/local/Ascend/ascend-toolkit/latest/acllib/lib64 - /usr/local/Ascend/driver/lib64/ -) - -add_executable(mxBase_text_classification main.cpp ${BertClassification} ${Test}) - -target_link_libraries(mxBase_text_classification - glog - mxbase - opencv_world - ) \ No newline at end of file diff --git a/contrib/BertTextClassification/mxBase/build.sh b/contrib/BertTextClassification/mxBase/build.sh deleted file mode 100644 index 1fc7c0e4e..000000000 --- a/contrib/BertTextClassification/mxBase/build.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -# Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -path_cur="$(dirname "$0")" - -function check_env() -{ - # set ASCEND_VERSION to ascend-toolkit/latest when it was not specified by user - if [ ! "${ASCEND_VERSION}" ]; then - export ASCEND_VERSION=ascend-toolkit/latest - echo "Set ASCEND_VERSION to the default value: ${ASCEND_VERSION}" - else - echo "ASCEND_VERSION is set to ${ASCEND_VERSION} by user" - fi - - if [ ! "${ARCH_PATTERN}" ]; then - # set ARCH_PATTERN to ./ when it was not specified by user - export ARCH_PATTERN=./ - echo "ARCH_PATTERN is set to the default value: ${ARCH_PATTERN}" - else - echo "ARCH_PATTERN is set to ${ARCH_PATTERN} by user" - fi -} - -function build_bert_text_classification() -{ - cd "$path_cur" || exit - rm -rf build - mkdir -p build - cd build || exit - cmake .. - make - ret=$? - if [ ${ret} -ne 0 ]; then - echo "Failed to build mxBase_text_classification." - exit ${ret} - fi -} - -check_env -build_bert_text_classification \ No newline at end of file diff --git a/contrib/BertTextClassification/mxBase/data/vocab.txt b/contrib/BertTextClassification/mxBase/data/vocab.txt deleted file mode 100644 index ca4f97810..000000000 --- a/contrib/BertTextClassification/mxBase/data/vocab.txt +++ /dev/null @@ -1,21128 +0,0 @@ -[PAD] -[unused1] -[unused2] -[unused3] -[unused4] -[unused5] -[unused6] -[unused7] -[unused8] -[unused9] -[unused10] -[unused11] -[unused12] -[unused13] -[unused14] -[unused15] -[unused16] -[unused17] -[unused18] -[unused19] -[unused20] -[unused21] -[unused22] -[unused23] -[unused24] -[unused25] -[unused26] -[unused27] -[unused28] -[unused29] -[unused30] -[unused31] -[unused32] -[unused33] -[unused34] -[unused35] -[unused36] -[unused37] -[unused38] -[unused39] -[unused40] -[unused41] -[unused42] -[unused43] -[unused44] -[unused45] -[unused46] -[unused47] -[unused48] -[unused49] -[unused50] -[unused51] -[unused52] -[unused53] -[unused54] -[unused55] -[unused56] -[unused57] -[unused58] -[unused59] -[unused60] -[unused61] -[unused62] -[unused63] -[unused64] -[unused65] -[unused66] -[unused67] -[unused68] -[unused69] -[unused70] -[unused71] -[unused72] -[unused73] -[unused74] -[unused75] -[unused76] -[unused77] -[unused78] -[unused79] -[unused80] -[unused81] -[unused82] -[unused83] -[unused84] -[unused85] -[unused86] -[unused87] -[unused88] -[unused89] -[unused90] -[unused91] -[unused92] -[unused93] -[unused94] -[unused95] -[unused96] -[unused97] -[unused98] -[unused99] -[UNK] -[CLS] -[SEP] -[MASK] - - -! -" -# -$ -% -& -' -( -) -* -+ -, -- -. -/ -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -: -; -< -= -> -? -@ -[ -\ -] -^ -_ -a -b -c -d -e -f -g -h -i -j -k -l -m -n -o -p -q -r -s -t -u -v -w -x -y -z -{ -| -} -~ -£ -¤ -¥ -§ -© -« -® -° -± -² -³ -µ -· -¹ -º -» -¼ -× -ß -æ -÷ -ø -đ -ŋ -ɔ -ə -ɡ -ʰ -ˇ -ˈ -ˊ -ˋ -ˍ -ː -˙ -˚ -ˢ -α -β -γ -δ -ε -η -θ -ι -κ -λ -μ -ν -ο -π -ρ -ς -σ -τ -υ -φ -χ -ψ -ω -а -б -в -г -д -е -ж -з -и -к -л -м -н -о -п -р -с -т -у -ф -х -ц -ч -ш -ы -ь -я -і -ا -ب -ة -ت -د -ر -س -ع -ل -م -ن -ه -و -ي -۩ -ก -ง -น -ม -ย -ร -อ -า -เ -๑ -་ -ღ -ᄀ -ᄁ -ᄂ -ᄃ -ᄅ -ᄆ -ᄇ -ᄈ -ᄉ -ᄋ -ᄌ -ᄎ -ᄏ -ᄐ -ᄑ -ᄒ -ᅡ -ᅢ -ᅣ -ᅥ -ᅦ -ᅧ -ᅨ -ᅩ -ᅪ -ᅬ -ᅭ -ᅮ -ᅯ -ᅲ -ᅳ -ᅴ -ᅵ -ᆨ -ᆫ -ᆯ -ᆷ -ᆸ -ᆺ -ᆻ -ᆼ -ᗜ -ᵃ -ᵉ -ᵍ -ᵏ -ᵐ -ᵒ -ᵘ -‖ -„ -† -• -‥ -‧ -
 -‰ -′ -″ -‹ -› -※ -‿ -⁄ -ⁱ -⁺ -ⁿ -₁ -₂ -₃ -₄ -€ -℃ -№ -™ -ⅰ -ⅱ -ⅲ -ⅳ -ⅴ -← -↑ -→ -↓ -↔ -↗ -↘ -⇒ -∀ -− -∕ -∙ -√ -∞ -∟ -∠ -∣ -∥ -∩ -∮ -∶ -∼ -∽ -≈ -≒ -≡ -≤ -≥ -≦ -≧ -≪ -≫ -⊙ -⋅ -⋈ -⋯ -⌒ -① -② -③ -④ -⑤ -⑥ -⑦ -⑧ -⑨ -⑩ -⑴ -⑵ -⑶ -⑷ -⑸ -⒈ -⒉ -⒊ -⒋ -ⓒ -ⓔ -ⓘ -─ -━ -│ -┃ -┅ -┆ -┊ -┌ -└ -├ -┣ -═ -║ -╚ -╞ -╠ -╭ -╮ -╯ -╰ -╱ -╳ -▂ -▃ -▅ -▇ -█ -▉ -▋ -▌ -▍ -▎ -■ -□ -▪ -▫ -▬ -▲ -△ -▶ -► -▼ -▽ -◆ -◇ -○ -◎ -● -◕ -◠ -◢ -◤ -☀ -★ -☆ -☕ -☞ -☺ -☼ -♀ -♂ -♠ -♡ -♣ -♥ -♦ -♪ -♫ -♬ -✈ -✔ -✕ -✖ -✦ -✨ -✪ -✰ -✿ -❀ -❤ -➜ -➤ -⦿ -、 -。 -〃 -々 -〇 -〈 -〉 -《 -》 -「 -」 -『 -』 -【 -】 -〓 -〔 -〕 -〖 -〗 -〜 -〝 -〞 -ぁ -あ -ぃ -い -う -ぇ -え -お -か -き -く -け -こ -さ -し -す -せ -そ -た -ち -っ -つ -て -と -な -に -ぬ -ね -の -は -ひ -ふ -へ -ほ -ま -み -む -め -も -ゃ -や -ゅ -ゆ -ょ -よ -ら -り -る -れ -ろ -わ -を -ん -゜ -ゝ -ァ -ア -ィ -イ -ゥ -ウ -ェ -エ -ォ -オ -カ -キ -ク -ケ -コ -サ -シ -ス -セ -ソ -タ -チ -ッ -ツ -テ -ト -ナ -ニ -ヌ -ネ -ノ -ハ -ヒ -フ -ヘ -ホ -マ -ミ -ム -メ -モ -ャ -ヤ -ュ -ユ -ョ -ヨ -ラ -リ -ル -レ -ロ -ワ -ヲ -ン -ヶ -・ -ー -ヽ -ㄅ -ㄆ -ㄇ -ㄉ -ㄋ -ㄌ -ㄍ -ㄎ -ㄏ -ㄒ -ㄚ -ㄛ -ㄞ -ㄟ -ㄢ -ㄤ -ㄥ -ㄧ -ㄨ -ㆍ -㈦ -㊣ -㎡ -㗎 -一 -丁 -七 -万 -丈 -三 -上 -下 -不 -与 -丐 -丑 -专 -且 -丕 -世 -丘 -丙 -业 -丛 -东 -丝 -丞 -丟 -両 -丢 -两 -严 -並 -丧 -丨 -个 -丫 -中 -丰 -串 -临 -丶 -丸 -丹 -为 -主 -丼 -丽 -举 -丿 -乂 -乃 -久 -么 -义 -之 -乌 -乍 -乎 -乏 -乐 -乒 -乓 -乔 -乖 -乗 -乘 -乙 -乜 -九 -乞 -也 -习 -乡 -书 -乩 -买 -乱 -乳 -乾 -亀 -亂 -了 -予 -争 -事 -二 -于 -亏 -云 -互 -五 -井 -亘 -亙 -亚 -些 -亜 -亞 -亟 -亡 -亢 -交 -亥 -亦 -产 -亨 -亩 -享 -京 -亭 -亮 -亲 -亳 -亵 -人 -亿 -什 -仁 -仃 -仄 -仅 -仆 -仇 -今 -介 -仍 -从 -仏 -仑 -仓 -仔 -仕 -他 -仗 -付 -仙 -仝 -仞 -仟 -代 -令 -以 -仨 -仪 -们 -仮 -仰 -仲 -件 -价 -任 -份 -仿 -企 -伉 -伊 -伍 -伎 -伏 -伐 -休 -伕 -众 -优 -伙 -会 -伝 -伞 -伟 -传 -伢 -伤 -伦 -伪 -伫 -伯 -估 -伴 -伶 -伸 -伺 -似 -伽 -佃 -但 -佇 -佈 -位 -低 -住 -佐 -佑 -体 -佔 -何 -佗 -佘 -余 -佚 -佛 -作 -佝 -佞 -佟 -你 -佢 -佣 -佤 -佥 -佩 -佬 -佯 -佰 -佳 -併 -佶 -佻 -佼 -使 -侃 -侄 -來 -侈 -例 -侍 -侏 -侑 -侖 -侗 -供 -依 -侠 -価 -侣 -侥 -侦 -侧 -侨 -侬 -侮 -侯 -侵 -侶 -侷 -便 -係 -促 -俄 -俊 -俎 -俏 -俐 -俑 -俗 -俘 -俚 -保 -俞 -俟 -俠 -信 -俨 -俩 -俪 -俬 -俭 -修 -俯 -俱 -俳 -俸 -俺 -俾 -倆 -倉 -個 -倌 -倍 -倏 -們 -倒 -倔 -倖 -倘 -候 -倚 -倜 -借 -倡 -値 -倦 -倩 -倪 -倫 -倬 -倭 -倶 -债 -值 -倾 -偃 -假 -偈 -偉 -偌 -偎 -偏 -偕 -做 -停 -健 -側 -偵 -偶 -偷 -偻 -偽 -偿 -傀 -傅 -傍 -傑 -傘 -備 -傚 -傢 -傣 -傥 -储 -傩 -催 -傭 -傲 -傳 -債 -傷 -傻 -傾 -僅 -働 -像 -僑 -僕 -僖 -僚 -僥 -僧 -僭 -僮 -僱 -僵 -價 -僻 -儀 -儂 -億 -儆 -儉 -儋 -儒 -儕 -儘 -償 -儡 -優 -儲 -儷 -儼 -儿 -兀 -允 -元 -兄 -充 -兆 -兇 -先 -光 -克 -兌 -免 -児 -兑 -兒 -兔 -兖 -党 -兜 -兢 -入 -內 -全 -兩 -八 -公 -六 -兮 -兰 -共 -兲 -关 -兴 -兵 -其 -具 -典 -兹 -养 -兼 -兽 -冀 -内 -円 -冇 -冈 -冉 -冊 -册 -再 -冏 -冒 -冕 -冗 -写 -军 -农 -冠 -冢 -冤 -冥 -冨 -冪 -冬 -冯 -冰 -冲 -决 -况 -冶 -冷 -冻 -冼 -冽 -冾 -净 -凄 -准 -凇 -凈 -凉 -凋 -凌 -凍 -减 -凑 -凛 -凜 -凝 -几 -凡 -凤 -処 -凪 -凭 -凯 -凰 -凱 -凳 -凶 -凸 -凹 -出 -击 -函 -凿 -刀 -刁 -刃 -分 -切 -刈 -刊 -刍 -刎 -刑 -划 -列 -刘 -则 -刚 -创 -初 -删 -判 -別 -刨 -利 -刪 -别 -刮 -到 -制 -刷 -券 -刹 -刺 -刻 -刽 -剁 -剂 -剃 -則 -剉 -削 -剋 -剌 -前 -剎 -剐 -剑 -剔 -剖 -剛 -剜 -剝 -剣 -剤 -剥 -剧 -剩 -剪 -副 -割 -創 -剷 -剽 -剿 -劃 -劇 -劈 -劉 -劊 -劍 -劏 -劑 -力 -劝 -办 -功 -加 -务 -劣 -动 -助 -努 -劫 -劭 -励 -劲 -劳 -労 -劵 -効 -劾 -势 -勁 -勃 -勇 -勉 -勋 -勐 -勒 -動 -勖 -勘 -務 -勛 -勝 -勞 -募 -勢 -勤 -勧 -勳 -勵 -勸 -勺 -勻 -勾 -勿 -匀 -包 -匆 -匈 -匍 -匐 -匕 -化 -北 -匙 -匝 -匠 -匡 -匣 -匪 -匮 -匯 -匱 -匹 -区 -医 -匾 -匿 -區 -十 -千 -卅 -升 -午 -卉 -半 -卍 -华 -协 -卑 -卒 -卓 -協 -单 -卖 -南 -単 -博 -卜 -卞 -卟 -占 -卡 -卢 -卤 -卦 -卧 -卫 -卮 -卯 -印 -危 -即 -却 -卵 -卷 -卸 -卻 -卿 -厂 -厄 -厅 -历 -厉 -压 -厌 -厕 -厘 -厚 -厝 -原 -厢 -厥 -厦 -厨 -厩 -厭 -厮 -厲 -厳 -去 -县 -叁 -参 -參 -又 -叉 -及 -友 -双 -反 -収 -发 -叔 -取 -受 -变 -叙 -叛 -叟 -叠 -叡 -叢 -口 -古 -句 -另 -叨 -叩 -只 -叫 -召 -叭 -叮 -可 -台 -叱 -史 -右 -叵 -叶 -号 -司 -叹 -叻 -叼 -叽 -吁 -吃 -各 -吆 -合 -吉 -吊 -吋 -同 -名 -后 -吏 -吐 -向 -吒 -吓 -吕 -吖 -吗 -君 -吝 -吞 -吟 -吠 -吡 -否 -吧 -吨 -吩 -含 -听 -吭 -吮 -启 -吱 -吳 -吴 -吵 -吶 -吸 -吹 -吻 -吼 -吽 -吾 -呀 -呂 -呃 -呆 -呈 -告 -呋 -呎 -呐 -呓 -呕 -呗 -员 -呛 -呜 -呢 -呤 -呦 -周 -呱 -呲 -味 -呵 -呷 -呸 -呻 -呼 -命 -咀 -咁 -咂 -咄 -咆 -咋 -和 -咎 -咏 -咐 -咒 -咔 -咕 -咖 -咗 -咘 -咙 -咚 -咛 -咣 -咤 -咦 -咧 -咨 -咩 -咪 -咫 -咬 -咭 -咯 -咱 -咲 -咳 -咸 -咻 -咽 -咿 -哀 -品 -哂 -哄 -哆 -哇 -哈 -哉 -哋 -哌 -响 -哎 -哏 -哐 -哑 -哒 -哔 -哗 -哟 -員 -哥 -哦 -哧 -哨 -哩 -哪 -哭 -哮 -哲 -哺 -哼 -哽 -唁 -唄 -唆 -唇 -唉 -唏 -唐 -唑 -唔 -唠 -唤 -唧 -唬 -售 -唯 -唰 -唱 -唳 -唷 -唸 -唾 -啃 -啄 -商 -啉 -啊 -問 -啓 -啕 -啖 -啜 -啞 -啟 -啡 -啤 -啥 -啦 -啧 -啪 -啫 -啬 -啮 -啰 -啱 -啲 -啵 -啶 -啷 -啸 -啻 -啼 -啾 -喀 -喂 -喃 -善 -喆 -喇 -喉 -喊 -喋 -喎 -喏 -喔 -喘 -喙 -喚 -喜 -喝 -喟 -喧 -喪 -喫 -喬 -單 -喰 -喱 -喲 -喳 -喵 -営 -喷 -喹 -喺 -喻 -喽 -嗅 -嗆 -嗇 -嗎 -嗑 -嗒 -嗓 -嗔 -嗖 -嗚 -嗜 -嗝 -嗟 -嗡 -嗣 -嗤 -嗦 -嗨 -嗪 -嗬 -嗯 -嗰 -嗲 -嗳 -嗶 -嗷 -嗽 -嘀 -嘅 -嘆 -嘈 -嘉 -嘌 -嘍 -嘎 -嘔 -嘖 -嘗 -嘘 -嘚 -嘛 -嘜 -嘞 -嘟 -嘢 -嘣 -嘤 -嘧 -嘩 -嘭 -嘮 -嘯 -嘰 -嘱 -嘲 -嘴 -嘶 -嘸 -嘹 -嘻 -嘿 -噁 -噌 -噎 -噓 -噔 -噗 -噙 -噜 -噠 -噢 -噤 -器 -噩 -噪 -噬 -噱 -噴 -噶 -噸 -噹 -噻 -噼 -嚀 -嚇 -嚎 -嚏 -嚐 -嚓 -嚕 -嚟 -嚣 -嚥 -嚨 -嚮 -嚴 -嚷 -嚼 -囂 -囉 -囊 -囍 -囑 -囔 -囗 -囚 -四 -囝 -回 -囟 -因 -囡 -团 -団 -囤 -囧 -囪 -囫 -园 -困 -囱 -囲 -図 -围 -囹 -固 -国 -图 -囿 -圃 -圄 -圆 -圈 -國 -圍 -圏 -園 -圓 -圖 -團 -圜 -土 -圣 -圧 -在 -圩 -圭 -地 -圳 -场 -圻 -圾 -址 -坂 -均 -坊 -坍 -坎 -坏 -坐 -坑 -块 -坚 -坛 -坝 -坞 -坟 -坠 -坡 -坤 -坦 -坨 -坪 -坯 -坳 -坵 -坷 -垂 -垃 -垄 -型 -垒 -垚 -垛 -垠 -垢 -垣 -垦 -垩 -垫 -垭 -垮 -垵 -埂 -埃 -埋 -城 -埔 -埕 -埗 -域 -埠 -埤 -埵 -執 -埸 -培 -基 -埼 -堀 -堂 -堃 -堅 -堆 -堇 -堑 -堕 -堙 -堡 -堤 -堪 -堯 -堰 -報 -場 -堵 -堺 -堿 -塊 -塌 -塑 -塔 -塗 -塘 -塚 -塞 -塢 -塩 -填 -塬 -塭 -塵 -塾 -墀 -境 -墅 -墉 -墊 -墒 -墓 -増 -墘 -墙 -墜 -增 -墟 -墨 -墩 -墮 -墳 -墻 -墾 -壁 -壅 -壆 -壇 -壊 -壑 -壓 -壕 -壘 -壞 -壟 -壢 -壤 -壩 -士 -壬 -壮 -壯 -声 -売 -壳 -壶 -壹 -壺 -壽 -处 -备 -変 -复 -夏 -夔 -夕 -外 -夙 -多 -夜 -够 -夠 -夢 -夥 -大 -天 -太 -夫 -夭 -央 -夯 -失 -头 -夷 -夸 -夹 -夺 -夾 -奂 -奄 -奇 -奈 -奉 -奋 -奎 -奏 -奐 -契 -奔 -奕 -奖 -套 -奘 -奚 -奠 -奢 -奥 -奧 -奪 -奬 -奮 -女 -奴 -奶 -奸 -她 -好 -如 -妃 -妄 -妆 -妇 -妈 -妊 -妍 -妒 -妓 -妖 -妘 -妙 -妝 -妞 -妣 -妤 -妥 -妨 -妩 -妪 -妮 -妲 -妳 -妹 -妻 -妾 -姆 -姉 -姊 -始 -姍 -姐 -姑 -姒 -姓 -委 -姗 -姚 -姜 -姝 -姣 -姥 -姦 -姨 -姪 -姫 -姬 -姹 -姻 -姿 -威 -娃 -娄 -娅 -娆 -娇 -娉 -娑 -娓 -娘 -娛 -娜 -娟 -娠 -娣 -娥 -娩 -娱 -娲 -娴 -娶 -娼 -婀 -婁 -婆 -婉 -婊 -婕 -婚 -婢 -婦 -婧 -婪 -婭 -婴 -婵 -婶 -婷 -婺 -婿 -媒 -媚 -媛 -媞 -媧 -媲 -媳 -媽 -媾 -嫁 -嫂 -嫉 -嫌 -嫑 -嫔 -嫖 -嫘 -嫚 -嫡 -嫣 -嫦 -嫩 -嫲 -嫵 -嫻 -嬅 -嬉 -嬌 -嬗 -嬛 -嬢 -嬤 -嬪 -嬰 -嬴 -嬷 -嬸 -嬿 -孀 -孃 -子 -孑 -孔 -孕 -孖 -字 -存 -孙 -孚 -孛 -孜 -孝 -孟 -孢 -季 -孤 -学 -孩 -孪 -孫 -孬 -孰 -孱 -孳 -孵 -學 -孺 -孽 -孿 -宁 -它 -宅 -宇 -守 -安 -宋 -完 -宏 -宓 -宕 -宗 -官 -宙 -定 -宛 -宜 -宝 -实 -実 -宠 -审 -客 -宣 -室 -宥 -宦 -宪 -宫 -宮 -宰 -害 -宴 -宵 -家 -宸 -容 -宽 -宾 -宿 -寂 -寄 -寅 -密 -寇 -富 -寐 -寒 -寓 -寛 -寝 -寞 -察 -寡 -寢 -寥 -實 -寧 -寨 -審 -寫 -寬 -寮 -寰 -寵 -寶 -寸 -对 -寺 -寻 -导 -対 -寿 -封 -専 -射 -将 -將 -專 -尉 -尊 -尋 -對 -導 -小 -少 -尔 -尕 -尖 -尘 -尚 -尝 -尤 -尧 -尬 -就 -尴 -尷 -尸 -尹 -尺 -尻 -尼 -尽 -尾 -尿 -局 -屁 -层 -屄 -居 -屆 -屈 -屉 -届 -屋 -屌 -屍 -屎 -屏 -屐 -屑 -展 -屜 -属 -屠 -屡 -屢 -層 -履 -屬 -屯 -山 -屹 -屿 -岀 -岁 -岂 -岌 -岐 -岑 -岔 -岖 -岗 -岘 -岙 -岚 -岛 -岡 -岩 -岫 -岬 -岭 -岱 -岳 -岷 -岸 -峇 -峋 -峒 -峙 -峡 -峤 -峥 -峦 -峨 -峪 -峭 -峯 -峰 -峴 -島 -峻 -峽 -崁 -崂 -崆 -崇 -崎 -崑 -崔 -崖 -崗 -崙 -崛 -崧 -崩 -崭 -崴 -崽 -嵇 -嵊 -嵋 -嵌 -嵐 -嵘 -嵩 -嵬 -嵯 -嶂 -嶄 -嶇 -嶋 -嶙 -嶺 -嶼 -嶽 -巅 -巍 -巒 -巔 -巖 -川 -州 -巡 -巢 -工 -左 -巧 -巨 -巩 -巫 -差 -己 -已 -巳 -巴 -巷 -巻 -巽 -巾 -巿 -币 -市 -布 -帅 -帆 -师 -希 -帐 -帑 -帕 -帖 -帘 -帚 -帛 -帜 -帝 -帥 -带 -帧 -師 -席 -帮 -帯 -帰 -帳 -帶 -帷 -常 -帼 -帽 -幀 -幂 -幄 -幅 -幌 -幔 -幕 -幟 -幡 -幢 -幣 -幫 -干 -平 -年 -并 -幸 -幹 -幺 -幻 -幼 -幽 -幾 -广 -庁 -広 -庄 -庆 -庇 -床 -序 -庐 -库 -应 -底 -庖 -店 -庙 -庚 -府 -庞 -废 -庠 -度 -座 -庫 -庭 -庵 -庶 -康 -庸 -庹 -庾 -廁 -廂 -廃 -廈 -廉 -廊 -廓 -廖 -廚 -廝 -廟 -廠 -廢 -廣 -廬 -廳 -延 -廷 -建 -廿 -开 -弁 -异 -弃 -弄 -弈 -弊 -弋 -式 -弑 -弒 -弓 -弔 -引 -弗 -弘 -弛 -弟 -张 -弥 -弦 -弧 -弩 -弭 -弯 -弱 -張 -強 -弹 -强 -弼 -弾 -彅 -彆 -彈 -彌 -彎 -归 -当 -录 -彗 -彙 -彝 -形 -彤 -彥 -彦 -彧 -彩 -彪 -彫 -彬 -彭 -彰 -影 -彷 -役 -彻 -彼 -彿 -往 -征 -径 -待 -徇 -很 -徉 -徊 -律 -後 -徐 -徑 -徒 -従 -徕 -得 -徘 -徙 -徜 -從 -徠 -御 -徨 -復 -循 -徬 -微 -徳 -徴 -徵 -德 -徹 -徼 -徽 -心 -必 -忆 -忌 -忍 -忏 -忐 -忑 -忒 -忖 -志 -忘 -忙 -応 -忠 -忡 -忤 -忧 -忪 -快 -忱 -念 -忻 -忽 -忿 -怀 -态 -怂 -怅 -怆 -怎 -怏 -怒 -怔 -怕 -怖 -怙 -怜 -思 -怠 -怡 -急 -怦 -性 -怨 -怪 -怯 -怵 -总 -怼 -恁 -恃 -恆 -恋 -恍 -恐 -恒 -恕 -恙 -恚 -恢 -恣 -恤 -恥 -恨 -恩 -恪 -恫 -恬 -恭 -息 -恰 -恳 -恵 -恶 -恸 -恺 -恻 -恼 -恿 -悄 -悅 -悉 -悌 -悍 -悔 -悖 -悚 -悟 -悠 -患 -悦 -您 -悩 -悪 -悬 -悯 -悱 -悲 -悴 -悵 -悶 -悸 -悻 -悼 -悽 -情 -惆 -惇 -惊 -惋 -惑 -惕 -惘 -惚 -惜 -惟 -惠 -惡 -惦 -惧 -惨 -惩 -惫 -惬 -惭 -惮 -惯 -惰 -惱 -想 -惴 -惶 -惹 -惺 -愁 -愆 -愈 -愉 -愍 -意 -愕 -愚 -愛 -愜 -感 -愣 -愤 -愧 -愫 -愷 -愿 -慄 -慈 -態 -慌 -慎 -慑 -慕 -慘 -慚 -慟 -慢 -慣 -慧 -慨 -慫 -慮 -慰 -慳 -慵 -慶 -慷 -慾 -憂 -憊 -憋 -憎 -憐 -憑 -憔 -憚 -憤 -憧 -憨 -憩 -憫 -憬 -憲 -憶 -憾 -懂 -懇 -懈 -應 -懊 -懋 -懑 -懒 -懦 -懲 -懵 -懶 -懷 -懸 -懺 -懼 -懾 -懿 -戀 -戈 -戊 -戌 -戍 -戎 -戏 -成 -我 -戒 -戕 -或 -战 -戚 -戛 -戟 -戡 -戦 -截 -戬 -戮 -戰 -戲 -戳 -戴 -戶 -户 -戸 -戻 -戾 -房 -所 -扁 -扇 -扈 -扉 -手 -才 -扎 -扑 -扒 -打 -扔 -払 -托 -扛 -扣 -扦 -执 -扩 -扪 -扫 -扬 -扭 -扮 -扯 -扰 -扱 -扳 -扶 -批 -扼 -找 -承 -技 -抄 -抉 -把 -抑 -抒 -抓 -投 -抖 -抗 -折 -抚 -抛 -抜 -択 -抟 -抠 -抡 -抢 -护 -报 -抨 -披 -抬 -抱 -抵 -抹 -押 -抽 -抿 -拂 -拄 -担 -拆 -拇 -拈 -拉 -拋 -拌 -拍 -拎 -拐 -拒 -拓 -拔 -拖 -拗 -拘 -拙 -拚 -招 -拜 -拟 -拡 -拢 -拣 -拥 -拦 -拧 -拨 -择 -括 -拭 -拮 -拯 -拱 -拳 -拴 -拷 -拼 -拽 -拾 -拿 -持 -挂 -指 -挈 -按 -挎 -挑 -挖 -挙 -挚 -挛 -挝 -挞 -挟 -挠 -挡 -挣 -挤 -挥 -挨 -挪 -挫 -振 -挲 -挹 -挺 -挽 -挾 -捂 -捅 -捆 -捉 -捋 -捌 -捍 -捎 -捏 -捐 -捕 -捞 -损 -捡 -换 -捣 -捧 -捨 -捩 -据 -捱 -捲 -捶 -捷 -捺 -捻 -掀 -掂 -掃 -掇 -授 -掉 -掌 -掏 -掐 -排 -掖 -掘 -掙 -掛 -掠 -採 -探 -掣 -接 -控 -推 -掩 -措 -掬 -掰 -掲 -掳 -掴 -掷 -掸 -掺 -揀 -揃 -揄 -揆 -揉 -揍 -描 -提 -插 -揖 -揚 -換 -握 -揣 -揩 -揪 -揭 -揮 -援 -揶 -揸 -揹 -揽 -搀 -搁 -搂 -搅 -損 -搏 -搐 -搓 -搔 -搖 -搗 -搜 -搞 -搡 -搪 -搬 -搭 -搵 -搶 -携 -搽 -摀 -摁 -摄 -摆 -摇 -摈 -摊 -摒 -摔 -摘 -摞 -摟 -摧 -摩 -摯 -摳 -摸 -摹 -摺 -摻 -撂 -撃 -撅 -撇 -撈 -撐 -撑 -撒 -撓 -撕 -撚 -撞 -撤 -撥 -撩 -撫 -撬 -播 -撮 -撰 -撲 -撵 -撷 -撸 -撻 -撼 -撿 -擀 -擁 -擂 -擄 -擅 -擇 -擊 -擋 -操 -擎 -擒 -擔 -擘 -據 -擞 -擠 -擡 -擢 -擦 -擬 -擰 -擱 -擲 -擴 -擷 -擺 -擼 -擾 -攀 -攏 -攒 -攔 -攘 -攙 -攜 -攝 -攞 -攢 -攣 -攤 -攥 -攪 -攫 -攬 -支 -收 -攸 -改 -攻 -放 -政 -故 -效 -敌 -敍 -敎 -敏 -救 -敕 -敖 -敗 -敘 -教 -敛 -敝 -敞 -敢 -散 -敦 -敬 -数 -敲 -整 -敵 -敷 -數 -斂 -斃 -文 -斋 -斌 -斎 -斐 -斑 -斓 -斗 -料 -斛 -斜 -斟 -斡 -斤 -斥 -斧 -斩 -斫 -斬 -断 -斯 -新 -斷 -方 -於 -施 -旁 -旃 -旅 -旋 -旌 -旎 -族 -旖 -旗 -无 -既 -日 -旦 -旧 -旨 -早 -旬 -旭 -旮 -旱 -时 -旷 -旺 -旻 -昀 -昂 -昆 -昇 -昉 -昊 -昌 -明 -昏 -易 -昔 -昕 -昙 -星 -映 -春 -昧 -昨 -昭 -是 -昱 -昴 -昵 -昶 -昼 -显 -晁 -時 -晃 -晉 -晋 -晌 -晏 -晒 -晓 -晔 -晕 -晖 -晗 -晚 -晝 -晞 -晟 -晤 -晦 -晨 -晩 -普 -景 -晰 -晴 -晶 -晷 -智 -晾 -暂 -暄 -暇 -暈 -暉 -暌 -暐 -暑 -暖 -暗 -暝 -暢 -暧 -暨 -暫 -暮 -暱 -暴 -暸 -暹 -曄 -曆 -曇 -曉 -曖 -曙 -曜 -曝 -曠 -曦 -曬 -曰 -曲 -曳 -更 -書 -曹 -曼 -曾 -替 -最 -會 -月 -有 -朋 -服 -朐 -朔 -朕 -朗 -望 -朝 -期 -朦 -朧 -木 -未 -末 -本 -札 -朮 -术 -朱 -朴 -朵 -机 -朽 -杀 -杂 -权 -杆 -杈 -杉 -李 -杏 -材 -村 -杓 -杖 -杜 -杞 -束 -杠 -条 -来 -杨 -杭 -杯 -杰 -東 -杳 -杵 -杷 -杼 -松 -板 -极 -构 -枇 -枉 -枋 -析 -枕 -林 -枚 -果 -枝 -枢 -枣 -枪 -枫 -枭 -枯 -枰 -枱 -枳 -架 -枷 -枸 -柄 -柏 -某 -柑 -柒 -染 -柔 -柘 -柚 -柜 -柞 -柠 -柢 -查 -柩 -柬 -柯 -柱 -柳 -柴 -柵 -査 -柿 -栀 -栃 -栄 -栅 -标 -栈 -栉 -栋 -栎 -栏 -树 -栓 -栖 -栗 -校 -栩 -株 -样 -核 -根 -格 -栽 -栾 -桀 -桁 -桂 -桃 -桅 -框 -案 -桉 -桌 -桎 -桐 -桑 -桓 -桔 -桜 -桠 -桡 -桢 -档 -桥 -桦 -桧 -桨 -桩 -桶 -桿 -梁 -梅 -梆 -梏 -梓 -梗 -條 -梟 -梢 -梦 -梧 -梨 -梭 -梯 -械 -梳 -梵 -梶 -检 -棂 -棄 -棉 -棋 -棍 -棒 -棕 -棗 -棘 -棚 -棟 -棠 -棣 -棧 -森 -棱 -棲 -棵 -棹 -棺 -椁 -椅 -椋 -植 -椎 -椒 -検 -椪 -椭 -椰 -椹 -椽 -椿 -楂 -楊 -楓 -楔 -楚 -楝 -楞 -楠 -楣 -楨 -楫 -業 -楮 -極 -楷 -楸 -楹 -楼 -楽 -概 -榄 -榆 -榈 -榉 -榔 -榕 -榖 -榛 -榜 -榨 -榫 -榭 -榮 -榱 -榴 -榷 -榻 -槁 -槃 -構 -槌 -槍 -槎 -槐 -槓 -様 -槛 -槟 -槤 -槭 -槲 -槳 -槻 -槽 -槿 -樁 -樂 -樊 -樑 -樓 -標 -樞 -樟 -模 -樣 -権 -横 -樫 -樯 -樱 -樵 -樸 -樹 -樺 -樽 -樾 -橄 -橇 -橋 -橐 -橘 -橙 -機 -橡 -橢 -橫 -橱 -橹 -橼 -檀 -檄 -檎 -檐 -檔 -檗 -檜 -檢 -檬 -檯 -檳 -檸 -檻 -櫃 -櫚 -櫛 -櫥 -櫸 -櫻 -欄 -權 -欒 -欖 -欠 -次 -欢 -欣 -欧 -欲 -欸 -欺 -欽 -款 -歆 -歇 -歉 -歌 -歎 -歐 -歓 -歙 -歛 -歡 -止 -正 -此 -步 -武 -歧 -歩 -歪 -歯 -歲 -歳 -歴 -歷 -歸 -歹 -死 -歼 -殁 -殃 -殆 -殇 -殉 -殊 -残 -殒 -殓 -殖 -殘 -殞 -殡 -殤 -殭 -殯 -殲 -殴 -段 -殷 -殺 -殼 -殿 -毀 -毁 -毂 -毅 -毆 -毋 -母 -毎 -每 -毒 -毓 -比 -毕 -毗 -毘 -毙 -毛 -毡 -毫 -毯 -毽 -氈 -氏 -氐 -民 -氓 -气 -氖 -気 -氙 -氛 -氟 -氡 -氢 -氣 -氤 -氦 -氧 -氨 -氪 -氫 -氮 -氯 -氰 -氲 -水 -氷 -永 -氹 -氾 -汀 -汁 -求 -汆 -汇 -汉 -汎 -汐 -汕 -汗 -汙 -汛 -汝 -汞 -江 -池 -污 -汤 -汨 -汩 -汪 -汰 -汲 -汴 -汶 -汹 -決 -汽 -汾 -沁 -沂 -沃 -沅 -沈 -沉 -沌 -沏 -沐 -沒 -沓 -沖 -沙 -沛 -沟 -没 -沢 -沣 -沥 -沦 -沧 -沪 -沫 -沭 -沮 -沱 -河 -沸 -油 -治 -沼 -沽 -沾 -沿 -況 -泄 -泉 -泊 -泌 -泓 -法 -泗 -泛 -泞 -泠 -泡 -波 -泣 -泥 -注 -泪 -泫 -泮 -泯 -泰 -泱 -泳 -泵 -泷 -泸 -泻 -泼 -泽 -泾 -洁 -洄 -洋 -洒 -洗 -洙 -洛 -洞 -津 -洩 -洪 -洮 -洱 -洲 -洵 -洶 -洸 -洹 -活 -洼 -洽 -派 -流 -浃 -浄 -浅 -浆 -浇 -浊 -测 -济 -浏 -浑 -浒 -浓 -浔 -浙 -浚 -浜 -浣 -浦 -浩 -浪 -浬 -浮 -浯 -浴 -海 -浸 -涂 -涅 -涇 -消 -涉 -涌 -涎 -涓 -涔 -涕 -涙 -涛 -涝 -涞 -涟 -涠 -涡 -涣 -涤 -润 -涧 -涨 -涩 -涪 -涮 -涯 -液 -涵 -涸 -涼 -涿 -淀 -淄 -淅 -淆 -淇 -淋 -淌 -淑 -淒 -淖 -淘 -淙 -淚 -淞 -淡 -淤 -淦 -淨 -淩 -淪 -淫 -淬 -淮 -深 -淳 -淵 -混 -淹 -淺 -添 -淼 -清 -済 -渉 -渊 -渋 -渍 -渎 -渐 -渔 -渗 -渙 -渚 -減 -渝 -渠 -渡 -渣 -渤 -渥 -渦 -温 -測 -渭 -港 -渲 -渴 -游 -渺 -渾 -湃 -湄 -湊 -湍 -湖 -湘 -湛 -湟 -湧 -湫 -湮 -湯 -湳 -湾 -湿 -満 -溃 -溅 -溉 -溏 -源 -準 -溜 -溝 -溟 -溢 -溥 -溧 -溪 -溫 -溯 -溱 -溴 -溶 -溺 -溼 -滁 -滂 -滄 -滅 -滇 -滋 -滌 -滑 -滓 -滔 -滕 -滙 -滚 -滝 -滞 -滟 -满 -滢 -滤 -滥 -滦 -滨 -滩 -滬 -滯 -滲 -滴 -滷 -滸 -滾 -滿 -漁 -漂 -漆 -漉 -漏 -漓 -演 -漕 -漠 -漢 -漣 -漩 -漪 -漫 -漬 -漯 -漱 -漲 -漳 -漸 -漾 -漿 -潆 -潇 -潋 -潍 -潑 -潔 -潘 -潛 -潜 -潞 -潟 -潢 -潤 -潦 -潧 -潭 -潮 -潰 -潴 -潸 -潺 -潼 -澀 -澄 -澆 -澈 -澍 -澎 -澗 -澜 -澡 -澤 -澧 -澱 -澳 -澹 -激 -濁 -濂 -濃 -濑 -濒 -濕 -濘 -濛 -濟 -濠 -濡 -濤 -濫 -濬 -濮 -濯 -濱 -濺 -濾 -瀅 -瀆 -瀉 -瀋 -瀏 -瀑 -瀕 -瀘 -瀚 -瀛 -瀝 -瀞 -瀟 -瀧 -瀨 -瀬 -瀰 -瀾 -灌 -灏 -灑 -灘 -灝 -灞 -灣 -火 -灬 -灭 -灯 -灰 -灵 -灶 -灸 -灼 -災 -灾 -灿 -炀 -炁 -炅 -炉 -炊 -炎 -炒 -炔 -炕 -炖 -炙 -炜 -炫 -炬 -炭 -炮 -炯 -炳 -炷 -炸 -点 -為 -炼 -炽 -烁 -烂 -烃 -烈 -烊 -烏 -烘 -烙 -烛 -烟 -烤 -烦 -烧 -烨 -烩 -烫 -烬 -热 -烯 -烷 -烹 -烽 -焉 -焊 -焕 -焖 -焗 -焘 -焙 -焚 -焜 -無 -焦 -焯 -焰 -焱 -然 -焼 -煅 -煉 -煊 -煌 -煎 -煒 -煖 -煙 -煜 -煞 -煤 -煥 -煦 -照 -煨 -煩 -煮 -煲 -煸 -煽 -熄 -熊 -熏 -熒 -熔 -熙 -熟 -熠 -熨 -熬 -熱 -熵 -熹 -熾 -燁 -燃 -燄 -燈 -燉 -燊 -燎 -燒 -燔 -燕 -燙 -燜 -營 -燥 -燦 -燧 -燭 -燮 -燴 -燻 -燼 -燿 -爆 -爍 -爐 -爛 -爪 -爬 -爭 -爰 -爱 -爲 -爵 -父 -爷 -爸 -爹 -爺 -爻 -爽 -爾 -牆 -片 -版 -牌 -牍 -牒 -牙 -牛 -牝 -牟 -牠 -牡 -牢 -牦 -牧 -物 -牯 -牲 -牴 -牵 -特 -牺 -牽 -犀 -犁 -犄 -犊 -犍 -犒 -犢 -犧 -犬 -犯 -状 -犷 -犸 -犹 -狀 -狂 -狄 -狈 -狎 -狐 -狒 -狗 -狙 -狞 -狠 -狡 -狩 -独 -狭 -狮 -狰 -狱 -狸 -狹 -狼 -狽 -猎 -猕 -猖 -猗 -猙 -猛 -猜 -猝 -猥 -猩 -猪 -猫 -猬 -献 -猴 -猶 -猷 -猾 -猿 -獄 -獅 -獎 -獐 -獒 -獗 -獠 -獣 -獨 -獭 -獰 -獲 -獵 -獷 -獸 -獺 -獻 -獼 -獾 -玄 -率 -玉 -王 -玑 -玖 -玛 -玟 -玠 -玥 -玩 -玫 -玮 -环 -现 -玲 -玳 -玷 -玺 -玻 -珀 -珂 -珅 -珈 -珉 -珊 -珍 -珏 -珐 -珑 -珙 -珞 -珠 -珣 -珥 -珩 -珪 -班 -珮 -珲 -珺 -現 -球 -琅 -理 -琇 -琉 -琊 -琍 -琏 -琐 -琛 -琢 -琥 -琦 -琨 -琪 -琬 -琮 -琰 -琲 -琳 -琴 -琵 -琶 -琺 -琼 -瑀 -瑁 -瑄 -瑋 -瑕 -瑗 -瑙 -瑚 -瑛 -瑜 -瑞 -瑟 -瑠 -瑣 -瑤 -瑩 -瑪 -瑯 -瑰 -瑶 -瑾 -璀 -璁 -璃 -璇 -璉 -璋 -璎 -璐 -璜 -璞 -璟 -璧 -璨 -環 -璽 -璿 -瓊 -瓏 -瓒 -瓜 -瓢 -瓣 -瓤 -瓦 -瓮 -瓯 -瓴 -瓶 -瓷 -甄 -甌 -甕 -甘 -甙 -甚 -甜 -生 -產 -産 -甥 -甦 -用 -甩 -甫 -甬 -甭 -甯 -田 -由 -甲 -申 -电 -男 -甸 -町 -画 -甾 -畀 -畅 -界 -畏 -畑 -畔 -留 -畜 -畝 -畢 -略 -畦 -番 -畫 -異 -畲 -畳 -畴 -當 -畸 -畹 -畿 -疆 -疇 -疊 -疏 -疑 -疔 -疖 -疗 -疙 -疚 -疝 -疟 -疡 -疣 -疤 -疥 -疫 -疮 -疯 -疱 -疲 -疳 -疵 -疸 -疹 -疼 -疽 -疾 -痂 -病 -症 -痈 -痉 -痊 -痍 -痒 -痔 -痕 -痘 -痙 -痛 -痞 -痠 -痢 -痣 -痤 -痧 -痨 -痪 -痫 -痰 -痱 -痴 -痹 -痺 -痼 -痿 -瘀 -瘁 -瘋 -瘍 -瘓 -瘘 -瘙 -瘟 -瘠 -瘡 -瘢 -瘤 -瘦 -瘧 -瘩 -瘪 -瘫 -瘴 -瘸 -瘾 -療 -癇 -癌 -癒 -癖 -癜 -癞 -癡 -癢 -癣 -癥 -癫 -癬 -癮 -癱 -癲 -癸 -発 -登 -發 -白 -百 -皂 -的 -皆 -皇 -皈 -皋 -皎 -皑 -皓 -皖 -皙 -皚 -皮 -皰 -皱 -皴 -皺 -皿 -盂 -盃 -盅 -盆 -盈 -益 -盎 -盏 -盐 -监 -盒 -盔 -盖 -盗 -盘 -盛 -盜 -盞 -盟 -盡 -監 -盤 -盥 -盧 -盪 -目 -盯 -盱 -盲 -直 -相 -盹 -盼 -盾 -省 -眈 -眉 -看 -県 -眙 -眞 -真 -眠 -眦 -眨 -眩 -眯 -眶 -眷 -眸 -眺 -眼 -眾 -着 -睁 -睇 -睏 -睐 -睑 -睛 -睜 -睞 -睡 -睢 -督 -睥 -睦 -睨 -睪 -睫 -睬 -睹 -睽 -睾 -睿 -瞄 -瞅 -瞇 -瞋 -瞌 -瞎 -瞑 -瞒 -瞓 -瞞 -瞟 -瞠 -瞥 -瞧 -瞩 -瞪 -瞬 -瞭 -瞰 -瞳 -瞻 -瞼 -瞿 -矇 -矍 -矗 -矚 -矛 -矜 -矢 -矣 -知 -矩 -矫 -短 -矮 -矯 -石 -矶 -矽 -矾 -矿 -码 -砂 -砌 -砍 -砒 -研 -砖 -砗 -砚 -砝 -砣 -砥 -砧 -砭 -砰 -砲 -破 -砷 -砸 -砺 -砼 -砾 -础 -硅 -硐 -硒 -硕 -硝 -硫 -硬 -确 -硯 -硼 -碁 -碇 -碉 -碌 -碍 -碎 -碑 -碓 -碗 -碘 -碚 -碛 -碟 -碣 -碧 -碩 -碰 -碱 -碳 -碴 -確 -碼 -碾 -磁 -磅 -磊 -磋 -磐 -磕 -磚 -磡 -磨 -磬 -磯 -磲 -磷 -磺 -礁 -礎 -礙 -礡 -礦 -礪 -礫 -礴 -示 -礼 -社 -祀 -祁 -祂 -祇 -祈 -祉 -祎 -祐 -祕 -祖 -祗 -祚 -祛 -祜 -祝 -神 -祟 -祠 -祢 -祥 -票 -祭 -祯 -祷 -祸 -祺 -祿 -禀 -禁 -禄 -禅 -禍 -禎 -福 -禛 -禦 -禧 -禪 -禮 -禱 -禹 -禺 -离 -禽 -禾 -禿 -秀 -私 -秃 -秆 -秉 -秋 -种 -科 -秒 -秘 -租 -秣 -秤 -秦 -秧 -秩 -秭 -积 -称 -秸 -移 -秽 -稀 -稅 -程 -稍 -税 -稔 -稗 -稚 -稜 -稞 -稟 -稠 -稣 -種 -稱 -稲 -稳 -稷 -稹 -稻 -稼 -稽 -稿 -穀 -穂 -穆 -穌 -積 -穎 -穗 -穢 -穩 -穫 -穴 -究 -穷 -穹 -空 -穿 -突 -窃 -窄 -窈 -窍 -窑 -窒 -窓 -窕 -窖 -窗 -窘 -窜 -窝 -窟 -窠 -窥 -窦 -窨 -窩 -窪 -窮 -窯 -窺 -窿 -竄 -竅 -竇 -竊 -立 -竖 -站 -竜 -竞 -竟 -章 -竣 -童 -竭 -端 -競 -竹 -竺 -竽 -竿 -笃 -笆 -笈 -笋 -笏 -笑 -笔 -笙 -笛 -笞 -笠 -符 -笨 -第 -笹 -笺 -笼 -筆 -等 -筊 -筋 -筍 -筏 -筐 -筑 -筒 -答 -策 -筛 -筝 -筠 -筱 -筲 -筵 -筷 -筹 -签 -简 -箇 -箋 -箍 -箏 -箐 -箔 -箕 -算 -箝 -管 -箩 -箫 -箭 -箱 -箴 -箸 -節 -篁 -範 -篆 -篇 -築 -篑 -篓 -篙 -篝 -篠 -篡 -篤 -篩 -篪 -篮 -篱 -篷 -簇 -簌 -簍 -簡 -簦 -簧 -簪 -簫 -簷 -簸 -簽 -簾 -簿 -籁 -籃 -籌 -籍 -籐 -籟 -籠 -籤 -籬 -籮 -籲 -米 -类 -籼 -籽 -粄 -粉 -粑 -粒 -粕 -粗 -粘 -粟 -粤 -粥 -粧 -粪 -粮 -粱 -粲 -粳 -粵 -粹 -粼 -粽 -精 -粿 -糅 -糊 -糍 -糕 -糖 -糗 -糙 -糜 -糞 -糟 -糠 -糧 -糬 -糯 -糰 -糸 -系 -糾 -紀 -紂 -約 -紅 -紉 -紊 -紋 -納 -紐 -紓 -純 -紗 -紘 -紙 -級 -紛 -紜 -素 -紡 -索 -紧 -紫 -紮 -累 -細 -紳 -紹 -紺 -終 -絃 -組 -絆 -経 -結 -絕 -絞 -絡 -絢 -給 -絨 -絮 -統 -絲 -絳 -絵 -絶 -絹 -綁 -綏 -綑 -經 -継 -続 -綜 -綠 -綢 -綦 -綫 -綬 -維 -綱 -網 -綴 -綵 -綸 -綺 -綻 -綽 -綾 -綿 -緊 -緋 -総 -緑 -緒 -緘 -線 -緝 -緞 -締 -緣 -編 -緩 -緬 -緯 -練 -緹 -緻 -縁 -縄 -縈 -縛 -縝 -縣 -縫 -縮 -縱 -縴 -縷 -總 -績 -繁 -繃 -繆 -繇 -繋 -織 -繕 -繚 -繞 -繡 -繩 -繪 -繫 -繭 -繳 -繹 -繼 -繽 -纂 -續 -纍 -纏 -纓 -纔 -纖 -纜 -纠 -红 -纣 -纤 -约 -级 -纨 -纪 -纫 -纬 -纭 -纯 -纰 -纱 -纲 -纳 -纵 -纶 -纷 -纸 -纹 -纺 -纽 -纾 -线 -绀 -练 -组 -绅 -细 -织 -终 -绊 -绍 -绎 -经 -绑 -绒 -结 -绔 -绕 -绘 -给 -绚 -绛 -络 -绝 -绞 -统 -绡 -绢 -绣 -绥 -绦 -继 -绩 -绪 -绫 -续 -绮 -绯 -绰 -绳 -维 -绵 -绶 -绷 -绸 -绻 -综 -绽 -绾 -绿 -缀 -缄 -缅 -缆 -缇 -缈 -缉 -缎 -缓 -缔 -缕 -编 -缘 -缙 -缚 -缜 -缝 -缠 -缢 -缤 -缥 -缨 -缩 -缪 -缭 -缮 -缰 -缱 -缴 -缸 -缺 -缽 -罂 -罄 -罌 -罐 -网 -罔 -罕 -罗 -罚 -罡 -罢 -罩 -罪 -置 -罰 -署 -罵 -罷 -罹 -羁 -羅 -羈 -羊 -羌 -美 -羔 -羚 -羞 -羟 -羡 -羣 -群 -羥 -羧 -羨 -義 -羯 -羲 -羸 -羹 -羽 -羿 -翁 -翅 -翊 -翌 -翎 -習 -翔 -翘 -翟 -翠 -翡 -翦 -翩 -翰 -翱 -翳 -翹 -翻 -翼 -耀 -老 -考 -耄 -者 -耆 -耋 -而 -耍 -耐 -耒 -耕 -耗 -耘 -耙 -耦 -耨 -耳 -耶 -耷 -耸 -耻 -耽 -耿 -聂 -聆 -聊 -聋 -职 -聒 -联 -聖 -聘 -聚 -聞 -聪 -聯 -聰 -聲 -聳 -聴 -聶 -職 -聽 -聾 -聿 -肃 -肄 -肅 -肆 -肇 -肉 -肋 -肌 -肏 -肓 -肖 -肘 -肚 -肛 -肝 -肠 -股 -肢 -肤 -肥 -肩 -肪 -肮 -肯 -肱 -育 -肴 -肺 -肽 -肾 -肿 -胀 -胁 -胃 -胄 -胆 -背 -胍 -胎 -胖 -胚 -胛 -胜 -胝 -胞 -胡 -胤 -胥 -胧 -胫 -胭 -胯 -胰 -胱 -胳 -胴 -胶 -胸 -胺 -能 -脂 -脅 -脆 -脇 -脈 -脉 -脊 -脍 -脏 -脐 -脑 -脓 -脖 -脘 -脚 -脛 -脣 -脩 -脫 -脯 -脱 -脲 -脳 -脸 -脹 -脾 -腆 -腈 -腊 -腋 -腌 -腎 -腐 -腑 -腓 -腔 -腕 -腥 -腦 -腩 -腫 -腭 -腮 -腰 -腱 -腳 -腴 -腸 -腹 -腺 -腻 -腼 -腾 -腿 -膀 -膈 -膊 -膏 -膑 -膘 -膚 -膛 -膜 -膝 -膠 -膦 -膨 -膩 -膳 -膺 -膻 -膽 -膾 -膿 -臀 -臂 -臃 -臆 -臉 -臊 -臍 -臓 -臘 -臟 -臣 -臥 -臧 -臨 -自 -臬 -臭 -至 -致 -臺 -臻 -臼 -臾 -舀 -舂 -舅 -舆 -與 -興 -舉 -舊 -舌 -舍 -舎 -舐 -舒 -舔 -舖 -舗 -舛 -舜 -舞 -舟 -航 -舫 -般 -舰 -舱 -舵 -舶 -舷 -舸 -船 -舺 -舾 -艇 -艋 -艘 -艙 -艦 -艮 -良 -艰 -艱 -色 -艳 -艷 -艹 -艺 -艾 -节 -芃 -芈 -芊 -芋 -芍 -芎 -芒 -芙 -芜 -芝 -芡 -芥 -芦 -芩 -芪 -芫 -芬 -芭 -芮 -芯 -花 -芳 -芷 -芸 -芹 -芻 -芽 -芾 -苁 -苄 -苇 -苋 -苍 -苏 -苑 -苒 -苓 -苔 -苕 -苗 -苛 -苜 -苞 -苟 -苡 -苣 -若 -苦 -苫 -苯 -英 -苷 -苹 -苻 -茁 -茂 -范 -茄 -茅 -茉 -茎 -茏 -茗 -茜 -茧 -茨 -茫 -茬 -茭 -茯 -茱 -茲 -茴 -茵 -茶 -茸 -茹 -茼 -荀 -荃 -荆 -草 -荊 -荏 -荐 -荒 -荔 -荖 -荘 -荚 -荞 -荟 -荠 -荡 -荣 -荤 -荥 -荧 -荨 -荪 -荫 -药 -荳 -荷 -荸 -荻 -荼 -荽 -莅 -莆 -莉 -莊 -莎 -莒 -莓 -莖 -莘 -莞 -莠 -莢 -莧 -莪 -莫 -莱 -莲 -莴 -获 -莹 -莺 -莽 -莿 -菀 -菁 -菅 -菇 -菈 -菊 -菌 -菏 -菓 -菖 -菘 -菜 -菟 -菠 -菡 -菩 -華 -菱 -菲 -菸 -菽 -萁 -萃 -萄 -萊 -萋 -萌 -萍 -萎 -萘 -萝 -萤 -营 -萦 -萧 -萨 -萩 -萬 -萱 -萵 -萸 -萼 -落 -葆 -葉 -著 -葚 -葛 -葡 -董 -葦 -葩 -葫 -葬 -葭 -葯 -葱 -葳 -葵 -葷 -葺 -蒂 -蒋 -蒐 -蒔 -蒙 -蒜 -蒞 -蒟 -蒡 -蒨 -蒲 -蒸 -蒹 -蒻 -蒼 -蒿 -蓁 -蓄 -蓆 -蓉 -蓋 -蓑 -蓓 -蓖 -蓝 -蓟 -蓦 -蓬 -蓮 -蓼 -蓿 -蔑 -蔓 -蔔 -蔗 -蔘 -蔚 -蔡 -蔣 -蔥 -蔫 -蔬 -蔭 -蔵 -蔷 -蔺 -蔻 -蔼 -蔽 -蕁 -蕃 -蕈 -蕉 -蕊 -蕎 -蕙 -蕤 -蕨 -蕩 -蕪 -蕭 -蕲 -蕴 -蕻 -蕾 -薄 -薅 -薇 -薈 -薊 -薏 -薑 -薔 -薙 -薛 -薦 -薨 -薩 -薪 -薬 -薯 -薰 -薹 -藉 -藍 -藏 -藐 -藓 -藕 -藜 -藝 -藤 -藥 -藩 -藹 -藻 -藿 -蘆 -蘇 -蘊 -蘋 -蘑 -蘚 -蘭 -蘸 -蘼 -蘿 -虎 -虏 -虐 -虑 -虔 -處 -虚 -虛 -虜 -虞 -號 -虢 -虧 -虫 -虬 -虱 -虹 -虻 -虽 -虾 -蚀 -蚁 -蚂 -蚊 -蚌 -蚓 -蚕 -蚜 -蚝 -蚣 -蚤 -蚩 -蚪 -蚯 -蚱 -蚵 -蛀 -蛆 -蛇 -蛊 -蛋 -蛎 -蛐 -蛔 -蛙 -蛛 -蛟 -蛤 -蛭 -蛮 -蛰 -蛳 -蛹 -蛻 -蛾 -蜀 -蜂 -蜃 -蜆 -蜇 -蜈 -蜊 -蜍 -蜒 -蜓 -蜕 -蜗 -蜘 -蜚 -蜜 -蜡 -蜢 -蜥 -蜱 -蜴 -蜷 -蜻 -蜿 -蝇 -蝈 -蝉 -蝌 -蝎 -蝕 -蝗 -蝙 -蝟 -蝠 -蝦 -蝨 -蝴 -蝶 -蝸 -蝼 -螂 -螃 -融 -螞 -螢 -螨 -螯 -螳 -螺 -蟀 -蟄 -蟆 -蟋 -蟎 -蟑 -蟒 -蟠 -蟬 -蟲 -蟹 -蟻 -蟾 -蠅 -蠍 -蠔 -蠕 -蠛 -蠟 -蠡 -蠢 -蠣 -蠱 -蠶 -蠹 -蠻 -血 -衄 -衅 -衆 -行 -衍 -術 -衔 -街 -衙 -衛 -衝 -衞 -衡 -衢 -衣 -补 -表 -衩 -衫 -衬 -衮 -衰 -衲 -衷 -衹 -衾 -衿 -袁 -袂 -袄 -袅 -袈 -袋 -袍 -袒 -袖 -袜 -袞 -袤 -袪 -被 -袭 -袱 -裁 -裂 -装 -裆 -裊 -裏 -裔 -裕 -裘 -裙 -補 -裝 -裟 -裡 -裤 -裨 -裱 -裳 -裴 -裸 -裹 -製 -裾 -褂 -複 -褐 -褒 -褓 -褔 -褚 -褥 -褪 -褫 -褲 -褶 -褻 -襁 -襄 -襟 -襠 -襪 -襬 -襯 -襲 -西 -要 -覃 -覆 -覇 -見 -規 -覓 -視 -覚 -覦 -覧 -親 -覬 -観 -覷 -覺 -覽 -觀 -见 -观 -规 -觅 -视 -览 -觉 -觊 -觎 -觐 -觑 -角 -觞 -解 -觥 -触 -觸 -言 -訂 -計 -訊 -討 -訓 -訕 -訖 -託 -記 -訛 -訝 -訟 -訣 -訥 -訪 -設 -許 -訳 -訴 -訶 -診 -註 -証 -詆 -詐 -詔 -評 -詛 -詞 -詠 -詡 -詢 -詣 -試 -詩 -詫 -詬 -詭 -詮 -詰 -話 -該 -詳 -詹 -詼 -誅 -誇 -誉 -誌 -認 -誓 -誕 -誘 -語 -誠 -誡 -誣 -誤 -誥 -誦 -誨 -說 -説 -読 -誰 -課 -誹 -誼 -調 -諄 -談 -請 -諏 -諒 -論 -諗 -諜 -諡 -諦 -諧 -諫 -諭 -諮 -諱 -諳 -諷 -諸 -諺 -諾 -謀 -謁 -謂 -謄 -謊 -謎 -謐 -謔 -謗 -謙 -講 -謝 -謠 -謨 -謬 -謹 -謾 -譁 -證 -譎 -譏 -識 -譙 -譚 -譜 -警 -譬 -譯 -議 -譲 -譴 -護 -譽 -讀 -變 -讓 -讚 -讞 -计 -订 -认 -讥 -讧 -讨 -让 -讪 -讫 -训 -议 -讯 -记 -讲 -讳 -讴 -讶 -讷 -许 -讹 -论 -讼 -讽 -设 -访 -诀 -证 -诃 -评 -诅 -识 -诈 -诉 -诊 -诋 -词 -诏 -译 -试 -诗 -诘 -诙 -诚 -诛 -话 -诞 -诟 -诠 -诡 -询 -诣 -诤 -该 -详 -诧 -诩 -诫 -诬 -语 -误 -诰 -诱 -诲 -说 -诵 -诶 -请 -诸 -诺 -读 -诽 -课 -诿 -谀 -谁 -调 -谄 -谅 -谆 -谈 -谊 -谋 -谌 -谍 -谎 -谏 -谐 -谑 -谒 -谓 -谔 -谕 -谗 -谘 -谙 -谚 -谛 -谜 -谟 -谢 -谣 -谤 -谥 -谦 -谧 -谨 -谩 -谪 -谬 -谭 -谯 -谱 -谲 -谴 -谶 -谷 -豁 -豆 -豇 -豈 -豉 -豊 -豌 -豎 -豐 -豔 -豚 -象 -豢 -豪 -豫 -豬 -豹 -豺 -貂 -貅 -貌 -貓 -貔 -貘 -貝 -貞 -負 -財 -貢 -貧 -貨 -販 -貪 -貫 -責 -貯 -貰 -貳 -貴 -貶 -買 -貸 -費 -貼 -貽 -貿 -賀 -賁 -賂 -賃 -賄 -資 -賈 -賊 -賑 -賓 -賜 -賞 -賠 -賡 -賢 -賣 -賤 -賦 -質 -賬 -賭 -賴 -賺 -購 -賽 -贅 -贈 -贊 -贍 -贏 -贓 -贖 -贛 -贝 -贞 -负 -贡 -财 -责 -贤 -败 -账 -货 -质 -贩 -贪 -贫 -贬 -购 -贮 -贯 -贰 -贱 -贲 -贴 -贵 -贷 -贸 -费 -贺 -贻 -贼 -贾 -贿 -赁 -赂 -赃 -资 -赅 -赈 -赊 -赋 -赌 -赎 -赏 -赐 -赓 -赔 -赖 -赘 -赚 -赛 -赝 -赞 -赠 -赡 -赢 -赣 -赤 -赦 -赧 -赫 -赭 -走 -赳 -赴 -赵 -赶 -起 -趁 -超 -越 -趋 -趕 -趙 -趟 -趣 -趨 -足 -趴 -趵 -趸 -趺 -趾 -跃 -跄 -跆 -跋 -跌 -跎 -跑 -跖 -跚 -跛 -距 -跟 -跡 -跤 -跨 -跩 -跪 -路 -跳 -践 -跷 -跹 -跺 -跻 -踉 -踊 -踌 -踏 -踐 -踝 -踞 -踟 -踢 -踩 -踪 -踮 -踱 -踴 -踵 -踹 -蹂 -蹄 -蹇 -蹈 -蹉 -蹊 -蹋 -蹑 -蹒 -蹙 -蹟 -蹣 -蹤 -蹦 -蹩 -蹬 -蹭 -蹲 -蹴 -蹶 -蹺 -蹼 -蹿 -躁 -躇 -躉 -躊 -躋 -躍 -躏 -躪 -身 -躬 -躯 -躲 -躺 -軀 -車 -軋 -軌 -軍 -軒 -軟 -転 -軸 -軼 -軽 -軾 -較 -載 -輒 -輓 -輔 -輕 -輛 -輝 -輟 -輩 -輪 -輯 -輸 -輻 -輾 -輿 -轄 -轅 -轆 -轉 -轍 -轎 -轟 -车 -轧 -轨 -轩 -转 -轭 -轮 -软 -轰 -轲 -轴 -轶 -轻 -轼 -载 -轿 -较 -辄 -辅 -辆 -辇 -辈 -辉 -辊 -辍 -辐 -辑 -输 -辕 -辖 -辗 -辘 -辙 -辛 -辜 -辞 -辟 -辣 -辦 -辨 -辩 -辫 -辭 -辮 -辯 -辰 -辱 -農 -边 -辺 -辻 -込 -辽 -达 -迁 -迂 -迄 -迅 -过 -迈 -迎 -运 -近 -返 -还 -这 -进 -远 -违 -连 -迟 -迢 -迤 -迥 -迦 -迩 -迪 -迫 -迭 -述 -迴 -迷 -迸 -迹 -迺 -追 -退 -送 -适 -逃 -逅 -逆 -选 -逊 -逍 -透 -逐 -递 -途 -逕 -逗 -這 -通 -逛 -逝 -逞 -速 -造 -逢 -連 -逮 -週 -進 -逵 -逶 -逸 -逻 -逼 -逾 -遁 -遂 -遅 -遇 -遊 -運 -遍 -過 -遏 -遐 -遑 -遒 -道 -達 -違 -遗 -遙 -遛 -遜 -遞 -遠 -遢 -遣 -遥 -遨 -適 -遭 -遮 -遲 -遴 -遵 -遶 -遷 -選 -遺 -遼 -遽 -避 -邀 -邁 -邂 -邃 -還 -邇 -邈 -邊 -邋 -邏 -邑 -邓 -邕 -邛 -邝 -邢 -那 -邦 -邨 -邪 -邬 -邮 -邯 -邰 -邱 -邳 -邵 -邸 -邹 -邺 -邻 -郁 -郅 -郊 -郎 -郑 -郜 -郝 -郡 -郢 -郤 -郦 -郧 -部 -郫 -郭 -郴 -郵 -郷 -郸 -都 -鄂 -鄉 -鄒 -鄔 -鄙 -鄞 -鄢 -鄧 -鄭 -鄰 -鄱 -鄲 -鄺 -酉 -酊 -酋 -酌 -配 -酐 -酒 -酗 -酚 -酝 -酢 -酣 -酥 -酩 -酪 -酬 -酮 -酯 -酰 -酱 -酵 -酶 -酷 -酸 -酿 -醃 -醇 -醉 -醋 -醍 -醐 -醒 -醚 -醛 -醜 -醞 -醣 -醪 -醫 -醬 -醮 -醯 -醴 -醺 -釀 -釁 -采 -釉 -释 -釋 -里 -重 -野 -量 -釐 -金 -釗 -釘 -釜 -針 -釣 -釦 -釧 -釵 -鈀 -鈉 -鈍 -鈎 -鈔 -鈕 -鈞 -鈣 -鈦 -鈪 -鈴 -鈺 -鈾 -鉀 -鉄 -鉅 -鉉 -鉑 -鉗 -鉚 -鉛 -鉤 -鉴 -鉻 -銀 -銃 -銅 -銑 -銓 -銖 -銘 -銜 -銬 -銭 -銮 -銳 -銷 -銹 -鋁 -鋅 -鋒 -鋤 -鋪 -鋰 -鋸 -鋼 -錄 -錐 -錘 -錚 -錠 -錢 -錦 -錨 -錫 -錮 -錯 -録 -錳 -錶 -鍊 -鍋 -鍍 -鍛 -鍥 -鍰 -鍵 -鍺 -鍾 -鎂 -鎊 -鎌 -鎏 -鎔 -鎖 -鎗 -鎚 -鎧 -鎬 -鎮 -鎳 -鏈 -鏖 -鏗 -鏘 -鏞 -鏟 -鏡 -鏢 -鏤 -鏽 -鐘 -鐮 -鐲 -鐳 -鐵 -鐸 -鐺 -鑄 -鑊 -鑑 -鑒 -鑣 -鑫 -鑰 -鑲 -鑼 -鑽 -鑾 -鑿 -针 -钉 -钊 -钎 -钏 -钒 -钓 -钗 -钙 -钛 -钜 -钝 -钞 -钟 -钠 -钡 -钢 -钣 -钤 -钥 -钦 -钧 -钨 -钩 -钮 -钯 -钰 -钱 -钳 -钴 -钵 -钺 -钻 -钼 -钾 -钿 -铀 -铁 -铂 -铃 -铄 -铅 -铆 -铉 -铎 -铐 -铛 -铜 -铝 -铠 -铡 -铢 -铣 -铤 -铨 -铩 -铬 -铭 -铮 -铰 -铲 -铵 -银 -铸 -铺 -链 -铿 -销 -锁 -锂 -锄 -锅 -锆 -锈 -锉 -锋 -锌 -锏 -锐 -锑 -错 -锚 -锟 -锡 -锢 -锣 -锤 -锥 -锦 -锭 -键 -锯 -锰 -锲 -锵 -锹 -锺 -锻 -镀 -镁 -镂 -镇 -镉 -镌 -镍 -镐 -镑 -镕 -镖 -镗 -镛 -镜 -镣 -镭 -镯 -镰 -镳 -镶 -長 -长 -門 -閃 -閉 -開 -閎 -閏 -閑 -閒 -間 -閔 -閘 -閡 -関 -閣 -閥 -閨 -閩 -閱 -閲 -閹 -閻 -閾 -闆 -闇 -闊 -闌 -闍 -闔 -闕 -闖 -闘 -關 -闡 -闢 -门 -闪 -闫 -闭 -问 -闯 -闰 -闲 -间 -闵 -闷 -闸 -闹 -闺 -闻 -闽 -闾 -阀 -阁 -阂 -阅 -阆 -阇 -阈 -阉 -阎 -阐 -阑 -阔 -阕 -阖 -阙 -阚 -阜 -队 -阡 -阪 -阮 -阱 -防 -阳 -阴 -阵 -阶 -阻 -阿 -陀 -陂 -附 -际 -陆 -陇 -陈 -陋 -陌 -降 -限 -陕 -陛 -陝 -陞 -陟 -陡 -院 -陣 -除 -陨 -险 -陪 -陰 -陲 -陳 -陵 -陶 -陷 -陸 -険 -陽 -隅 -隆 -隈 -隊 -隋 -隍 -階 -随 -隐 -隔 -隕 -隘 -隙 -際 -障 -隠 -隣 -隧 -隨 -險 -隱 -隴 -隶 -隸 -隻 -隼 -隽 -难 -雀 -雁 -雄 -雅 -集 -雇 -雉 -雋 -雌 -雍 -雎 -雏 -雑 -雒 -雕 -雖 -雙 -雛 -雜 -雞 -離 -難 -雨 -雪 -雯 -雰 -雲 -雳 -零 -雷 -雹 -電 -雾 -需 -霁 -霄 -霆 -震 -霈 -霉 -霊 -霍 -霎 -霏 -霑 -霓 -霖 -霜 -霞 -霧 -霭 -霰 -露 -霸 -霹 -霽 -霾 -靂 -靄 -靈 -青 -靓 -靖 -静 -靚 -靛 -靜 -非 -靠 -靡 -面 -靥 -靦 -革 -靳 -靴 -靶 -靼 -鞅 -鞋 -鞍 -鞏 -鞑 -鞘 -鞠 -鞣 -鞦 -鞭 -韆 -韋 -韌 -韓 -韜 -韦 -韧 -韩 -韬 -韭 -音 -韵 -韶 -韻 -響 -頁 -頂 -頃 -項 -順 -須 -頌 -預 -頑 -頒 -頓 -頗 -領 -頜 -頡 -頤 -頫 -頭 -頰 -頷 -頸 -頹 -頻 -頼 -顆 -題 -額 -顎 -顏 -顔 -願 -顛 -類 -顧 -顫 -顯 -顱 -顴 -页 -顶 -顷 -项 -顺 -须 -顼 -顽 -顾 -顿 -颁 -颂 -预 -颅 -领 -颇 -颈 -颉 -颊 -颌 -颍 -颐 -频 -颓 -颔 -颖 -颗 -题 -颚 -颛 -颜 -额 -颞 -颠 -颡 -颢 -颤 -颦 -颧 -風 -颯 -颱 -颳 -颶 -颼 -飄 -飆 -风 -飒 -飓 -飕 -飘 -飙 -飚 -飛 -飞 -食 -飢 -飨 -飩 -飪 -飯 -飲 -飼 -飽 -飾 -餃 -餅 -餉 -養 -餌 -餐 -餒 -餓 -餘 -餚 -餛 -餞 -餡 -館 -餮 -餵 -餾 -饅 -饈 -饋 -饌 -饍 -饑 -饒 -饕 -饗 -饞 -饥 -饨 -饪 -饬 -饭 -饮 -饯 -饰 -饱 -饲 -饴 -饵 -饶 -饷 -饺 -饼 -饽 -饿 -馀 -馁 -馄 -馅 -馆 -馈 -馋 -馍 -馏 -馒 -馔 -首 -馗 -香 -馥 -馨 -馬 -馭 -馮 -馳 -馴 -駁 -駄 -駅 -駆 -駐 -駒 -駕 -駛 -駝 -駭 -駱 -駿 -騁 -騎 -騏 -験 -騙 -騨 -騰 -騷 -驀 -驅 -驊 -驍 -驒 -驕 -驗 -驚 -驛 -驟 -驢 -驥 -马 -驭 -驮 -驯 -驰 -驱 -驳 -驴 -驶 -驷 -驸 -驹 -驻 -驼 -驾 -驿 -骁 -骂 -骄 -骅 -骆 -骇 -骈 -骊 -骋 -验 -骏 -骐 -骑 -骗 -骚 -骛 -骜 -骞 -骠 -骡 -骤 -骥 -骧 -骨 -骯 -骰 -骶 -骷 -骸 -骼 -髂 -髅 -髋 -髏 -髒 -髓 -體 -髖 -高 -髦 -髪 -髮 -髯 -髻 -鬃 -鬆 -鬍 -鬓 -鬚 -鬟 -鬢 -鬣 -鬥 -鬧 -鬱 -鬼 -魁 -魂 -魄 -魅 -魇 -魍 -魏 -魔 -魘 -魚 -魯 -魷 -鮑 -鮨 -鮪 -鮭 -鮮 -鯉 -鯊 -鯖 -鯛 -鯨 -鯰 -鯽 -鰍 -鰓 -鰭 -鰲 -鰻 -鰾 -鱈 -鱉 -鱔 -鱗 -鱷 -鱸 -鱼 -鱿 -鲁 -鲈 -鲍 -鲑 -鲛 -鲜 -鲟 -鲢 -鲤 -鲨 -鲫 -鲱 -鲲 -鲶 -鲷 -鲸 -鳃 -鳄 -鳅 -鳌 -鳍 -鳕 -鳖 -鳗 -鳝 -鳞 -鳥 -鳩 -鳳 -鳴 -鳶 -鴉 -鴕 -鴛 -鴦 -鴨 -鴻 -鴿 -鵑 -鵜 -鵝 -鵡 -鵬 -鵰 -鵲 -鶘 -鶩 -鶯 -鶴 -鷗 -鷲 -鷹 -鷺 -鸚 -鸞 -鸟 -鸠 -鸡 -鸢 -鸣 -鸥 -鸦 -鸨 -鸪 -鸭 -鸯 -鸳 -鸵 -鸽 -鸾 -鸿 -鹂 -鹃 -鹄 -鹅 -鹈 -鹉 -鹊 -鹌 -鹏 -鹑 -鹕 -鹘 -鹜 -鹞 -鹤 -鹦 -鹧 -鹫 -鹭 -鹰 -鹳 -鹵 -鹹 -鹼 -鹽 -鹿 -麂 -麋 -麒 -麓 -麗 -麝 -麟 -麥 -麦 -麩 -麴 -麵 -麸 -麺 -麻 -麼 -麽 -麾 -黃 -黄 -黍 -黎 -黏 -黑 -黒 -黔 -默 -黛 -黜 -黝 -點 -黠 -黨 -黯 -黴 -鼋 -鼎 -鼐 -鼓 -鼠 -鼬 -鼹 -鼻 -鼾 -齁 -齊 -齋 -齐 -齒 -齡 -齢 -齣 -齦 -齿 -龄 -龅 -龈 -龊 -龋 -龌 -龍 -龐 -龔 -龕 -龙 -龚 -龛 -龜 -龟 -︰ -︱ -︶ -︿ -﹁ -﹂ -﹍ -﹏ -﹐ -﹑ -﹒ -﹔ -﹕ -﹖ -﹗ -﹙ -﹚ -﹝ -﹞ -﹡ -﹣ -! -" -# -$ -% -& -' -( -) -* -+ -, -- -. -/ -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -: -; -< -= -> -? -@ -[ -\ -] -^ -_ -` -a -b -c -d -e -f -g -h -i -j -k -l -m -n -o -p -q -r -s -t -u -v -w -x -y -z -{ -| -} -~ -。 -「 -」 -、 -・ -ッ -ー -イ -ク -シ -ス -ト -ノ -フ -ラ -ル -ン -゙ -゚ - ̄ -¥ -👍 -🔥 -😂 -😎 -... -yam -10 -2017 -12 -11 -2016 -20 -30 -15 -06 -lofter -##s -2015 -by -16 -14 -18 -13 -24 -17 -2014 -21 -##0 -22 -19 -25 -23 -com -100 -00 -05 -2013 -##a -03 -09 -08 -28 -##2 -50 -01 -04 -##1 -27 -02 -2012 -##3 -26 -##e -07 -##8 -##5 -##6 -##4 -##9 -##7 -29 -2011 -40 -##t -2010 -##o -##d -##i -2009 -##n -app -www -the -##m -31 -##c -##l -##y -##r -##g -2008 -60 -http -200 -qq -##p -80 -##f -google -pixnet -90 -cookies -tripadvisor -500 -##er -##k -35 -##h -facebook -2007 -2000 -70 -##b -of -##x -##u -45 -300 -iphone -32 -1000 -2006 -48 -ip -36 -in -38 -3d -##w -##ing -55 -ctrip -##on -##v -33 -##の -to -34 -400 -id -2005 -it -37 -windows -llc -top -99 -42 -39 -000 -led -at -##an -41 -51 -52 -46 -49 -43 -53 -44 -##z -android -58 -and -59 -2004 -56 -vr -##か -5000 -2003 -47 -blogthis -twitter -54 -##le -150 -ok -2018 -57 -75 -cn -no -ios -##in -##mm -##00 -800 -on -te -3000 -65 -2001 -360 -95 -ig -lv -120 -##ng -##を -##us -##に -pc -てす -── -600 -##te -85 -2002 -88 -##ed -html -ncc -wifi -email -64 -blog -is -##10 -##て -mail -online -##al -dvd -##ic -studio -##は -##℃ -##ia -##と -line -vip -72 -##q -98 -##ce -##en -for -##is -##ra -##es -##j -usb -net -cp -1999 -asia -4g -##cm -diy -new -3c -##お -ta -66 -language -vs -apple -tw -86 -web -##ne -ipad -62 -you -##re -101 -68 -##tion -ps -de -bt -pony -atm -##2017 -1998 -67 -##ch -ceo -##or -go -##na -av -pro -cafe -96 -pinterest -97 -63 -pixstyleme3c -##ta -more -said -##2016 -1997 -mp3 -700 -##ll -nba -jun -##20 -92 -tv -1995 -pm -61 -76 -nbsp -250 -##ie -linux -##ma -cd -110 -hd -##17 -78 -##ion -77 -6000 -am -##th -##st -94 -##se -##et -69 -180 -gdp -my -105 -81 -abc -89 -flash -79 -one -93 -1990 -1996 -##ck -gps -##も -##ly -web885 -106 -2020 -91 -##ge -4000 -1500 -xd -boss -isbn -1994 -org -##ry -me -love -##11 -0fork -73 -##12 -3g -##ter -##ar -71 -82 -##la -hotel -130 -1970 -pk -83 -87 -140 -ie -##os -##30 -##el -74 -##50 -seo -cpu -##ml -p2p -84 -may -##る -sun -tue -internet -cc -posted -youtube -##at -##ン -##man -ii -##ル -##15 -abs -nt -pdf -yahoo -ago -1980 -##it -news -mac -104 -##てす -##me -##り -java -1992 -spa -##de -##nt -hk -all -plus -la -1993 -##mb -##16 -##ve -west -##da -160 -air -##い -##ps -から -##to -1989 -logo -htc -php -https -fi -momo -##son -sat -##ke -##80 -ebd -suv -wi -day -apk -##88 -##um -mv -galaxy -wiki -or -brake -##ス -1200 -する -this -1991 -mon -##こ -❤2017 -po -##ない -javascript -life -home -june -##ss -system -900 -##ー -##0 -pp -1988 -world -fb -4k -br -##as -ic -ai -leonardo -safari -##60 -live -free -xx -wed -win7 -kiehl -##co -lg -o2o -##go -us -235 -1949 -mm -しい -vfm -kanye -##90 -##2015 -##id -jr -##ey -123 -rss -##sa -##ro -##am -##no -thu -fri -350 -##sh -##ki -103 -comments -name -##のて -##pe -##ine -max -1987 -8000 -uber -##mi -##ton -wordpress -office -1986 -1985 -##ment -107 -bd -win10 -##ld -##li -gmail -bb -dior -##rs -##ri -##rd -##ます -up -cad -##® -dr -して -read -##21 -をお -##io -##99 -url -1984 -pvc -paypal -show -policy -##40 -##ty -##18 -with -##★ -##01 -txt -102 -##ba -dna -from -post -mini -ar -taiwan -john -##ga -privacy -agoda -##13 -##ny -word -##24 -##22 -##by -##ur -##hz -1982 -##ang -265 -cookie -netscape -108 -##ka -##~ -##ad -house -share -note -ibm -code -hello -nike -sim -survey -##016 -1979 -1950 -wikia -##32 -##017 -5g -cbc -##tor -##kg -1983 -##rt -##14 -campaign -store -2500 -os -##ct -##ts -##° -170 -api -##ns -365 -excel -##な -##ao -##ら -##し -~~ -##nd -university -163 -には -518 -##70 -##ya -##il -##25 -pierre -ipo -0020 -897 -##23 -hotels -##ian -のお -125 -years -6606 -##ers -##26 -high -##day -time -##ay -bug -##line -##く -##す -##be -xp -talk2yam -yamservice -10000 -coco -##dy -sony -##ies -1978 -microsoft -david -people -##ha -1960 -instagram -intel -その -##ot -iso -1981 -##va -115 -##mo -##land -xxx -man -co -ltxsw -##ation -baby -220 -##pa -##ol -1945 -7000 -tag -450 -##ue -msn -##31 -oppo -##ト -##ca -control -##om -st -chrome -##ure -##ん -be -##き -lol -##19 -した -##bo -240 -lady -##100 -##way -##から -4600 -##ko -##do -##un -4s -corporation -168 -##ni -herme -##28 -cp -978 -##up -##06 -ui -##ds -ppt -admin -three -します -bbc -re -128 -##48 -ca -##015 -##35 -hp -##ee -tpp -##た -##ive -×× -root -##cc -##ました -##ble -##ity -adobe -park -114 -et -oled -city -##ex -##ler -##ap -china -##book -20000 -view -##ice -global -##km -your -hong -##mg -out -##ms -ng -ebay -##29 -menu -ubuntu -##cy -rom -##view -open -ktv -do -server -##lo -if -english -##ね -##5 -##oo -1600 -##02 -step1 -kong -club -135 -july -inc -1976 -mr -hi -##net -touch -##ls -##ii -michael -lcd -##05 -##33 -phone -james -step2 -1300 -ios9 -##box -dc -##2 -##ley -samsung -111 -280 -pokemon -css -##ent -##les -いいえ -##1 -s8 -atom -play -bmw -##said -sa -etf -ctrl -♥yoyo♥ -##55 -2025 -##2014 -##66 -adidas -amazon -1958 -##ber -##ner -visa -##77 -##der -1800 -connectivity -##hi -firefox -109 -118 -hr -so -style -mark -pop -ol -skip -1975 -as -##27 -##ir -##61 -190 -mba -##う -##ai -le -##ver -1900 -cafe2017 -lte -super -113 -129 -##ron -amd -like -##☆ -are -##ster -we -##sk -paul -data -international -##ft -longchamp -ssd -good -##ート -##ti -reply -##my -↓↓↓ -apr -star -##ker -source -136 -js -112 -get -force -photo -##one -126 -##2013 -##ow -link -bbs -1972 -goods -##lin -python -119 -##ip -game -##ics -##ません -blue -##● -520 -##45 -page -itunes -##03 -1955 -260 -1968 -gt -gif -618 -##ff -##47 -group -くたさい -about -bar -ganji -##nce -music -lee -not -1977 -1971 -1973 -##per -an -faq -comment -##って -days -##ock -116 -##bs -1974 -1969 -v1 -player -1956 -xbox -sql -fm -f1 -139 -##ah -210 -##lv -##mp -##000 -melody -1957 -##3 -550 -17life -199 -1966 -xml -market -##au -##71 -999 -##04 -what -gl -##95 -##age -tips -##68 -book -##ting -mysql -can -1959 -230 -##ung -wonderland -watch -10℃ -##ction -9000 -mar -mobile -1946 -1962 -article -##db -part -▲top -party -って -1967 -1964 -1948 -##07 -##ore -##op -この -dj -##78 -##38 -010 -main -225 -1965 -##ong -art -320 -ad -134 -020 -##73 -117 -pm2 -japan -228 -##08 -ts -1963 -##ica -der -sm -##36 -2019 -##wa -ct -##7 -##や -##64 -1937 -homemesh -search -##85 -##れは -##tv -##di -macbook -##9 -##くたさい -service -##♥ -type -った -750 -##ier -##si -##75 -##います -##ok -best -##ット -goris -lock -##った -cf -3m -big -##ut -ftp -carol -##vi -10 -1961 -happy -sd -##ac -122 -anti -pe -cnn -iii -1920 -138 -##ラ -1940 -esp -jan -tags -##98 -##51 -august -vol -##86 -154 -##™ -##fs -##れ -##sion -design -ac -##ム -press -jordan -ppp -that -key -check -##6 -##tt -##㎡ -1080p -##lt -power -##42 -1952 -##bc -vivi -##ック -he -133 -121 -jpg -##rry -201 -175 -3500 -1947 -nb -##ted -##rn -しています -1954 -usd -##t00 -master -##ンク -001 -model -##58 -al -##09 -1953 -##34 -ram -goo -ても -##ui -127 -1930 -red -##ary -rpg -item -##pm -##41 -270 -##za -project -##2012 -hot -td -blogabstract -##ger -##62 -650 -##44 -gr2 -##します -##m -black -electronic -nfc -year -asus -また -html5 -cindy -##hd -m3 -132 -esc -##od -booking -##53 -fed -tvb -##81 -##ina -mit -165 -##いる -chan -192 -distribution -next -になる -peter -bios -steam -cm -1941 -にも -pk10 -##ix -##65 -##91 -dec -nasa -##ana -icecat -00z -b1 -will -##46 -li -se -##ji -##み -##ard -oct -##ain -jp -##ze -##bi -cio -##56 -smart -h5 -##39 -##port -curve -vpn -##nm -##dia -utc -##あり -12345678910 -##52 -rmvb -chanel -a4 -miss -##and -##im -media -who -##63 -she -girl -5s -124 -vera -##して -class -vivo -king -##フ -##ei -national -ab -1951 -5cm -888 -145 -ipod -ap -1100 -5mm -211 -ms -2756 -##69 -mp4 -msci -##po -##89 -131 -mg -index -380 -##bit -##out -##zz -##97 -##67 -158 -apec -##8 -photoshop -opec -¥799 -ては -##96 -##tes -##ast -2g -○○ -##ール -¥2899 -##ling -##よ -##ory -1938 -##ical -kitty -content -##43 -step3 -##cn -win8 -155 -vc -1400 -iphone7 -robert -##した -tcl -137 -beauty -##87 -en -dollars -##ys -##oc -step -pay -yy -a1 -##2011 -##lly -##ks -##♪ -1939 -188 -download -1944 -sep -exe -ph -います -school -gb -center -pr -street -##board -uv -##37 -##lan -winrar -##que -##ua -##com -1942 -1936 -480 -gpu -##4 -ettoday -fu -tom -##54 -##ren -##via -149 -##72 -b2b -144 -##79 -##tch -rose -arm -mb -##49 -##ial -##nn -nvidia -step4 -mvp -00㎡ -york -156 -##イ -how -cpi -591 -2765 -gov -kg -joe -##xx -mandy -pa -##ser -copyright -fashion -1935 -don -##け -ecu -##ist -##art -erp -wap -have -##lm -talk -##ek -##ning -##if -ch -##ite -video -1943 -cs -san -iot -look -##84 -##2010 -##ku -october -##ux -trump -##hs -##ide -box -141 -first -##ins -april -##ight -##83 -185 -angel -protected -aa -151 -162 -x1 -m2 -##fe -##× -##ho -size -143 -min -ofo -fun -gomaji -ex -hdmi -food -dns -march -chris -kevin -##のか -##lla -##pp -##ec -ag -ems -6s -720p -##rm -##ham -off -##92 -asp -team -fandom -ed -299 -▌♥ -##ell -info -されています -##82 -sina -4066 -161 -##able -##ctor -330 -399 -315 -dll -rights -ltd -idc -jul -3kg -1927 -142 -ma -surface -##76 -##ク -~~~ -304 -mall -eps -146 -green -##59 -map -space -donald -v2 -sodu -##light -1931 -148 -1700 -まて -310 -reserved -htm -##han -##57 -2d -178 -mod -##ise -##tions -152 -ti -##shi -doc -1933 -icp -055 -wang -##ram -shopping -aug -##pi -##well -now -wam -b2 -からお -##hu -236 -1928 -##gb -266 -f2 -##93 -153 -mix -##ef -##uan -bwl -##plus -##res -core -##ess -tea -5℃ -hktvmall -nhk -##ate -list -##ese -301 -feb -4m -inn -ての -nov -159 -12345 -daniel -##ci -pass -##bet -##nk -coffee -202 -ssl -airbnb -##ute -fbi -woshipm -skype -ea -cg -sp -##fc -##www -yes -edge -alt -007 -##94 -fpga -##ght -##gs -iso9001 -さい -##ile -##wood -##uo -image -lin -icon -american -##em -1932 -set -says -##king -##tive -blogger -##74 -なと -256 -147 -##ox -##zy -##red -##ium -##lf -nokia -claire -##リ -##ding -november -lohas -##500 -##tic -##マ -##cs -##ある -##che -##ire -##gy -##ult -db -january -win -##カ -166 -road -ptt -##ま -##つ -198 -##fa -##mer -anna -pchome -はい -udn -ef -420 -##time -##tte -2030 -##ア -g20 -white -かかります -1929 -308 -garden -eleven -di -##おります -chen -309b -777 -172 -young -cosplay -ちてない -4500 -bat -##123 -##tra -##ては -kindle -npc -steve -etc -##ern -##| -call -xperia -ces -travel -sk -s7 -##ous -1934 -##int -みいたたけます -183 -edu -file -cho -qr -##car -##our -186 -##ant -##d -eric -1914 -rends -##jo -##する -mastercard -##2000 -kb -##min -290 -##ino -vista -##ris -##ud -jack -2400 -##set -169 -pos -1912 -##her -##ou -taipei -しく -205 -beta -##ませんか -232 -##fi -express -255 -body -##ill -aphojoy -user -december -meiki -##ick -tweet -richard -##av -##ᆫ -iphone6 -##dd -ちてすか -views -##mark -321 -pd -##00 -times -##▲ -level -##ash -10g -point -5l -##ome -208 -koreanmall -##ak -george -q2 -206 -wma -tcp -##200 -スタッフ -full -mlb -##lle -##watch -tm -run -179 -911 -smith -business -##und -1919 -color -##tal -222 -171 -##less -moon -4399 -##rl -update -pcb -shop -499 -157 -little -なし -end -##mhz -van -dsp -easy -660 -##house -##key -history -##o -oh -##001 -##hy -##web -oem -let -was -##2009 -##gg -review -##wan -182 -##°c -203 -uc -title -##val -united -233 -2021 -##ons -doi -trivago -overdope -sbs -##ance -##ち -grand -special -573032185 -imf -216 -wx17house -##so -##ーム -audi -##he -london -william -##rp -##ake -science -beach -cfa -amp -ps4 -880 -##800 -##link -##hp -crm -ferragamo -bell -make -##eng -195 -under -zh -photos -2300 -##style -##ント -via -176 -da -##gi -company -i7 -##ray -thomas -370 -ufo -i5 -##max -plc -ben -back -research -8g -173 -mike -##pc -##ッフ -september -189 -##ace -vps -february -167 -pantos -wp -lisa -1921 -★★ -jquery -night -long -offer -##berg -##news -1911 -##いて -ray -fks -wto -せます -over -164 -340 -##all -##rus -1924 -##888 -##works -blogtitle -loftpermalink -##→ -187 -martin -test -ling -km -##め -15000 -fda -v3 -##ja -##ロ -wedding -かある -outlet -family -##ea -をこ -##top -story -##ness -salvatore -##lu -204 -swift -215 -room -している -oracle -##ul -1925 -sam -b2c -week -pi -rock -##のは -##a -##けと -##ean -##300 -##gle -cctv -after -chinese -##back -powered -x2 -##tan -1918 -##nes -##イン -canon -only -181 -##zi -##las -say -##oe -184 -##sd -221 -##bot -##world -##zo -sky -made -top100 -just -1926 -pmi -802 -234 -gap -##vr -177 -les -174 -▲topoct -ball -vogue -vi -ing -ofweek -cos -##list -##ort -▲topmay -##なら -##lon -として -last -##tc -##of -##bus -##gen -real -eva -##コ -a3 -nas -##lie -##ria -##coin -##bt -▲topapr -his -212 -cat -nata -vive -health -⋯⋯ -drive -sir -▲topmar -du -cup -##カー -##ook -##よう -##sy -alex -msg -tour -しました -3ce -##word -193 -ebooks -r8 -block -318 -##より -2200 -nice -pvp -207 -months -1905 -rewards -##ther -1917 -0800 -##xi -##チ -##sc -micro -850 -gg -blogfp -op -1922 -daily -m1 -264 -true -##bb -ml -##tar -##のお -##ky -anthony -196 -253 -##yo -state -218 -##ara -##aa -##rc -##tz -##ston -より -gear -##eo -##ade -ge -see -1923 -##win -##ura -ss -heart -##den -##ita -down -##sm -el -png -2100 -610 -rakuten -whatsapp -bay -dream -add -##use -680 -311 -pad -gucci -mpv -##ode -##fo -island -▲topjun -##▼ -223 -jason -214 -chicago -##❤ -しの -##hone -io -##れる -##ことか -sogo -be2 -##ology -990 -cloud -vcd -##con -2~3 -##ford -##joy -##kb -##こさいます -##rade -but -##ach -docker -##ful -rfid -ul -##ase -hit -ford -##star -580 -##○ -11 -a2 -sdk -reading -edited -##are -cmos -##mc -238 -siri -light -##ella -##ため -bloomberg -##read -pizza -##ison -jimmy -##vm -college -node -journal -ba -18k -##play -245 -##cer -20 -magic -##yu -191 -jump -288 -tt -##ings -asr -##lia -3200 -step5 -network -##cd -mc -いします -1234 -pixstyleme -273 -##600 -2800 -money -★★★★★ -1280 -12 -430 -bl -みの -act -##tus -tokyo -##rial -##life -emba -##ae -saas -tcs -##rk -##wang -summer -##sp -ko -##ving -390 -premium -##その -netflix -##ヒ -uk -mt -##lton -right -frank -two -209 -える -##ple -##cal -021 -##んな -##sen -##ville -hold -nexus -dd -##ius -てお -##mah -##なく -tila -zero -820 -ce -##tin -resort -##ws -charles -old -p10 -5d -report -##360 -##ru -##には -bus -vans -lt -##est -pv -##レ -links -rebecca -##ツ -##dm -azure -##365 -きな -limited -bit -4gb -##mon -1910 -moto -##eam -213 -1913 -var -eos -なとの -226 -blogspot -された -699 -e3 -dos -dm -fc -##ments -##ik -##kw -boy -##bin -##ata -960 -er -##せ -219 -##vin -##tu -##ula -194 -##∥ -station -##ろ -##ature -835 -files -zara -hdr -top10 -nature -950 -magazine -s6 -marriott -##シ -avira -case -##っと -tab -##ran -tony -##home -oculus -im -##ral -jean -saint -cry -307 -rosie -##force -##ini -ice -##bert -のある -##nder -##mber -pet -2600 -##◆ -plurk -▲topdec -##sis -00kg -▲topnov -720 -##ence -tim -##ω -##nc -##ても -##name -log -ips -great -ikea -malaysia -unix -##イト -3600 -##ncy -##nie -12000 -akb48 -##ye -##oid -404 -##chi -##いた -oa -xuehai -##1000 -##orm -##rf -275 -さん -##ware -##リー -980 -ho -##pro -text -##era -560 -bob -227 -##ub -##2008 -8891 -scp -avi -##zen -2022 -mi -wu -museum -qvod -apache -lake -jcb -▲topaug -★★★ -ni -##hr -hill -302 -ne -weibo -490 -ruby -##ーシ -##ヶ -##row -4d -▲topjul -iv -##ish -github -306 -mate -312 -##スト -##lot -##ane -andrew -のハイト -##tina -t1 -rf -ed2k -##vel -##900 -way -final -りの -ns -5a -705 -197 -##メ -sweet -bytes -##ene -▲topjan -231 -##cker -##2007 -##px -100g -topapp -229 -helpapp -rs -low -14k -g4g -care -630 -ldquo -あり -##fork -leave -rm -edition -##gan -##zon -##qq -▲topsep -##google -##ism -gold -224 -explorer -##zer -toyota -category -select -visual -##labels -restaurant -##md -posts -s1 -##ico -もっと -angelababy -123456 -217 -sports -s3 -mbc -1915 -してくたさい -shell -x86 -candy -##new -kbs -face -xl -470 -##here -4a -swissinfo -v8 -▲topfeb -dram -##ual -##vice -3a -##wer -sport -q1 -ios10 -public -int -card -##c -ep -au -rt -##れた -1080 -bill -##mll -kim -30 -460 -wan -##uk -##ミ -x3 -298 -0t -scott -##ming -239 -e5 -##3d -h7n9 -worldcat -brown -##あります -##vo -##led -##580 -##ax -249 -410 -##ert -paris -##~6 -polo -925 -##lr -599 -##ナ -capital -##hing -bank -cv -1g -##chat -##s -##たい -adc -##ule -2m -##e -digital -hotmail -268 -##pad -870 -bbq -quot -##ring -before -wali -##まて -mcu -2k -2b -という -costco -316 -north -333 -switch -##city -##p -philips -##mann -management -panasonic -##cl -##vd -##ping -##rge -alice -##lk -##ましょう -css3 -##ney -vision -alpha -##ular -##400 -##tter -lz -にお -##ありません -mode -gre -1916 -pci -##tm -237 -1~2 -##yan -##そ -について -##let -##キ -work -war -coach -ah -mary -##ᅵ -huang -##pt -a8 -pt -follow -##berry -1895 -##ew -a5 -ghost -##ション -##wn -##og -south -##code -girls -##rid -action -villa -git -r11 -table -games -##cket -error -##anonymoussaid -##ag -here -##ame -##gc -qa -##■ -##lis -gmp -##gin -vmalife -##cher -yu -wedding -##tis -demo -dragon -530 -soho -social -bye -##rant -river -orz -acer -325 -##↑ -##ース -##ats -261 -del -##ven -440 -ups -##ように -##ター -305 -value -macd -yougou -##dn -661 -##ano -ll -##urt -##rent -continue -script -##wen -##ect -paper -263 -319 -shift -##chel -##フト -##cat -258 -x5 -fox -243 -##さん -car -aaa -##blog -loading -##yn -##tp -kuso -799 -si -sns -イカせるテンマ -ヒンクテンマ3 -rmb -vdc -forest -central -prime -help -ultra -##rmb -##ような -241 -square -688 -##しい -のないフロクに -##field -##reen -##ors -##ju -c1 -start -510 -##air -##map -cdn -##wo -cba -stephen -m8 -100km -##get -opera -##base -##ood -vsa -com™ -##aw -##ail -251 -なのて -count -t2 -##ᅡ -##een -2700 -hop -##gp -vsc -tree -##eg -##ose -816 -285 -##ories -##shop -alphago -v4 -1909 -simon -##ᆼ -fluke62max -zip -スホンサー -##sta -louis -cr -bas -##~10 -bc -##yer -hadoop -##ube -##wi -1906 -0755 -hola -##low -place -centre -5v -d3 -##fer -252 -##750 -##media -281 -540 -0l -exchange -262 -series -##ハー -##san -eb -##bank -##k -q3 -##nge -##mail -take -##lp -259 -1888 -client -east -cache -event -vincent -##ールを -きを -##nse -sui -855 -adchoice -##и -##stry -##なたの -246 -##zone -ga -apps -sea -##ab -248 -cisco -##タ -##rner -kymco -##care -dha -##pu -##yi -minkoff -royal -p1 -への -annie -269 -collection -kpi -playstation -257 -になります -866 -bh -##bar -queen -505 -radio -1904 -andy -armani -##xy -manager -iherb -##ery -##share -spring -raid -johnson -1908 -##ob -volvo -hall -##ball -v6 -our -taylor -##hk -bi -242 -##cp -kate -bo -water -technology -##rie -サイトは -277 -##ona -##sl -hpv -303 -gtx -hip -rdquo -jayz -stone -##lex -##rum -namespace -##やり -620 -##ale -##atic -des -##erson -##ql -##ves -##type -enter -##この -##てきます -d2 -##168 -##mix -##bian -との -a9 -jj -ky -##lc -access -movie -##hc -リストに -tower -##ration -##mit -ます -##nch -ua -tel -prefix -##o2 -1907 -##point -1901 -ott -~10 -##http -##ury -baidu -##ink -member -##logy -bigbang -nownews -##js -##shot -##tb -##こと -247 -eba -##tics -##lus -ける -v5 -spark -##ama -there -##ions -god -##lls -##down -hiv -##ress -burberry -day2 -##kv -◆◆ -jeff -related -film -edit -joseph -283 -##ark -cx -32gb -order -g9 -30000 -##ans -##tty -s5 -##bee -かあります -thread -xr -buy -sh -005 -land -spotify -mx -##ari -276 -##verse -×email -sf -why -##ことて -244 -7headlines -nego -sunny -dom -exo -401 -666 -positioning -fit -rgb -##tton -278 -kiss -alexa -adam -lp -みリストを -##g -mp -##ties -##llow -amy -##du -np -002 -institute -271 -##rth -##lar -2345 -590 -##des -sidebar -15 -imax -site -##cky -##kit -##ime -##009 -season -323 -##fun -##ンター -##ひ -gogoro -a7 -pu -lily -fire -twd600 -##ッセーシを -いて -##vis -30ml -##cture -##をお -information -##オ -close -friday -##くれる -yi -nick -てすか -##tta -##tel -6500 -##lock -cbd -economy -254 -かお -267 -tinker -double -375 -8gb -voice -##app -oops -channel -today -985 -##right -raw -xyz -##+ -jim -edm -##cent -7500 -supreme -814 -ds -##its -##asia -dropbox -##てすか -##tti -books -272 -100ml -##tle -##ller -##ken -##more -##boy -sex -309 -##dom -t3 -##ider -##なります -##unch -1903 -810 -feel -5500 -##かった -##put -により -s2 -mo -##gh -men -ka -amoled -div -##tr -##n1 -port -howard -##tags -ken -dnf -##nus -adsense -##а -ide -##へ -buff -thunder -##town -##ique -has -##body -auto -pin -##erry -tee -てした -295 -number -##the -##013 -object -psp -cool -udnbkk -16gb -##mic -miui -##tro -most -r2 -##alk -##nity -1880 -±0 -##いました -428 -s4 -law -version -##oa -n1 -sgs -docomo -##tf -##ack -henry -fc2 -##ded -##sco -##014 -##rite -286 -0mm -linkedin -##ada -##now -wii -##ndy -ucbug -##◎ -sputniknews -legalminer -##ika -##xp -2gb -##bu -q10 -oo -b6 -come -##rman -cheese -ming -maker -##gm -nikon -##fig -ppi -kelly -##ります -jchere -てきます -ted -md -003 -fgo -tech -##tto -dan -soc -##gl -##len -hair -earth -640 -521 -img -##pper -##a1 -##てきる -##ロク -acca -##ition -##ference -suite -##ig -outlook -##mond -##cation -398 -##pr -279 -101vip -358 -##999 -282 -64gb -3800 -345 -airport -##over -284 -##おり -jones -##ith -lab -##su -##いるのて -co2 -town -piece -##llo -no1 -vmware -24h -##qi -focus -reader -##admin -##ora -tb -false -##log -1898 -know -lan -838 -##ces -f4 -##ume -motel -stop -##oper -na -flickr -netcomponents -##af -##─ -pose -williams -local -##ound -##cg -##site -##iko -いお -274 -5m -gsm -con -##ath -1902 -friends -##hip -cell -317 -##rey -780 -cream -##cks -012 -##dp -facebooktwitterpinterestgoogle -sso -324 -shtml -song -swiss -##mw -##キンク -lumia -xdd -string -tiffany -522 -marc -られた -insee -russell -sc -dell -##ations -ok -camera -289 -##vs -##flow -##late -classic -287 -##nter -stay -g1 -mtv -512 -##ever -##lab -##nger -qe -sata -ryan -d1 -50ml -cms -##cing -su -292 -3300 -editor -296 -##nap -security -sunday -association -##ens -##700 -##bra -acg -##かり -sofascore -とは -mkv -##ign -jonathan -gary -build -labels -##oto -tesla -moba -qi -gohappy -general -ajax -1024 -##かる -サイト -society -##test -##urs -wps -fedora -##ich -mozilla -328 -##480 -##dr -usa -urn -##lina -##r -grace -##die -##try -##ader -1250 -##なり -elle -570 -##chen -##ᆯ -price -##ten -uhz -##ough -eq -##hen -states -push -session -balance -wow -506 -##cus -##py -when -##ward -##ep -34e -wong -library -prada -##サイト -##cle -running -##ree -313 -ck -date -q4 -##ctive -##ool -##> -mk -##ira -##163 -388 -die -secret -rq -dota -buffet -は1ヶ -e6 -##ez -pan -368 -ha -##card -##cha -2a -##さ -alan -day3 -eye -f3 -##end -france -keep -adi -rna -tvbs -##ala -solo -nova -##え -##tail -##ょう -support -##ries -##なる -##ved -base -copy -iis -fps -##ways -hero -hgih -profile -fish -mu -ssh -entertainment -chang -##wd -click -cake -##ond -pre -##tom -kic -pixel -##ov -##fl -product -6a -##pd -dear -##gate -es -yumi -audio -##² -##sky -echo -bin -where -##ture -329 -##ape -find -sap -isis -##なと -nand -##101 -##load -##ream -band -a6 -525 -never -##post -festival -50cm -##we -555 -guide -314 -zenfone -##ike -335 -gd -forum -jessica -strong -alexander -##ould -software -allen -##ious -program -360° -else -lohasthree -##gar -することかてきます -please -##れます -rc -##ggle -##ric -bim -50000 -##own -eclipse -355 -brian -3ds -##side -061 -361 -##other -##ける -##tech -##ator -485 -engine -##ged -##t -plaza -##fit -cia -ngo -westbrook -shi -tbs -50mm -##みませんか -sci -291 -reuters -##ily -contextlink -##hn -af -##cil -bridge -very -##cel -1890 -cambridge -##ize -15g -##aid -##data -790 -frm -##head -award -butler -##sun -meta -##mar -america -ps3 -puma -pmid -##すか -lc -670 -kitchen -##lic -オーフン5 -きなしソフトサーヒス -そして -day1 -future -★★★★ -##text -##page -##rris -pm1 -##ket -fans -##っています -1001 -christian -bot -kids -trackback -##hai -c3 -display -##hl -n2 -1896 -idea -さんも -##sent -airmail -##ug -##men -pwm -けます -028 -##lution -369 -852 -awards -schemas -354 -asics -wikipedia -font -##tional -##vy -c2 -293 -##れている -##dget -##ein -っている -contact -pepper -スキル -339 -##~5 -294 -##uel -##ument -730 -##hang -みてす -q5 -##sue -rain -##ndi -wei -swatch -##cept -わせ -331 -popular -##ste -##tag -p2 -501 -trc -1899 -##west -##live -justin -honda -ping -messenger -##rap -v9 -543 -##とは -unity -appqq -はすへて -025 -leo -##tone -##テ -##ass -uniqlo -##010 -502 -her -jane -memory -moneydj -##tical -human -12306 -していると -##m2 -coc -miacare -##mn -tmt -##core -vim -kk -##may -fan -target -use -too -338 -435 -2050 -867 -737 -fast -##2c -services -##ope -omega -energy -##わ -pinkoi -1a -##なから -##rain -jackson -##ement -##シャンルの -374 -366 -そんな -p9 -rd -##ᆨ -1111 -##tier -##vic -zone -##│ -385 -690 -dl -isofix -cpa -m4 -322 -kimi -めて -davis -##lay -lulu -##uck -050 -weeks -qs -##hop -920 -##n -ae -##ear -~5 -eia -405 -##fly -korea -jpeg -boost -##ship -small -##リア -1860 -eur -297 -425 -valley -##iel -simple -##ude -rn -k2 -##ena -されます -non -patrick -しているから -##ナー -feed -5757 -30g -process -well -qqmei -##thing -they -aws -lu -pink -##ters -##kin -または -board -##vertisement -wine -##ien -unicode -##dge -r1 -359 -##tant -いを -##twitter -##3c -cool1 -される -##れて -##l -isp -##012 -standard -45㎡2 -402 -##150 -matt -##fu -326 -##iner -googlemsn -pixnetfacebookyahoo -##ラン -x7 -886 -##uce -メーカー -sao -##ev -##きました -##file -9678 -403 -xddd -shirt -6l -##rio -##hat -3mm -givenchy -ya -bang -##lio -monday -crystal -ロクイン -##abc -336 -head -890 -ubuntuforumwikilinuxpastechat -##vc -##~20 -##rity -cnc -7866 -ipv6 -null -1897 -##ost -yang -imsean -tiger -##fet -##ンス -352 -##= -dji -327 -ji -maria -##come -##んて -foundation -3100 -##beth -##なった -1m -601 -active -##aft -##don -3p -sr -349 -emma -##khz -living -415 -353 -1889 -341 -709 -457 -sas -x6 -##face -pptv -x4 -##mate -han -sophie -##jing -337 -fifa -##mand -other -sale -inwedding -##gn -てきちゃいます -##mmy -##pmlast -bad -nana -nbc -してみてくたさいね -なとはお -##wu -##かあります -##あ -note7 -single -##340 -せからこ -してくたさい♪この -しにはとんとんワークケートを -するとあなたにもっとマッチした -ならワークケートへ -もみつかっちゃうかも -ワークケートの -##bel -window -##dio -##ht -union -age -382 -14 -##ivity -##y -コメント -domain -neo -##isa -##lter -5k -f5 -steven -##cts -powerpoint -tft -self -g2 -ft -##テル -zol -##act -mwc -381 -343 -もう -nbapop -408 -てある -eds -ace -##room -previous -author -tomtom -il -##ets -hu -financial -☆☆☆ -っています -bp -5t -chi -1gb -##hg -fairmont -cross -008 -gay -h2 -function -##けて -356 -also -1b -625 -##ータ -##raph -1894 -3~5 -##ils -i3 -334 -avenue -##host -による -##bon -##tsu -message -navigation -50g -fintech -h6 -##ことを -8cm -##ject -##vas -##firm -credit -##wf -xxxx -form -##nor -##space -huawei -plan -json -sbl -##dc -machine -921 -392 -wish -##120 -##sol -windows7 -edward -##ために -development -washington -##nsis -lo -818 -##sio -##ym -##bor -planet -##~8 -##wt -ieee -gpa -##めて -camp -ann -gm -##tw -##oka -connect -##rss -##work -##atus -wall -chicken -soul -2mm -##times -fa -##ather -##cord -009 -##eep -hitachi -gui -harry -##pan -e1 -disney -##press -##ーション -wind -386 -frigidaire -##tl -liu -hsu -332 -basic -von -ev -いた -てきる -スホンサーサイト -learning -##ull -expedia -archives -change -##wei -santa -cut -ins -6gb -turbo -brand -cf1 -508 -004 -return -747 -##rip -h1 -##nis -##をこ -128gb -##にお -3t -application -しており -emc -rx -##oon -384 -quick -412 -15058 -wilson -wing -chapter -##bug -beyond -##cms -##dar -##oh -zoom -e2 -trip -sb -##nba -rcep -342 -aspx -ci -080 -gc -gnu -める -##count -advanced -dance -dv -##url -##ging -367 -8591 -am09 -shadow -battle -346 -##i -##cia -##という -emily -##のてす -##tation -host -ff -techorz -sars -##mini -##mporary -##ering -nc -4200 -798 -##next -cma -##mbps -##gas -##ift -##dot -##ィ -455 -##~17 -amana -##りの -426 -##ros -ir -00㎡1 -##eet -##ible -##↓ -710 -ˋ▽ˊ -##aka -dcs -iq -##v -l1 -##lor -maggie -##011 -##iu -588 -##~1 -830 -##gt -1tb -articles -create -##burg -##iki -database -fantasy -##rex -##cam -dlc -dean -##you -hard -path -gaming -victoria -maps -cb -##lee -##itor -overchicstoretvhome -systems -##xt -416 -p3 -sarah -760 -##nan -407 -486 -x9 -install -second -626 -##ann -##ph -##rcle -##nic -860 -##nar -ec -##とう -768 -metro -chocolate -##rian -~4 -##table -##しています -skin -##sn -395 -mountain -##0mm -inparadise -6m -7x24 -ib -4800 -##jia -eeworld -creative -g5 -g3 -357 -parker -ecfa -village -からの -18000 -sylvia -サーヒス -hbl -##ques -##onsored -##x2 -##きます -##v4 -##tein -ie6 -383 -##stack -389 -ver -##ads -##baby -sound -bbe -##110 -##lone -##uid -ads -022 -gundam -351 -thinkpad -006 -scrum -match -##ave -mems -##470 -##oy -##なりました -##talk -glass -lamigo -span -##eme -job -##a5 -jay -wade -kde -498 -##lace -ocean -tvg -##covery -##r3 -##ners -##rea -junior -think -##aine -cover -##ision -##sia -↓↓ -##bow -msi -413 -458 -406 -##love -711 -801 -soft -z2 -##pl -456 -1840 -mobil -mind -##uy -427 -nginx -##oi -めた -##rr -6221 -##mple -##sson -##ーシてす -371 -##nts -91tv -comhd -crv3000 -##uard -1868 -397 -deep -lost -field -gallery -##bia -rate -spf -redis -traction -930 -icloud -011 -なら -fe -jose -372 -##tory -into -sohu -fx -899 -379 -kicstart2 -##hia -すく -##~3 -##sit -ra -24 -##walk -##xure -500g -##pact -pacific -xa -natural -carlo -##250 -##walker -1850 -##can -cto -gigi -516 -##サー -pen -##hoo -ob -matlab -##b -##yy -13913459 -##iti -mango -##bbs -sense -c5 -oxford -##ニア -walker -jennifer -##ola -course -##bre -701 -##pus -##rder -lucky -075 -##ぁ -ivy -なお -##nia -sotheby -side -##ugh -joy -##orage -##ush -##bat -##dt -364 -r9 -##2d -##gio -511 -country -wear -##lax -##~7 -##moon -393 -seven -study -411 -348 -lonzo -8k -##ェ -evolution -##イフ -##kk -gs -kd -##レス -arduino -344 -b12 -##lux -arpg -##rdon -cook -##x5 -dark -five -##als -##ida -とても -sign -362 -##ちの -something -20mm -##nda -387 -##posted -fresh -tf -1870 -422 -cam -##mine -##skip -##form -##ssion -education -394 -##tee -dyson -stage -##jie -want -##night -epson -pack -あります -##ppy -テリヘル -##█ -wd -##eh -##rence -left -##lvin -golden -mhz -discovery -##trix -##n2 -loft -##uch -##dra -##sse -speed -~1 -1mdb -sorry -welcome -##urn -wave -gaga -##lmer -teddy -##160 -トラックハック -せよ -611 -##f2016 -378 -rp -##sha -rar -##あなたに -##きた -840 -holiday -##ュー -373 -074 -##vg -##nos -##rail -gartner -gi -6p -##dium -kit -488 -b3 -eco -##ろう -20g -sean -##stone -autocad -nu -##np -f16 -write -029 -m5 -##ias -images -atp -##dk -fsm -504 -1350 -ve -52kb -##xxx -##のに -##cake -414 -unit -lim -ru -1v -##ification -published -angela -16g -analytics -ak -##q -##nel -gmt -##icon -again -##₂ -##bby -ios11 -445 -かこさいます -waze -いてす -##ハ -9985 -##ust -##ティー -framework -##007 -iptv -delete -52sykb -cl -wwdc -027 -30cm -##fw -##ての -1389 -##xon -brandt -##ses -##dragon -tc -vetements -anne -monte -modern -official -##へて -##ere -##nne -##oud -もちろん -50 -etnews -##a2 -##graphy -421 -863 -##ちゃん -444 -##rtex -##てお -l2 -##gma -mount -ccd -たと -archive -morning -tan -ddos -e7 -##ホ -day4 -##ウ -gis -453 -its -495 -factory -bruce -pg -##ito -ってくたさい -guest -cdma -##lling -536 -n3 -しかし -3~4 -mega -eyes -ro -13 -women -dac -church -##jun -singapore -##facebook -6991 -starbucks -##tos -##stin -##shine -zen -##mu -tina -20℃ -1893 -##たけて -503 -465 -request -##gence -qt -##っ -1886 -347 -363 -q7 -##zzi -diary -##tore -409 -##ead -468 -cst -##osa -canada -agent -va -##jiang -##ちは -##ーク -##lam -sg -##nix -##sday -##よって -g6 -##master -bing -##zl -charlie -16 -8mm -nb40 -##ーン -thai -##ルフ -ln284ct -##itz -##2f -bonnie -##food -##lent -originals -##stro -##lts -418 -∟∣ -##bscribe -children -ntd -yesstyle -##かも -hmv -##tment -d5 -2cm -arts -sms -##pn -##я -##いい -topios9 -539 -lifestyle -virtual -##ague -xz -##deo -muji -024 -unt -##nnis -##ᅩ -faq1 -1884 -396 -##ette -fly -64㎡ -はしめまして -441 -curry -##pop -のこ -release -##← -##◆◆ -##cast -073 -ありな -500ml -##ews -5c -##stle -ios7 -##ima -787 -dog -lenovo -##r4 -roger -013 -cbs -vornado -100m -417 -##desk -##クok -##ald -1867 -9595 -2900 -##van -oil -##x -some -break -common -##jy -##lines -g7 -twice -419 -ella -nano -belle -にこ -##mes -##self -##note -jb -##ことかてきます -benz -##との -##ova -451 -save -##wing -##ますのて -kai -りは -##hua -##rect -rainer -##unge -448 -##0m -adsl -##かな -guestname -##uma -##kins -##zu -tokichoi -##price -county -##med -##mus -rmk -391 -address -vm -えて -openload -##group -##hin -##iginal -amg -urban -##oz -jobs -emi -##public -beautiful -##sch -album -##dden -##bell -jerry -works -hostel -miller -##drive -##rmin -##10 -376 -boot -828 -##370 -##fx -##cm~ -1885 -##nome -##ctionary -##oman -##lish -##cr -##hm -433 -##how -432 -francis -xi -c919 -b5 -evernote -##uc -vga -##3000 -coupe -##urg -##cca -##uality -019 -6g -れる -multi -##また -##ett -em -hey -##ani -##tax -##rma -inside -than -740 -leonnhurt -##jin -ict -れた -bird -notes -200mm -くの -##dical -##lli -result -442 -iu -ee -438 -smap -gopro -##last -yin -pure -998 -32g -けた -5kg -##dan -##rame -mama -##oot -bean -marketing -##hur -2l -bella -sync -xuite -##ground -515 -discuz -##getrelax -##ince -##bay -##5s -cj -##イス -gmat -apt -##pass -jing -##rix -c4 -rich -##とても -niusnews -##ello -bag -770 -##eting -##mobile -18 -culture -015 -##のてすか -377 -1020 -area -##ience -616 -details -gp -universal -silver -dit -はお -private -ddd -u11 -kanshu -##ified -fung -##nny -dx -##520 -tai -475 -023 -##fr -##lean -3s -##pin -429 -##rin -25000 -ly -rick -##bility -usb3 -banner -##baru -##gion -metal -dt -vdf -1871 -karl -qualcomm -bear -1010 -oldid -ian -jo -##tors -population -##ernel -1882 -mmorpg -##mv -##bike -603 -##© -ww -friend -##ager -exhibition -##del -##pods -fpx -structure -##free -##tings -kl -##rley -##copyright -##mma -california -3400 -orange -yoga -4l -canmake -honey -##anda -##コメント -595 -nikkie -##ルハイト -dhl -publishing -##mall -##gnet -20cm -513 -##クセス -##┅ -e88 -970 -##dog -fishbase -##! -##" -### -##$ -##% -##& -##' -##( -##) -##* -##+ -##, -##- -##. -##/ -##: -##; -##< -##= -##> -##? -##@ -##[ -##\ -##] -##^ -##_ -##{ -##| -##} -##~ -##£ -##¤ -##¥ -##§ -##« -##± -##³ -##µ -##· -##¹ -##º -##» -##¼ -##ß -##æ -##÷ -##ø -##đ -##ŋ -##ɔ -##ə -##ɡ -##ʰ -##ˇ -##ˈ -##ˊ -##ˋ -##ˍ -##ː -##˙ -##˚ -##ˢ -##α -##β -##γ -##δ -##ε -##η -##θ -##ι -##κ -##λ -##μ -##ν -##ο -##π -##ρ -##ς -##σ -##τ -##υ -##φ -##χ -##ψ -##б -##в -##г -##д -##е -##ж -##з -##к -##л -##м -##н -##о -##п -##р -##с -##т -##у -##ф -##х -##ц -##ч -##ш -##ы -##ь -##і -##ا -##ب -##ة -##ت -##د -##ر -##س -##ع -##ل -##م -##ن -##ه -##و -##ي -##۩ -##ก -##ง -##น -##ม -##ย -##ร -##อ -##า -##เ -##๑ -##་ -##ღ -##ᄀ -##ᄁ -##ᄂ -##ᄃ -##ᄅ -##ᄆ -##ᄇ -##ᄈ -##ᄉ -##ᄋ -##ᄌ -##ᄎ -##ᄏ -##ᄐ -##ᄑ -##ᄒ -##ᅢ -##ᅣ -##ᅥ -##ᅦ -##ᅧ -##ᅨ -##ᅪ -##ᅬ -##ᅭ -##ᅮ -##ᅯ -##ᅲ -##ᅳ -##ᅴ -##ᆷ -##ᆸ -##ᆺ -##ᆻ -##ᗜ -##ᵃ -##ᵉ -##ᵍ -##ᵏ -##ᵐ -##ᵒ -##ᵘ -##‖ -##„ -##† -##• -##‥ -##‧ -##
 -##‰ -##′ -##″ -##‹ -##› -##※ -##‿ -##⁄ -##ⁱ -##⁺ -##ⁿ -##₁ -##₃ -##₄ -##€ -##№ -##ⅰ -##ⅱ -##ⅲ -##ⅳ -##ⅴ -##↔ -##↗ -##↘ -##⇒ -##∀ -##− -##∕ -##∙ -##√ -##∞ -##∟ -##∠ -##∣ -##∩ -##∮ -##∶ -##∼ -##∽ -##≈ -##≒ -##≡ -##≤ -##≥ -##≦ -##≧ -##≪ -##≫ -##⊙ -##⋅ -##⋈ -##⋯ -##⌒ -##① -##② -##③ -##④ -##⑤ -##⑥ -##⑦ -##⑧ -##⑨ -##⑩ -##⑴ -##⑵ -##⑶ -##⑷ -##⑸ -##⒈ -##⒉ -##⒊ -##⒋ -##ⓒ -##ⓔ -##ⓘ -##━ -##┃ -##┆ -##┊ -##┌ -##└ -##├ -##┣ -##═ -##║ -##╚ -##╞ -##╠ -##╭ -##╮ -##╯ -##╰ -##╱ -##╳ -##▂ -##▃ -##▅ -##▇ -##▉ -##▋ -##▌ -##▍ -##▎ -##□ -##▪ -##▫ -##▬ -##△ -##▶ -##► -##▽ -##◇ -##◕ -##◠ -##◢ -##◤ -##☀ -##☕ -##☞ -##☺ -##☼ -##♀ -##♂ -##♠ -##♡ -##♣ -##♦ -##♫ -##♬ -##✈ -##✔ -##✕ -##✖ -##✦ -##✨ -##✪ -##✰ -##✿ -##❀ -##➜ -##➤ -##⦿ -##、 -##。 -##〃 -##々 -##〇 -##〈 -##〉 -##《 -##》 -##「 -##」 -##『 -##』 -##【 -##】 -##〓 -##〔 -##〕 -##〖 -##〗 -##〜 -##〝 -##〞 -##ぃ -##ぇ -##ぬ -##ふ -##ほ -##む -##ゃ -##ゅ -##ゆ -##ょ -##゜ -##ゝ -##ァ -##ゥ -##エ -##ォ -##ケ -##サ -##セ -##ソ -##ッ -##ニ -##ヌ -##ネ -##ノ -##ヘ -##モ -##ャ -##ヤ -##ュ -##ユ -##ョ -##ヨ -##ワ -##ヲ -##・ -##ヽ -##ㄅ -##ㄆ -##ㄇ -##ㄉ -##ㄋ -##ㄌ -##ㄍ -##ㄎ -##ㄏ -##ㄒ -##ㄚ -##ㄛ -##ㄞ -##ㄟ -##ㄢ -##ㄤ -##ㄥ -##ㄧ -##ㄨ -##ㆍ -##㈦ -##㊣ -##㗎 -##一 -##丁 -##七 -##万 -##丈 -##三 -##上 -##下 -##不 -##与 -##丐 -##丑 -##专 -##且 -##丕 -##世 -##丘 -##丙 -##业 -##丛 -##东 -##丝 -##丞 -##丟 -##両 -##丢 -##两 -##严 -##並 -##丧 -##丨 -##个 -##丫 -##中 -##丰 -##串 -##临 -##丶 -##丸 -##丹 -##为 -##主 -##丼 -##丽 -##举 -##丿 -##乂 -##乃 -##久 -##么 -##义 -##之 -##乌 -##乍 -##乎 -##乏 -##乐 -##乒 -##乓 -##乔 -##乖 -##乗 -##乘 -##乙 -##乜 -##九 -##乞 -##也 -##习 -##乡 -##书 -##乩 -##买 -##乱 -##乳 -##乾 -##亀 -##亂 -##了 -##予 -##争 -##事 -##二 -##于 -##亏 -##云 -##互 -##五 -##井 -##亘 -##亙 -##亚 -##些 -##亜 -##亞 -##亟 -##亡 -##亢 -##交 -##亥 -##亦 -##产 -##亨 -##亩 -##享 -##京 -##亭 -##亮 -##亲 -##亳 -##亵 -##人 -##亿 -##什 -##仁 -##仃 -##仄 -##仅 -##仆 -##仇 -##今 -##介 -##仍 -##从 -##仏 -##仑 -##仓 -##仔 -##仕 -##他 -##仗 -##付 -##仙 -##仝 -##仞 -##仟 -##代 -##令 -##以 -##仨 -##仪 -##们 -##仮 -##仰 -##仲 -##件 -##价 -##任 -##份 -##仿 -##企 -##伉 -##伊 -##伍 -##伎 -##伏 -##伐 -##休 -##伕 -##众 -##优 -##伙 -##会 -##伝 -##伞 -##伟 -##传 -##伢 -##伤 -##伦 -##伪 -##伫 -##伯 -##估 -##伴 -##伶 -##伸 -##伺 -##似 -##伽 -##佃 -##但 -##佇 -##佈 -##位 -##低 -##住 -##佐 -##佑 -##体 -##佔 -##何 -##佗 -##佘 -##余 -##佚 -##佛 -##作 -##佝 -##佞 -##佟 -##你 -##佢 -##佣 -##佤 -##佥 -##佩 -##佬 -##佯 -##佰 -##佳 -##併 -##佶 -##佻 -##佼 -##使 -##侃 -##侄 -##來 -##侈 -##例 -##侍 -##侏 -##侑 -##侖 -##侗 -##供 -##依 -##侠 -##価 -##侣 -##侥 -##侦 -##侧 -##侨 -##侬 -##侮 -##侯 -##侵 -##侶 -##侷 -##便 -##係 -##促 -##俄 -##俊 -##俎 -##俏 -##俐 -##俑 -##俗 -##俘 -##俚 -##保 -##俞 -##俟 -##俠 -##信 -##俨 -##俩 -##俪 -##俬 -##俭 -##修 -##俯 -##俱 -##俳 -##俸 -##俺 -##俾 -##倆 -##倉 -##個 -##倌 -##倍 -##倏 -##們 -##倒 -##倔 -##倖 -##倘 -##候 -##倚 -##倜 -##借 -##倡 -##値 -##倦 -##倩 -##倪 -##倫 -##倬 -##倭 -##倶 -##债 -##值 -##倾 -##偃 -##假 -##偈 -##偉 -##偌 -##偎 -##偏 -##偕 -##做 -##停 -##健 -##側 -##偵 -##偶 -##偷 -##偻 -##偽 -##偿 -##傀 -##傅 -##傍 -##傑 -##傘 -##備 -##傚 -##傢 -##傣 -##傥 -##储 -##傩 -##催 -##傭 -##傲 -##傳 -##債 -##傷 -##傻 -##傾 -##僅 -##働 -##像 -##僑 -##僕 -##僖 -##僚 -##僥 -##僧 -##僭 -##僮 -##僱 -##僵 -##價 -##僻 -##儀 -##儂 -##億 -##儆 -##儉 -##儋 -##儒 -##儕 -##儘 -##償 -##儡 -##優 -##儲 -##儷 -##儼 -##儿 -##兀 -##允 -##元 -##兄 -##充 -##兆 -##兇 -##先 -##光 -##克 -##兌 -##免 -##児 -##兑 -##兒 -##兔 -##兖 -##党 -##兜 -##兢 -##入 -##內 -##全 -##兩 -##八 -##公 -##六 -##兮 -##兰 -##共 -##兲 -##关 -##兴 -##兵 -##其 -##具 -##典 -##兹 -##养 -##兼 -##兽 -##冀 -##内 -##円 -##冇 -##冈 -##冉 -##冊 -##册 -##再 -##冏 -##冒 -##冕 -##冗 -##写 -##军 -##农 -##冠 -##冢 -##冤 -##冥 -##冨 -##冪 -##冬 -##冯 -##冰 -##冲 -##决 -##况 -##冶 -##冷 -##冻 -##冼 -##冽 -##冾 -##净 -##凄 -##准 -##凇 -##凈 -##凉 -##凋 -##凌 -##凍 -##减 -##凑 -##凛 -##凜 -##凝 -##几 -##凡 -##凤 -##処 -##凪 -##凭 -##凯 -##凰 -##凱 -##凳 -##凶 -##凸 -##凹 -##出 -##击 -##函 -##凿 -##刀 -##刁 -##刃 -##分 -##切 -##刈 -##刊 -##刍 -##刎 -##刑 -##划 -##列 -##刘 -##则 -##刚 -##创 -##初 -##删 -##判 -##別 -##刨 -##利 -##刪 -##别 -##刮 -##到 -##制 -##刷 -##券 -##刹 -##刺 -##刻 -##刽 -##剁 -##剂 -##剃 -##則 -##剉 -##削 -##剋 -##剌 -##前 -##剎 -##剐 -##剑 -##剔 -##剖 -##剛 -##剜 -##剝 -##剣 -##剤 -##剥 -##剧 -##剩 -##剪 -##副 -##割 -##創 -##剷 -##剽 -##剿 -##劃 -##劇 -##劈 -##劉 -##劊 -##劍 -##劏 -##劑 -##力 -##劝 -##办 -##功 -##加 -##务 -##劣 -##动 -##助 -##努 -##劫 -##劭 -##励 -##劲 -##劳 -##労 -##劵 -##効 -##劾 -##势 -##勁 -##勃 -##勇 -##勉 -##勋 -##勐 -##勒 -##動 -##勖 -##勘 -##務 -##勛 -##勝 -##勞 -##募 -##勢 -##勤 -##勧 -##勳 -##勵 -##勸 -##勺 -##勻 -##勾 -##勿 -##匀 -##包 -##匆 -##匈 -##匍 -##匐 -##匕 -##化 -##北 -##匙 -##匝 -##匠 -##匡 -##匣 -##匪 -##匮 -##匯 -##匱 -##匹 -##区 -##医 -##匾 -##匿 -##區 -##十 -##千 -##卅 -##升 -##午 -##卉 -##半 -##卍 -##华 -##协 -##卑 -##卒 -##卓 -##協 -##单 -##卖 -##南 -##単 -##博 -##卜 -##卞 -##卟 -##占 -##卡 -##卢 -##卤 -##卦 -##卧 -##卫 -##卮 -##卯 -##印 -##危 -##即 -##却 -##卵 -##卷 -##卸 -##卻 -##卿 -##厂 -##厄 -##厅 -##历 -##厉 -##压 -##厌 -##厕 -##厘 -##厚 -##厝 -##原 -##厢 -##厥 -##厦 -##厨 -##厩 -##厭 -##厮 -##厲 -##厳 -##去 -##县 -##叁 -##参 -##參 -##又 -##叉 -##及 -##友 -##双 -##反 -##収 -##发 -##叔 -##取 -##受 -##变 -##叙 -##叛 -##叟 -##叠 -##叡 -##叢 -##口 -##古 -##句 -##另 -##叨 -##叩 -##只 -##叫 -##召 -##叭 -##叮 -##可 -##台 -##叱 -##史 -##右 -##叵 -##叶 -##号 -##司 -##叹 -##叻 -##叼 -##叽 -##吁 -##吃 -##各 -##吆 -##合 -##吉 -##吊 -##吋 -##同 -##名 -##后 -##吏 -##吐 -##向 -##吒 -##吓 -##吕 -##吖 -##吗 -##君 -##吝 -##吞 -##吟 -##吠 -##吡 -##否 -##吧 -##吨 -##吩 -##含 -##听 -##吭 -##吮 -##启 -##吱 -##吳 -##吴 -##吵 -##吶 -##吸 -##吹 -##吻 -##吼 -##吽 -##吾 -##呀 -##呂 -##呃 -##呆 -##呈 -##告 -##呋 -##呎 -##呐 -##呓 -##呕 -##呗 -##员 -##呛 -##呜 -##呢 -##呤 -##呦 -##周 -##呱 -##呲 -##味 -##呵 -##呷 -##呸 -##呻 -##呼 -##命 -##咀 -##咁 -##咂 -##咄 -##咆 -##咋 -##和 -##咎 -##咏 -##咐 -##咒 -##咔 -##咕 -##咖 -##咗 -##咘 -##咙 -##咚 -##咛 -##咣 -##咤 -##咦 -##咧 -##咨 -##咩 -##咪 -##咫 -##咬 -##咭 -##咯 -##咱 -##咲 -##咳 -##咸 -##咻 -##咽 -##咿 -##哀 -##品 -##哂 -##哄 -##哆 -##哇 -##哈 -##哉 -##哋 -##哌 -##响 -##哎 -##哏 -##哐 -##哑 -##哒 -##哔 -##哗 -##哟 -##員 -##哥 -##哦 -##哧 -##哨 -##哩 -##哪 -##哭 -##哮 -##哲 -##哺 -##哼 -##哽 -##唁 -##唄 -##唆 -##唇 -##唉 -##唏 -##唐 -##唑 -##唔 -##唠 -##唤 -##唧 -##唬 -##售 -##唯 -##唰 -##唱 -##唳 -##唷 -##唸 -##唾 -##啃 -##啄 -##商 -##啉 -##啊 -##問 -##啓 -##啕 -##啖 -##啜 -##啞 -##啟 -##啡 -##啤 -##啥 -##啦 -##啧 -##啪 -##啫 -##啬 -##啮 -##啰 -##啱 -##啲 -##啵 -##啶 -##啷 -##啸 -##啻 -##啼 -##啾 -##喀 -##喂 -##喃 -##善 -##喆 -##喇 -##喉 -##喊 -##喋 -##喎 -##喏 -##喔 -##喘 -##喙 -##喚 -##喜 -##喝 -##喟 -##喧 -##喪 -##喫 -##喬 -##單 -##喰 -##喱 -##喲 -##喳 -##喵 -##営 -##喷 -##喹 -##喺 -##喻 -##喽 -##嗅 -##嗆 -##嗇 -##嗎 -##嗑 -##嗒 -##嗓 -##嗔 -##嗖 -##嗚 -##嗜 -##嗝 -##嗟 -##嗡 -##嗣 -##嗤 -##嗦 -##嗨 -##嗪 -##嗬 -##嗯 -##嗰 -##嗲 -##嗳 -##嗶 -##嗷 -##嗽 -##嘀 -##嘅 -##嘆 -##嘈 -##嘉 -##嘌 -##嘍 -##嘎 -##嘔 -##嘖 -##嘗 -##嘘 -##嘚 -##嘛 -##嘜 -##嘞 -##嘟 -##嘢 -##嘣 -##嘤 -##嘧 -##嘩 -##嘭 -##嘮 -##嘯 -##嘰 -##嘱 -##嘲 -##嘴 -##嘶 -##嘸 -##嘹 -##嘻 -##嘿 -##噁 -##噌 -##噎 -##噓 -##噔 -##噗 -##噙 -##噜 -##噠 -##噢 -##噤 -##器 -##噩 -##噪 -##噬 -##噱 -##噴 -##噶 -##噸 -##噹 -##噻 -##噼 -##嚀 -##嚇 -##嚎 -##嚏 -##嚐 -##嚓 -##嚕 -##嚟 -##嚣 -##嚥 -##嚨 -##嚮 -##嚴 -##嚷 -##嚼 -##囂 -##囉 -##囊 -##囍 -##囑 -##囔 -##囗 -##囚 -##四 -##囝 -##回 -##囟 -##因 -##囡 -##团 -##団 -##囤 -##囧 -##囪 -##囫 -##园 -##困 -##囱 -##囲 -##図 -##围 -##囹 -##固 -##国 -##图 -##囿 -##圃 -##圄 -##圆 -##圈 -##國 -##圍 -##圏 -##園 -##圓 -##圖 -##團 -##圜 -##土 -##圣 -##圧 -##在 -##圩 -##圭 -##地 -##圳 -##场 -##圻 -##圾 -##址 -##坂 -##均 -##坊 -##坍 -##坎 -##坏 -##坐 -##坑 -##块 -##坚 -##坛 -##坝 -##坞 -##坟 -##坠 -##坡 -##坤 -##坦 -##坨 -##坪 -##坯 -##坳 -##坵 -##坷 -##垂 -##垃 -##垄 -##型 -##垒 -##垚 -##垛 -##垠 -##垢 -##垣 -##垦 -##垩 -##垫 -##垭 -##垮 -##垵 -##埂 -##埃 -##埋 -##城 -##埔 -##埕 -##埗 -##域 -##埠 -##埤 -##埵 -##執 -##埸 -##培 -##基 -##埼 -##堀 -##堂 -##堃 -##堅 -##堆 -##堇 -##堑 -##堕 -##堙 -##堡 -##堤 -##堪 -##堯 -##堰 -##報 -##場 -##堵 -##堺 -##堿 -##塊 -##塌 -##塑 -##塔 -##塗 -##塘 -##塚 -##塞 -##塢 -##塩 -##填 -##塬 -##塭 -##塵 -##塾 -##墀 -##境 -##墅 -##墉 -##墊 -##墒 -##墓 -##増 -##墘 -##墙 -##墜 -##增 -##墟 -##墨 -##墩 -##墮 -##墳 -##墻 -##墾 -##壁 -##壅 -##壆 -##壇 -##壊 -##壑 -##壓 -##壕 -##壘 -##壞 -##壟 -##壢 -##壤 -##壩 -##士 -##壬 -##壮 -##壯 -##声 -##売 -##壳 -##壶 -##壹 -##壺 -##壽 -##处 -##备 -##変 -##复 -##夏 -##夔 -##夕 -##外 -##夙 -##多 -##夜 -##够 -##夠 -##夢 -##夥 -##大 -##天 -##太 -##夫 -##夭 -##央 -##夯 -##失 -##头 -##夷 -##夸 -##夹 -##夺 -##夾 -##奂 -##奄 -##奇 -##奈 -##奉 -##奋 -##奎 -##奏 -##奐 -##契 -##奔 -##奕 -##奖 -##套 -##奘 -##奚 -##奠 -##奢 -##奥 -##奧 -##奪 -##奬 -##奮 -##女 -##奴 -##奶 -##奸 -##她 -##好 -##如 -##妃 -##妄 -##妆 -##妇 -##妈 -##妊 -##妍 -##妒 -##妓 -##妖 -##妘 -##妙 -##妝 -##妞 -##妣 -##妤 -##妥 -##妨 -##妩 -##妪 -##妮 -##妲 -##妳 -##妹 -##妻 -##妾 -##姆 -##姉 -##姊 -##始 -##姍 -##姐 -##姑 -##姒 -##姓 -##委 -##姗 -##姚 -##姜 -##姝 -##姣 -##姥 -##姦 -##姨 -##姪 -##姫 -##姬 -##姹 -##姻 -##姿 -##威 -##娃 -##娄 -##娅 -##娆 -##娇 -##娉 -##娑 -##娓 -##娘 -##娛 -##娜 -##娟 -##娠 -##娣 -##娥 -##娩 -##娱 -##娲 -##娴 -##娶 -##娼 -##婀 -##婁 -##婆 -##婉 -##婊 -##婕 -##婚 -##婢 -##婦 -##婧 -##婪 -##婭 -##婴 -##婵 -##婶 -##婷 -##婺 -##婿 -##媒 -##媚 -##媛 -##媞 -##媧 -##媲 -##媳 -##媽 -##媾 -##嫁 -##嫂 -##嫉 -##嫌 -##嫑 -##嫔 -##嫖 -##嫘 -##嫚 -##嫡 -##嫣 -##嫦 -##嫩 -##嫲 -##嫵 -##嫻 -##嬅 -##嬉 -##嬌 -##嬗 -##嬛 -##嬢 -##嬤 -##嬪 -##嬰 -##嬴 -##嬷 -##嬸 -##嬿 -##孀 -##孃 -##子 -##孑 -##孔 -##孕 -##孖 -##字 -##存 -##孙 -##孚 -##孛 -##孜 -##孝 -##孟 -##孢 -##季 -##孤 -##学 -##孩 -##孪 -##孫 -##孬 -##孰 -##孱 -##孳 -##孵 -##學 -##孺 -##孽 -##孿 -##宁 -##它 -##宅 -##宇 -##守 -##安 -##宋 -##完 -##宏 -##宓 -##宕 -##宗 -##官 -##宙 -##定 -##宛 -##宜 -##宝 -##实 -##実 -##宠 -##审 -##客 -##宣 -##室 -##宥 -##宦 -##宪 -##宫 -##宮 -##宰 -##害 -##宴 -##宵 -##家 -##宸 -##容 -##宽 -##宾 -##宿 -##寂 -##寄 -##寅 -##密 -##寇 -##富 -##寐 -##寒 -##寓 -##寛 -##寝 -##寞 -##察 -##寡 -##寢 -##寥 -##實 -##寧 -##寨 -##審 -##寫 -##寬 -##寮 -##寰 -##寵 -##寶 -##寸 -##对 -##寺 -##寻 -##导 -##対 -##寿 -##封 -##専 -##射 -##将 -##將 -##專 -##尉 -##尊 -##尋 -##對 -##導 -##小 -##少 -##尔 -##尕 -##尖 -##尘 -##尚 -##尝 -##尤 -##尧 -##尬 -##就 -##尴 -##尷 -##尸 -##尹 -##尺 -##尻 -##尼 -##尽 -##尾 -##尿 -##局 -##屁 -##层 -##屄 -##居 -##屆 -##屈 -##屉 -##届 -##屋 -##屌 -##屍 -##屎 -##屏 -##屐 -##屑 -##展 -##屜 -##属 -##屠 -##屡 -##屢 -##層 -##履 -##屬 -##屯 -##山 -##屹 -##屿 -##岀 -##岁 -##岂 -##岌 -##岐 -##岑 -##岔 -##岖 -##岗 -##岘 -##岙 -##岚 -##岛 -##岡 -##岩 -##岫 -##岬 -##岭 -##岱 -##岳 -##岷 -##岸 -##峇 -##峋 -##峒 -##峙 -##峡 -##峤 -##峥 -##峦 -##峨 -##峪 -##峭 -##峯 -##峰 -##峴 -##島 -##峻 -##峽 -##崁 -##崂 -##崆 -##崇 -##崎 -##崑 -##崔 -##崖 -##崗 -##崙 -##崛 -##崧 -##崩 -##崭 -##崴 -##崽 -##嵇 -##嵊 -##嵋 -##嵌 -##嵐 -##嵘 -##嵩 -##嵬 -##嵯 -##嶂 -##嶄 -##嶇 -##嶋 -##嶙 -##嶺 -##嶼 -##嶽 -##巅 -##巍 -##巒 -##巔 -##巖 -##川 -##州 -##巡 -##巢 -##工 -##左 -##巧 -##巨 -##巩 -##巫 -##差 -##己 -##已 -##巳 -##巴 -##巷 -##巻 -##巽 -##巾 -##巿 -##币 -##市 -##布 -##帅 -##帆 -##师 -##希 -##帐 -##帑 -##帕 -##帖 -##帘 -##帚 -##帛 -##帜 -##帝 -##帥 -##带 -##帧 -##師 -##席 -##帮 -##帯 -##帰 -##帳 -##帶 -##帷 -##常 -##帼 -##帽 -##幀 -##幂 -##幄 -##幅 -##幌 -##幔 -##幕 -##幟 -##幡 -##幢 -##幣 -##幫 -##干 -##平 -##年 -##并 -##幸 -##幹 -##幺 -##幻 -##幼 -##幽 -##幾 -##广 -##庁 -##広 -##庄 -##庆 -##庇 -##床 -##序 -##庐 -##库 -##应 -##底 -##庖 -##店 -##庙 -##庚 -##府 -##庞 -##废 -##庠 -##度 -##座 -##庫 -##庭 -##庵 -##庶 -##康 -##庸 -##庹 -##庾 -##廁 -##廂 -##廃 -##廈 -##廉 -##廊 -##廓 -##廖 -##廚 -##廝 -##廟 -##廠 -##廢 -##廣 -##廬 -##廳 -##延 -##廷 -##建 -##廿 -##开 -##弁 -##异 -##弃 -##弄 -##弈 -##弊 -##弋 -##式 -##弑 -##弒 -##弓 -##弔 -##引 -##弗 -##弘 -##弛 -##弟 -##张 -##弥 -##弦 -##弧 -##弩 -##弭 -##弯 -##弱 -##張 -##強 -##弹 -##强 -##弼 -##弾 -##彅 -##彆 -##彈 -##彌 -##彎 -##归 -##当 -##录 -##彗 -##彙 -##彝 -##形 -##彤 -##彥 -##彦 -##彧 -##彩 -##彪 -##彫 -##彬 -##彭 -##彰 -##影 -##彷 -##役 -##彻 -##彼 -##彿 -##往 -##征 -##径 -##待 -##徇 -##很 -##徉 -##徊 -##律 -##後 -##徐 -##徑 -##徒 -##従 -##徕 -##得 -##徘 -##徙 -##徜 -##從 -##徠 -##御 -##徨 -##復 -##循 -##徬 -##微 -##徳 -##徴 -##徵 -##德 -##徹 -##徼 -##徽 -##心 -##必 -##忆 -##忌 -##忍 -##忏 -##忐 -##忑 -##忒 -##忖 -##志 -##忘 -##忙 -##応 -##忠 -##忡 -##忤 -##忧 -##忪 -##快 -##忱 -##念 -##忻 -##忽 -##忿 -##怀 -##态 -##怂 -##怅 -##怆 -##怎 -##怏 -##怒 -##怔 -##怕 -##怖 -##怙 -##怜 -##思 -##怠 -##怡 -##急 -##怦 -##性 -##怨 -##怪 -##怯 -##怵 -##总 -##怼 -##恁 -##恃 -##恆 -##恋 -##恍 -##恐 -##恒 -##恕 -##恙 -##恚 -##恢 -##恣 -##恤 -##恥 -##恨 -##恩 -##恪 -##恫 -##恬 -##恭 -##息 -##恰 -##恳 -##恵 -##恶 -##恸 -##恺 -##恻 -##恼 -##恿 -##悄 -##悅 -##悉 -##悌 -##悍 -##悔 -##悖 -##悚 -##悟 -##悠 -##患 -##悦 -##您 -##悩 -##悪 -##悬 -##悯 -##悱 -##悲 -##悴 -##悵 -##悶 -##悸 -##悻 -##悼 -##悽 -##情 -##惆 -##惇 -##惊 -##惋 -##惑 -##惕 -##惘 -##惚 -##惜 -##惟 -##惠 -##惡 -##惦 -##惧 -##惨 -##惩 -##惫 -##惬 -##惭 -##惮 -##惯 -##惰 -##惱 -##想 -##惴 -##惶 -##惹 -##惺 -##愁 -##愆 -##愈 -##愉 -##愍 -##意 -##愕 -##愚 -##愛 -##愜 -##感 -##愣 -##愤 -##愧 -##愫 -##愷 -##愿 -##慄 -##慈 -##態 -##慌 -##慎 -##慑 -##慕 -##慘 -##慚 -##慟 -##慢 -##慣 -##慧 -##慨 -##慫 -##慮 -##慰 -##慳 -##慵 -##慶 -##慷 -##慾 -##憂 -##憊 -##憋 -##憎 -##憐 -##憑 -##憔 -##憚 -##憤 -##憧 -##憨 -##憩 -##憫 -##憬 -##憲 -##憶 -##憾 -##懂 -##懇 -##懈 -##應 -##懊 -##懋 -##懑 -##懒 -##懦 -##懲 -##懵 -##懶 -##懷 -##懸 -##懺 -##懼 -##懾 -##懿 -##戀 -##戈 -##戊 -##戌 -##戍 -##戎 -##戏 -##成 -##我 -##戒 -##戕 -##或 -##战 -##戚 -##戛 -##戟 -##戡 -##戦 -##截 -##戬 -##戮 -##戰 -##戲 -##戳 -##戴 -##戶 -##户 -##戸 -##戻 -##戾 -##房 -##所 -##扁 -##扇 -##扈 -##扉 -##手 -##才 -##扎 -##扑 -##扒 -##打 -##扔 -##払 -##托 -##扛 -##扣 -##扦 -##执 -##扩 -##扪 -##扫 -##扬 -##扭 -##扮 -##扯 -##扰 -##扱 -##扳 -##扶 -##批 -##扼 -##找 -##承 -##技 -##抄 -##抉 -##把 -##抑 -##抒 -##抓 -##投 -##抖 -##抗 -##折 -##抚 -##抛 -##抜 -##択 -##抟 -##抠 -##抡 -##抢 -##护 -##报 -##抨 -##披 -##抬 -##抱 -##抵 -##抹 -##押 -##抽 -##抿 -##拂 -##拄 -##担 -##拆 -##拇 -##拈 -##拉 -##拋 -##拌 -##拍 -##拎 -##拐 -##拒 -##拓 -##拔 -##拖 -##拗 -##拘 -##拙 -##拚 -##招 -##拜 -##拟 -##拡 -##拢 -##拣 -##拥 -##拦 -##拧 -##拨 -##择 -##括 -##拭 -##拮 -##拯 -##拱 -##拳 -##拴 -##拷 -##拼 -##拽 -##拾 -##拿 -##持 -##挂 -##指 -##挈 -##按 -##挎 -##挑 -##挖 -##挙 -##挚 -##挛 -##挝 -##挞 -##挟 -##挠 -##挡 -##挣 -##挤 -##挥 -##挨 -##挪 -##挫 -##振 -##挲 -##挹 -##挺 -##挽 -##挾 -##捂 -##捅 -##捆 -##捉 -##捋 -##捌 -##捍 -##捎 -##捏 -##捐 -##捕 -##捞 -##损 -##捡 -##换 -##捣 -##捧 -##捨 -##捩 -##据 -##捱 -##捲 -##捶 -##捷 -##捺 -##捻 -##掀 -##掂 -##掃 -##掇 -##授 -##掉 -##掌 -##掏 -##掐 -##排 -##掖 -##掘 -##掙 -##掛 -##掠 -##採 -##探 -##掣 -##接 -##控 -##推 -##掩 -##措 -##掬 -##掰 -##掲 -##掳 -##掴 -##掷 -##掸 -##掺 -##揀 -##揃 -##揄 -##揆 -##揉 -##揍 -##描 -##提 -##插 -##揖 -##揚 -##換 -##握 -##揣 -##揩 -##揪 -##揭 -##揮 -##援 -##揶 -##揸 -##揹 -##揽 -##搀 -##搁 -##搂 -##搅 -##損 -##搏 -##搐 -##搓 -##搔 -##搖 -##搗 -##搜 -##搞 -##搡 -##搪 -##搬 -##搭 -##搵 -##搶 -##携 -##搽 -##摀 -##摁 -##摄 -##摆 -##摇 -##摈 -##摊 -##摒 -##摔 -##摘 -##摞 -##摟 -##摧 -##摩 -##摯 -##摳 -##摸 -##摹 -##摺 -##摻 -##撂 -##撃 -##撅 -##撇 -##撈 -##撐 -##撑 -##撒 -##撓 -##撕 -##撚 -##撞 -##撤 -##撥 -##撩 -##撫 -##撬 -##播 -##撮 -##撰 -##撲 -##撵 -##撷 -##撸 -##撻 -##撼 -##撿 -##擀 -##擁 -##擂 -##擄 -##擅 -##擇 -##擊 -##擋 -##操 -##擎 -##擒 -##擔 -##擘 -##據 -##擞 -##擠 -##擡 -##擢 -##擦 -##擬 -##擰 -##擱 -##擲 -##擴 -##擷 -##擺 -##擼 -##擾 -##攀 -##攏 -##攒 -##攔 -##攘 -##攙 -##攜 -##攝 -##攞 -##攢 -##攣 -##攤 -##攥 -##攪 -##攫 -##攬 -##支 -##收 -##攸 -##改 -##攻 -##放 -##政 -##故 -##效 -##敌 -##敍 -##敎 -##敏 -##救 -##敕 -##敖 -##敗 -##敘 -##教 -##敛 -##敝 -##敞 -##敢 -##散 -##敦 -##敬 -##数 -##敲 -##整 -##敵 -##敷 -##數 -##斂 -##斃 -##文 -##斋 -##斌 -##斎 -##斐 -##斑 -##斓 -##斗 -##料 -##斛 -##斜 -##斟 -##斡 -##斤 -##斥 -##斧 -##斩 -##斫 -##斬 -##断 -##斯 -##新 -##斷 -##方 -##於 -##施 -##旁 -##旃 -##旅 -##旋 -##旌 -##旎 -##族 -##旖 -##旗 -##无 -##既 -##日 -##旦 -##旧 -##旨 -##早 -##旬 -##旭 -##旮 -##旱 -##时 -##旷 -##旺 -##旻 -##昀 -##昂 -##昆 -##昇 -##昉 -##昊 -##昌 -##明 -##昏 -##易 -##昔 -##昕 -##昙 -##星 -##映 -##春 -##昧 -##昨 -##昭 -##是 -##昱 -##昴 -##昵 -##昶 -##昼 -##显 -##晁 -##時 -##晃 -##晉 -##晋 -##晌 -##晏 -##晒 -##晓 -##晔 -##晕 -##晖 -##晗 -##晚 -##晝 -##晞 -##晟 -##晤 -##晦 -##晨 -##晩 -##普 -##景 -##晰 -##晴 -##晶 -##晷 -##智 -##晾 -##暂 -##暄 -##暇 -##暈 -##暉 -##暌 -##暐 -##暑 -##暖 -##暗 -##暝 -##暢 -##暧 -##暨 -##暫 -##暮 -##暱 -##暴 -##暸 -##暹 -##曄 -##曆 -##曇 -##曉 -##曖 -##曙 -##曜 -##曝 -##曠 -##曦 -##曬 -##曰 -##曲 -##曳 -##更 -##書 -##曹 -##曼 -##曾 -##替 -##最 -##會 -##月 -##有 -##朋 -##服 -##朐 -##朔 -##朕 -##朗 -##望 -##朝 -##期 -##朦 -##朧 -##木 -##未 -##末 -##本 -##札 -##朮 -##术 -##朱 -##朴 -##朵 -##机 -##朽 -##杀 -##杂 -##权 -##杆 -##杈 -##杉 -##李 -##杏 -##材 -##村 -##杓 -##杖 -##杜 -##杞 -##束 -##杠 -##条 -##来 -##杨 -##杭 -##杯 -##杰 -##東 -##杳 -##杵 -##杷 -##杼 -##松 -##板 -##极 -##构 -##枇 -##枉 -##枋 -##析 -##枕 -##林 -##枚 -##果 -##枝 -##枢 -##枣 -##枪 -##枫 -##枭 -##枯 -##枰 -##枱 -##枳 -##架 -##枷 -##枸 -##柄 -##柏 -##某 -##柑 -##柒 -##染 -##柔 -##柘 -##柚 -##柜 -##柞 -##柠 -##柢 -##查 -##柩 -##柬 -##柯 -##柱 -##柳 -##柴 -##柵 -##査 -##柿 -##栀 -##栃 -##栄 -##栅 -##标 -##栈 -##栉 -##栋 -##栎 -##栏 -##树 -##栓 -##栖 -##栗 -##校 -##栩 -##株 -##样 -##核 -##根 -##格 -##栽 -##栾 -##桀 -##桁 -##桂 -##桃 -##桅 -##框 -##案 -##桉 -##桌 -##桎 -##桐 -##桑 -##桓 -##桔 -##桜 -##桠 -##桡 -##桢 -##档 -##桥 -##桦 -##桧 -##桨 -##桩 -##桶 -##桿 -##梁 -##梅 -##梆 -##梏 -##梓 -##梗 -##條 -##梟 -##梢 -##梦 -##梧 -##梨 -##梭 -##梯 -##械 -##梳 -##梵 -##梶 -##检 -##棂 -##棄 -##棉 -##棋 -##棍 -##棒 -##棕 -##棗 -##棘 -##棚 -##棟 -##棠 -##棣 -##棧 -##森 -##棱 -##棲 -##棵 -##棹 -##棺 -##椁 -##椅 -##椋 -##植 -##椎 -##椒 -##検 -##椪 -##椭 -##椰 -##椹 -##椽 -##椿 -##楂 -##楊 -##楓 -##楔 -##楚 -##楝 -##楞 -##楠 -##楣 -##楨 -##楫 -##業 -##楮 -##極 -##楷 -##楸 -##楹 -##楼 -##楽 -##概 -##榄 -##榆 -##榈 -##榉 -##榔 -##榕 -##榖 -##榛 -##榜 -##榨 -##榫 -##榭 -##榮 -##榱 -##榴 -##榷 -##榻 -##槁 -##槃 -##構 -##槌 -##槍 -##槎 -##槐 -##槓 -##様 -##槛 -##槟 -##槤 -##槭 -##槲 -##槳 -##槻 -##槽 -##槿 -##樁 -##樂 -##樊 -##樑 -##樓 -##標 -##樞 -##樟 -##模 -##樣 -##権 -##横 -##樫 -##樯 -##樱 -##樵 -##樸 -##樹 -##樺 -##樽 -##樾 -##橄 -##橇 -##橋 -##橐 -##橘 -##橙 -##機 -##橡 -##橢 -##橫 -##橱 -##橹 -##橼 -##檀 -##檄 -##檎 -##檐 -##檔 -##檗 -##檜 -##檢 -##檬 -##檯 -##檳 -##檸 -##檻 -##櫃 -##櫚 -##櫛 -##櫥 -##櫸 -##櫻 -##欄 -##權 -##欒 -##欖 -##欠 -##次 -##欢 -##欣 -##欧 -##欲 -##欸 -##欺 -##欽 -##款 -##歆 -##歇 -##歉 -##歌 -##歎 -##歐 -##歓 -##歙 -##歛 -##歡 -##止 -##正 -##此 -##步 -##武 -##歧 -##歩 -##歪 -##歯 -##歲 -##歳 -##歴 -##歷 -##歸 -##歹 -##死 -##歼 -##殁 -##殃 -##殆 -##殇 -##殉 -##殊 -##残 -##殒 -##殓 -##殖 -##殘 -##殞 -##殡 -##殤 -##殭 -##殯 -##殲 -##殴 -##段 -##殷 -##殺 -##殼 -##殿 -##毀 -##毁 -##毂 -##毅 -##毆 -##毋 -##母 -##毎 -##每 -##毒 -##毓 -##比 -##毕 -##毗 -##毘 -##毙 -##毛 -##毡 -##毫 -##毯 -##毽 -##氈 -##氏 -##氐 -##民 -##氓 -##气 -##氖 -##気 -##氙 -##氛 -##氟 -##氡 -##氢 -##氣 -##氤 -##氦 -##氧 -##氨 -##氪 -##氫 -##氮 -##氯 -##氰 -##氲 -##水 -##氷 -##永 -##氹 -##氾 -##汀 -##汁 -##求 -##汆 -##汇 -##汉 -##汎 -##汐 -##汕 -##汗 -##汙 -##汛 -##汝 -##汞 -##江 -##池 -##污 -##汤 -##汨 -##汩 -##汪 -##汰 -##汲 -##汴 -##汶 -##汹 -##決 -##汽 -##汾 -##沁 -##沂 -##沃 -##沅 -##沈 -##沉 -##沌 -##沏 -##沐 -##沒 -##沓 -##沖 -##沙 -##沛 -##沟 -##没 -##沢 -##沣 -##沥 -##沦 -##沧 -##沪 -##沫 -##沭 -##沮 -##沱 -##河 -##沸 -##油 -##治 -##沼 -##沽 -##沾 -##沿 -##況 -##泄 -##泉 -##泊 -##泌 -##泓 -##法 -##泗 -##泛 -##泞 -##泠 -##泡 -##波 -##泣 -##泥 -##注 -##泪 -##泫 -##泮 -##泯 -##泰 -##泱 -##泳 -##泵 -##泷 -##泸 -##泻 -##泼 -##泽 -##泾 -##洁 -##洄 -##洋 -##洒 -##洗 -##洙 -##洛 -##洞 -##津 -##洩 -##洪 -##洮 -##洱 -##洲 -##洵 -##洶 -##洸 -##洹 -##活 -##洼 -##洽 -##派 -##流 -##浃 -##浄 -##浅 -##浆 -##浇 -##浊 -##测 -##济 -##浏 -##浑 -##浒 -##浓 -##浔 -##浙 -##浚 -##浜 -##浣 -##浦 -##浩 -##浪 -##浬 -##浮 -##浯 -##浴 -##海 -##浸 -##涂 -##涅 -##涇 -##消 -##涉 -##涌 -##涎 -##涓 -##涔 -##涕 -##涙 -##涛 -##涝 -##涞 -##涟 -##涠 -##涡 -##涣 -##涤 -##润 -##涧 -##涨 -##涩 -##涪 -##涮 -##涯 -##液 -##涵 -##涸 -##涼 -##涿 -##淀 -##淄 -##淅 -##淆 -##淇 -##淋 -##淌 -##淑 -##淒 -##淖 -##淘 -##淙 -##淚 -##淞 -##淡 -##淤 -##淦 -##淨 -##淩 -##淪 -##淫 -##淬 -##淮 -##深 -##淳 -##淵 -##混 -##淹 -##淺 -##添 -##淼 -##清 -##済 -##渉 -##渊 -##渋 -##渍 -##渎 -##渐 -##渔 -##渗 -##渙 -##渚 -##減 -##渝 -##渠 -##渡 -##渣 -##渤 -##渥 -##渦 -##温 -##測 -##渭 -##港 -##渲 -##渴 -##游 -##渺 -##渾 -##湃 -##湄 -##湊 -##湍 -##湖 -##湘 -##湛 -##湟 -##湧 -##湫 -##湮 -##湯 -##湳 -##湾 -##湿 -##満 -##溃 -##溅 -##溉 -##溏 -##源 -##準 -##溜 -##溝 -##溟 -##溢 -##溥 -##溧 -##溪 -##溫 -##溯 -##溱 -##溴 -##溶 -##溺 -##溼 -##滁 -##滂 -##滄 -##滅 -##滇 -##滋 -##滌 -##滑 -##滓 -##滔 -##滕 -##滙 -##滚 -##滝 -##滞 -##滟 -##满 -##滢 -##滤 -##滥 -##滦 -##滨 -##滩 -##滬 -##滯 -##滲 -##滴 -##滷 -##滸 -##滾 -##滿 -##漁 -##漂 -##漆 -##漉 -##漏 -##漓 -##演 -##漕 -##漠 -##漢 -##漣 -##漩 -##漪 -##漫 -##漬 -##漯 -##漱 -##漲 -##漳 -##漸 -##漾 -##漿 -##潆 -##潇 -##潋 -##潍 -##潑 -##潔 -##潘 -##潛 -##潜 -##潞 -##潟 -##潢 -##潤 -##潦 -##潧 -##潭 -##潮 -##潰 -##潴 -##潸 -##潺 -##潼 -##澀 -##澄 -##澆 -##澈 -##澍 -##澎 -##澗 -##澜 -##澡 -##澤 -##澧 -##澱 -##澳 -##澹 -##激 -##濁 -##濂 -##濃 -##濑 -##濒 -##濕 -##濘 -##濛 -##濟 -##濠 -##濡 -##濤 -##濫 -##濬 -##濮 -##濯 -##濱 -##濺 -##濾 -##瀅 -##瀆 -##瀉 -##瀋 -##瀏 -##瀑 -##瀕 -##瀘 -##瀚 -##瀛 -##瀝 -##瀞 -##瀟 -##瀧 -##瀨 -##瀬 -##瀰 -##瀾 -##灌 -##灏 -##灑 -##灘 -##灝 -##灞 -##灣 -##火 -##灬 -##灭 -##灯 -##灰 -##灵 -##灶 -##灸 -##灼 -##災 -##灾 -##灿 -##炀 -##炁 -##炅 -##炉 -##炊 -##炎 -##炒 -##炔 -##炕 -##炖 -##炙 -##炜 -##炫 -##炬 -##炭 -##炮 -##炯 -##炳 -##炷 -##炸 -##点 -##為 -##炼 -##炽 -##烁 -##烂 -##烃 -##烈 -##烊 -##烏 -##烘 -##烙 -##烛 -##烟 -##烤 -##烦 -##烧 -##烨 -##烩 -##烫 -##烬 -##热 -##烯 -##烷 -##烹 -##烽 -##焉 -##焊 -##焕 -##焖 -##焗 -##焘 -##焙 -##焚 -##焜 -##無 -##焦 -##焯 -##焰 -##焱 -##然 -##焼 -##煅 -##煉 -##煊 -##煌 -##煎 -##煒 -##煖 -##煙 -##煜 -##煞 -##煤 -##煥 -##煦 -##照 -##煨 -##煩 -##煮 -##煲 -##煸 -##煽 -##熄 -##熊 -##熏 -##熒 -##熔 -##熙 -##熟 -##熠 -##熨 -##熬 -##熱 -##熵 -##熹 -##熾 -##燁 -##燃 -##燄 -##燈 -##燉 -##燊 -##燎 -##燒 -##燔 -##燕 -##燙 -##燜 -##營 -##燥 -##燦 -##燧 -##燭 -##燮 -##燴 -##燻 -##燼 -##燿 -##爆 -##爍 -##爐 -##爛 -##爪 -##爬 -##爭 -##爰 -##爱 -##爲 -##爵 -##父 -##爷 -##爸 -##爹 -##爺 -##爻 -##爽 -##爾 -##牆 -##片 -##版 -##牌 -##牍 -##牒 -##牙 -##牛 -##牝 -##牟 -##牠 -##牡 -##牢 -##牦 -##牧 -##物 -##牯 -##牲 -##牴 -##牵 -##特 -##牺 -##牽 -##犀 -##犁 -##犄 -##犊 -##犍 -##犒 -##犢 -##犧 -##犬 -##犯 -##状 -##犷 -##犸 -##犹 -##狀 -##狂 -##狄 -##狈 -##狎 -##狐 -##狒 -##狗 -##狙 -##狞 -##狠 -##狡 -##狩 -##独 -##狭 -##狮 -##狰 -##狱 -##狸 -##狹 -##狼 -##狽 -##猎 -##猕 -##猖 -##猗 -##猙 -##猛 -##猜 -##猝 -##猥 -##猩 -##猪 -##猫 -##猬 -##献 -##猴 -##猶 -##猷 -##猾 -##猿 -##獄 -##獅 -##獎 -##獐 -##獒 -##獗 -##獠 -##獣 -##獨 -##獭 -##獰 -##獲 -##獵 -##獷 -##獸 -##獺 -##獻 -##獼 -##獾 -##玄 -##率 -##玉 -##王 -##玑 -##玖 -##玛 -##玟 -##玠 -##玥 -##玩 -##玫 -##玮 -##环 -##现 -##玲 -##玳 -##玷 -##玺 -##玻 -##珀 -##珂 -##珅 -##珈 -##珉 -##珊 -##珍 -##珏 -##珐 -##珑 -##珙 -##珞 -##珠 -##珣 -##珥 -##珩 -##珪 -##班 -##珮 -##珲 -##珺 -##現 -##球 -##琅 -##理 -##琇 -##琉 -##琊 -##琍 -##琏 -##琐 -##琛 -##琢 -##琥 -##琦 -##琨 -##琪 -##琬 -##琮 -##琰 -##琲 -##琳 -##琴 -##琵 -##琶 -##琺 -##琼 -##瑀 -##瑁 -##瑄 -##瑋 -##瑕 -##瑗 -##瑙 -##瑚 -##瑛 -##瑜 -##瑞 -##瑟 -##瑠 -##瑣 -##瑤 -##瑩 -##瑪 -##瑯 -##瑰 -##瑶 -##瑾 -##璀 -##璁 -##璃 -##璇 -##璉 -##璋 -##璎 -##璐 -##璜 -##璞 -##璟 -##璧 -##璨 -##環 -##璽 -##璿 -##瓊 -##瓏 -##瓒 -##瓜 -##瓢 -##瓣 -##瓤 -##瓦 -##瓮 -##瓯 -##瓴 -##瓶 -##瓷 -##甄 -##甌 -##甕 -##甘 -##甙 -##甚 -##甜 -##生 -##產 -##産 -##甥 -##甦 -##用 -##甩 -##甫 -##甬 -##甭 -##甯 -##田 -##由 -##甲 -##申 -##电 -##男 -##甸 -##町 -##画 -##甾 -##畀 -##畅 -##界 -##畏 -##畑 -##畔 -##留 -##畜 -##畝 -##畢 -##略 -##畦 -##番 -##畫 -##異 -##畲 -##畳 -##畴 -##當 -##畸 -##畹 -##畿 -##疆 -##疇 -##疊 -##疏 -##疑 -##疔 -##疖 -##疗 -##疙 -##疚 -##疝 -##疟 -##疡 -##疣 -##疤 -##疥 -##疫 -##疮 -##疯 -##疱 -##疲 -##疳 -##疵 -##疸 -##疹 -##疼 -##疽 -##疾 -##痂 -##病 -##症 -##痈 -##痉 -##痊 -##痍 -##痒 -##痔 -##痕 -##痘 -##痙 -##痛 -##痞 -##痠 -##痢 -##痣 -##痤 -##痧 -##痨 -##痪 -##痫 -##痰 -##痱 -##痴 -##痹 -##痺 -##痼 -##痿 -##瘀 -##瘁 -##瘋 -##瘍 -##瘓 -##瘘 -##瘙 -##瘟 -##瘠 -##瘡 -##瘢 -##瘤 -##瘦 -##瘧 -##瘩 -##瘪 -##瘫 -##瘴 -##瘸 -##瘾 -##療 -##癇 -##癌 -##癒 -##癖 -##癜 -##癞 -##癡 -##癢 -##癣 -##癥 -##癫 -##癬 -##癮 -##癱 -##癲 -##癸 -##発 -##登 -##發 -##白 -##百 -##皂 -##的 -##皆 -##皇 -##皈 -##皋 -##皎 -##皑 -##皓 -##皖 -##皙 -##皚 -##皮 -##皰 -##皱 -##皴 -##皺 -##皿 -##盂 -##盃 -##盅 -##盆 -##盈 -##益 -##盎 -##盏 -##盐 -##监 -##盒 -##盔 -##盖 -##盗 -##盘 -##盛 -##盜 -##盞 -##盟 -##盡 -##監 -##盤 -##盥 -##盧 -##盪 -##目 -##盯 -##盱 -##盲 -##直 -##相 -##盹 -##盼 -##盾 -##省 -##眈 -##眉 -##看 -##県 -##眙 -##眞 -##真 -##眠 -##眦 -##眨 -##眩 -##眯 -##眶 -##眷 -##眸 -##眺 -##眼 -##眾 -##着 -##睁 -##睇 -##睏 -##睐 -##睑 -##睛 -##睜 -##睞 -##睡 -##睢 -##督 -##睥 -##睦 -##睨 -##睪 -##睫 -##睬 -##睹 -##睽 -##睾 -##睿 -##瞄 -##瞅 -##瞇 -##瞋 -##瞌 -##瞎 -##瞑 -##瞒 -##瞓 -##瞞 -##瞟 -##瞠 -##瞥 -##瞧 -##瞩 -##瞪 -##瞬 -##瞭 -##瞰 -##瞳 -##瞻 -##瞼 -##瞿 -##矇 -##矍 -##矗 -##矚 -##矛 -##矜 -##矢 -##矣 -##知 -##矩 -##矫 -##短 -##矮 -##矯 -##石 -##矶 -##矽 -##矾 -##矿 -##码 -##砂 -##砌 -##砍 -##砒 -##研 -##砖 -##砗 -##砚 -##砝 -##砣 -##砥 -##砧 -##砭 -##砰 -##砲 -##破 -##砷 -##砸 -##砺 -##砼 -##砾 -##础 -##硅 -##硐 -##硒 -##硕 -##硝 -##硫 -##硬 -##确 -##硯 -##硼 -##碁 -##碇 -##碉 -##碌 -##碍 -##碎 -##碑 -##碓 -##碗 -##碘 -##碚 -##碛 -##碟 -##碣 -##碧 -##碩 -##碰 -##碱 -##碳 -##碴 -##確 -##碼 -##碾 -##磁 -##磅 -##磊 -##磋 -##磐 -##磕 -##磚 -##磡 -##磨 -##磬 -##磯 -##磲 -##磷 -##磺 -##礁 -##礎 -##礙 -##礡 -##礦 -##礪 -##礫 -##礴 -##示 -##礼 -##社 -##祀 -##祁 -##祂 -##祇 -##祈 -##祉 -##祎 -##祐 -##祕 -##祖 -##祗 -##祚 -##祛 -##祜 -##祝 -##神 -##祟 -##祠 -##祢 -##祥 -##票 -##祭 -##祯 -##祷 -##祸 -##祺 -##祿 -##禀 -##禁 -##禄 -##禅 -##禍 -##禎 -##福 -##禛 -##禦 -##禧 -##禪 -##禮 -##禱 -##禹 -##禺 -##离 -##禽 -##禾 -##禿 -##秀 -##私 -##秃 -##秆 -##秉 -##秋 -##种 -##科 -##秒 -##秘 -##租 -##秣 -##秤 -##秦 -##秧 -##秩 -##秭 -##积 -##称 -##秸 -##移 -##秽 -##稀 -##稅 -##程 -##稍 -##税 -##稔 -##稗 -##稚 -##稜 -##稞 -##稟 -##稠 -##稣 -##種 -##稱 -##稲 -##稳 -##稷 -##稹 -##稻 -##稼 -##稽 -##稿 -##穀 -##穂 -##穆 -##穌 -##積 -##穎 -##穗 -##穢 -##穩 -##穫 -##穴 -##究 -##穷 -##穹 -##空 -##穿 -##突 -##窃 -##窄 -##窈 -##窍 -##窑 -##窒 -##窓 -##窕 -##窖 -##窗 -##窘 -##窜 -##窝 -##窟 -##窠 -##窥 -##窦 -##窨 -##窩 -##窪 -##窮 -##窯 -##窺 -##窿 -##竄 -##竅 -##竇 -##竊 -##立 -##竖 -##站 -##竜 -##竞 -##竟 -##章 -##竣 -##童 -##竭 -##端 -##競 -##竹 -##竺 -##竽 -##竿 -##笃 -##笆 -##笈 -##笋 -##笏 -##笑 -##笔 -##笙 -##笛 -##笞 -##笠 -##符 -##笨 -##第 -##笹 -##笺 -##笼 -##筆 -##等 -##筊 -##筋 -##筍 -##筏 -##筐 -##筑 -##筒 -##答 -##策 -##筛 -##筝 -##筠 -##筱 -##筲 -##筵 -##筷 -##筹 -##签 -##简 -##箇 -##箋 -##箍 -##箏 -##箐 -##箔 -##箕 -##算 -##箝 -##管 -##箩 -##箫 -##箭 -##箱 -##箴 -##箸 -##節 -##篁 -##範 -##篆 -##篇 -##築 -##篑 -##篓 -##篙 -##篝 -##篠 -##篡 -##篤 -##篩 -##篪 -##篮 -##篱 -##篷 -##簇 -##簌 -##簍 -##簡 -##簦 -##簧 -##簪 -##簫 -##簷 -##簸 -##簽 -##簾 -##簿 -##籁 -##籃 -##籌 -##籍 -##籐 -##籟 -##籠 -##籤 -##籬 -##籮 -##籲 -##米 -##类 -##籼 -##籽 -##粄 -##粉 -##粑 -##粒 -##粕 -##粗 -##粘 -##粟 -##粤 -##粥 -##粧 -##粪 -##粮 -##粱 -##粲 -##粳 -##粵 -##粹 -##粼 -##粽 -##精 -##粿 -##糅 -##糊 -##糍 -##糕 -##糖 -##糗 -##糙 -##糜 -##糞 -##糟 -##糠 -##糧 -##糬 -##糯 -##糰 -##糸 -##系 -##糾 -##紀 -##紂 -##約 -##紅 -##紉 -##紊 -##紋 -##納 -##紐 -##紓 -##純 -##紗 -##紘 -##紙 -##級 -##紛 -##紜 -##素 -##紡 -##索 -##紧 -##紫 -##紮 -##累 -##細 -##紳 -##紹 -##紺 -##終 -##絃 -##組 -##絆 -##経 -##結 -##絕 -##絞 -##絡 -##絢 -##給 -##絨 -##絮 -##統 -##絲 -##絳 -##絵 -##絶 -##絹 -##綁 -##綏 -##綑 -##經 -##継 -##続 -##綜 -##綠 -##綢 -##綦 -##綫 -##綬 -##維 -##綱 -##網 -##綴 -##綵 -##綸 -##綺 -##綻 -##綽 -##綾 -##綿 -##緊 -##緋 -##総 -##緑 -##緒 -##緘 -##線 -##緝 -##緞 -##締 -##緣 -##編 -##緩 -##緬 -##緯 -##練 -##緹 -##緻 -##縁 -##縄 -##縈 -##縛 -##縝 -##縣 -##縫 -##縮 -##縱 -##縴 -##縷 -##總 -##績 -##繁 -##繃 -##繆 -##繇 -##繋 -##織 -##繕 -##繚 -##繞 -##繡 -##繩 -##繪 -##繫 -##繭 -##繳 -##繹 -##繼 -##繽 -##纂 -##續 -##纍 -##纏 -##纓 -##纔 -##纖 -##纜 -##纠 -##红 -##纣 -##纤 -##约 -##级 -##纨 -##纪 -##纫 -##纬 -##纭 -##纯 -##纰 -##纱 -##纲 -##纳 -##纵 -##纶 -##纷 -##纸 -##纹 -##纺 -##纽 -##纾 -##线 -##绀 -##练 -##组 -##绅 -##细 -##织 -##终 -##绊 -##绍 -##绎 -##经 -##绑 -##绒 -##结 -##绔 -##绕 -##绘 -##给 -##绚 -##绛 -##络 -##绝 -##绞 -##统 -##绡 -##绢 -##绣 -##绥 -##绦 -##继 -##绩 -##绪 -##绫 -##续 -##绮 -##绯 -##绰 -##绳 -##维 -##绵 -##绶 -##绷 -##绸 -##绻 -##综 -##绽 -##绾 -##绿 -##缀 -##缄 -##缅 -##缆 -##缇 -##缈 -##缉 -##缎 -##缓 -##缔 -##缕 -##编 -##缘 -##缙 -##缚 -##缜 -##缝 -##缠 -##缢 -##缤 -##缥 -##缨 -##缩 -##缪 -##缭 -##缮 -##缰 -##缱 -##缴 -##缸 -##缺 -##缽 -##罂 -##罄 -##罌 -##罐 -##网 -##罔 -##罕 -##罗 -##罚 -##罡 -##罢 -##罩 -##罪 -##置 -##罰 -##署 -##罵 -##罷 -##罹 -##羁 -##羅 -##羈 -##羊 -##羌 -##美 -##羔 -##羚 -##羞 -##羟 -##羡 -##羣 -##群 -##羥 -##羧 -##羨 -##義 -##羯 -##羲 -##羸 -##羹 -##羽 -##羿 -##翁 -##翅 -##翊 -##翌 -##翎 -##習 -##翔 -##翘 -##翟 -##翠 -##翡 -##翦 -##翩 -##翰 -##翱 -##翳 -##翹 -##翻 -##翼 -##耀 -##老 -##考 -##耄 -##者 -##耆 -##耋 -##而 -##耍 -##耐 -##耒 -##耕 -##耗 -##耘 -##耙 -##耦 -##耨 -##耳 -##耶 -##耷 -##耸 -##耻 -##耽 -##耿 -##聂 -##聆 -##聊 -##聋 -##职 -##聒 -##联 -##聖 -##聘 -##聚 -##聞 -##聪 -##聯 -##聰 -##聲 -##聳 -##聴 -##聶 -##職 -##聽 -##聾 -##聿 -##肃 -##肄 -##肅 -##肆 -##肇 -##肉 -##肋 -##肌 -##肏 -##肓 -##肖 -##肘 -##肚 -##肛 -##肝 -##肠 -##股 -##肢 -##肤 -##肥 -##肩 -##肪 -##肮 -##肯 -##肱 -##育 -##肴 -##肺 -##肽 -##肾 -##肿 -##胀 -##胁 -##胃 -##胄 -##胆 -##背 -##胍 -##胎 -##胖 -##胚 -##胛 -##胜 -##胝 -##胞 -##胡 -##胤 -##胥 -##胧 -##胫 -##胭 -##胯 -##胰 -##胱 -##胳 -##胴 -##胶 -##胸 -##胺 -##能 -##脂 -##脅 -##脆 -##脇 -##脈 -##脉 -##脊 -##脍 -##脏 -##脐 -##脑 -##脓 -##脖 -##脘 -##脚 -##脛 -##脣 -##脩 -##脫 -##脯 -##脱 -##脲 -##脳 -##脸 -##脹 -##脾 -##腆 -##腈 -##腊 -##腋 -##腌 -##腎 -##腐 -##腑 -##腓 -##腔 -##腕 -##腥 -##腦 -##腩 -##腫 -##腭 -##腮 -##腰 -##腱 -##腳 -##腴 -##腸 -##腹 -##腺 -##腻 -##腼 -##腾 -##腿 -##膀 -##膈 -##膊 -##膏 -##膑 -##膘 -##膚 -##膛 -##膜 -##膝 -##膠 -##膦 -##膨 -##膩 -##膳 -##膺 -##膻 -##膽 -##膾 -##膿 -##臀 -##臂 -##臃 -##臆 -##臉 -##臊 -##臍 -##臓 -##臘 -##臟 -##臣 -##臥 -##臧 -##臨 -##自 -##臬 -##臭 -##至 -##致 -##臺 -##臻 -##臼 -##臾 -##舀 -##舂 -##舅 -##舆 -##與 -##興 -##舉 -##舊 -##舌 -##舍 -##舎 -##舐 -##舒 -##舔 -##舖 -##舗 -##舛 -##舜 -##舞 -##舟 -##航 -##舫 -##般 -##舰 -##舱 -##舵 -##舶 -##舷 -##舸 -##船 -##舺 -##舾 -##艇 -##艋 -##艘 -##艙 -##艦 -##艮 -##良 -##艰 -##艱 -##色 -##艳 -##艷 -##艹 -##艺 -##艾 -##节 -##芃 -##芈 -##芊 -##芋 -##芍 -##芎 -##芒 -##芙 -##芜 -##芝 -##芡 -##芥 -##芦 -##芩 -##芪 -##芫 -##芬 -##芭 -##芮 -##芯 -##花 -##芳 -##芷 -##芸 -##芹 -##芻 -##芽 -##芾 -##苁 -##苄 -##苇 -##苋 -##苍 -##苏 -##苑 -##苒 -##苓 -##苔 -##苕 -##苗 -##苛 -##苜 -##苞 -##苟 -##苡 -##苣 -##若 -##苦 -##苫 -##苯 -##英 -##苷 -##苹 -##苻 -##茁 -##茂 -##范 -##茄 -##茅 -##茉 -##茎 -##茏 -##茗 -##茜 -##茧 -##茨 -##茫 -##茬 -##茭 -##茯 -##茱 -##茲 -##茴 -##茵 -##茶 -##茸 -##茹 -##茼 -##荀 -##荃 -##荆 -##草 -##荊 -##荏 -##荐 -##荒 -##荔 -##荖 -##荘 -##荚 -##荞 -##荟 -##荠 -##荡 -##荣 -##荤 -##荥 -##荧 -##荨 -##荪 -##荫 -##药 -##荳 -##荷 -##荸 -##荻 -##荼 -##荽 -##莅 -##莆 -##莉 -##莊 -##莎 -##莒 -##莓 -##莖 -##莘 -##莞 -##莠 -##莢 -##莧 -##莪 -##莫 -##莱 -##莲 -##莴 -##获 -##莹 -##莺 -##莽 -##莿 -##菀 -##菁 -##菅 -##菇 -##菈 -##菊 -##菌 -##菏 -##菓 -##菖 -##菘 -##菜 -##菟 -##菠 -##菡 -##菩 -##華 -##菱 -##菲 -##菸 -##菽 -##萁 -##萃 -##萄 -##萊 -##萋 -##萌 -##萍 -##萎 -##萘 -##萝 -##萤 -##营 -##萦 -##萧 -##萨 -##萩 -##萬 -##萱 -##萵 -##萸 -##萼 -##落 -##葆 -##葉 -##著 -##葚 -##葛 -##葡 -##董 -##葦 -##葩 -##葫 -##葬 -##葭 -##葯 -##葱 -##葳 -##葵 -##葷 -##葺 -##蒂 -##蒋 -##蒐 -##蒔 -##蒙 -##蒜 -##蒞 -##蒟 -##蒡 -##蒨 -##蒲 -##蒸 -##蒹 -##蒻 -##蒼 -##蒿 -##蓁 -##蓄 -##蓆 -##蓉 -##蓋 -##蓑 -##蓓 -##蓖 -##蓝 -##蓟 -##蓦 -##蓬 -##蓮 -##蓼 -##蓿 -##蔑 -##蔓 -##蔔 -##蔗 -##蔘 -##蔚 -##蔡 -##蔣 -##蔥 -##蔫 -##蔬 -##蔭 -##蔵 -##蔷 -##蔺 -##蔻 -##蔼 -##蔽 -##蕁 -##蕃 -##蕈 -##蕉 -##蕊 -##蕎 -##蕙 -##蕤 -##蕨 -##蕩 -##蕪 -##蕭 -##蕲 -##蕴 -##蕻 -##蕾 -##薄 -##薅 -##薇 -##薈 -##薊 -##薏 -##薑 -##薔 -##薙 -##薛 -##薦 -##薨 -##薩 -##薪 -##薬 -##薯 -##薰 -##薹 -##藉 -##藍 -##藏 -##藐 -##藓 -##藕 -##藜 -##藝 -##藤 -##藥 -##藩 -##藹 -##藻 -##藿 -##蘆 -##蘇 -##蘊 -##蘋 -##蘑 -##蘚 -##蘭 -##蘸 -##蘼 -##蘿 -##虎 -##虏 -##虐 -##虑 -##虔 -##處 -##虚 -##虛 -##虜 -##虞 -##號 -##虢 -##虧 -##虫 -##虬 -##虱 -##虹 -##虻 -##虽 -##虾 -##蚀 -##蚁 -##蚂 -##蚊 -##蚌 -##蚓 -##蚕 -##蚜 -##蚝 -##蚣 -##蚤 -##蚩 -##蚪 -##蚯 -##蚱 -##蚵 -##蛀 -##蛆 -##蛇 -##蛊 -##蛋 -##蛎 -##蛐 -##蛔 -##蛙 -##蛛 -##蛟 -##蛤 -##蛭 -##蛮 -##蛰 -##蛳 -##蛹 -##蛻 -##蛾 -##蜀 -##蜂 -##蜃 -##蜆 -##蜇 -##蜈 -##蜊 -##蜍 -##蜒 -##蜓 -##蜕 -##蜗 -##蜘 -##蜚 -##蜜 -##蜡 -##蜢 -##蜥 -##蜱 -##蜴 -##蜷 -##蜻 -##蜿 -##蝇 -##蝈 -##蝉 -##蝌 -##蝎 -##蝕 -##蝗 -##蝙 -##蝟 -##蝠 -##蝦 -##蝨 -##蝴 -##蝶 -##蝸 -##蝼 -##螂 -##螃 -##融 -##螞 -##螢 -##螨 -##螯 -##螳 -##螺 -##蟀 -##蟄 -##蟆 -##蟋 -##蟎 -##蟑 -##蟒 -##蟠 -##蟬 -##蟲 -##蟹 -##蟻 -##蟾 -##蠅 -##蠍 -##蠔 -##蠕 -##蠛 -##蠟 -##蠡 -##蠢 -##蠣 -##蠱 -##蠶 -##蠹 -##蠻 -##血 -##衄 -##衅 -##衆 -##行 -##衍 -##術 -##衔 -##街 -##衙 -##衛 -##衝 -##衞 -##衡 -##衢 -##衣 -##补 -##表 -##衩 -##衫 -##衬 -##衮 -##衰 -##衲 -##衷 -##衹 -##衾 -##衿 -##袁 -##袂 -##袄 -##袅 -##袈 -##袋 -##袍 -##袒 -##袖 -##袜 -##袞 -##袤 -##袪 -##被 -##袭 -##袱 -##裁 -##裂 -##装 -##裆 -##裊 -##裏 -##裔 -##裕 -##裘 -##裙 -##補 -##裝 -##裟 -##裡 -##裤 -##裨 -##裱 -##裳 -##裴 -##裸 -##裹 -##製 -##裾 -##褂 -##複 -##褐 -##褒 -##褓 -##褔 -##褚 -##褥 -##褪 -##褫 -##褲 -##褶 -##褻 -##襁 -##襄 -##襟 -##襠 -##襪 -##襬 -##襯 -##襲 -##西 -##要 -##覃 -##覆 -##覇 -##見 -##規 -##覓 -##視 -##覚 -##覦 -##覧 -##親 -##覬 -##観 -##覷 -##覺 -##覽 -##觀 -##见 -##观 -##规 -##觅 -##视 -##览 -##觉 -##觊 -##觎 -##觐 -##觑 -##角 -##觞 -##解 -##觥 -##触 -##觸 -##言 -##訂 -##計 -##訊 -##討 -##訓 -##訕 -##訖 -##託 -##記 -##訛 -##訝 -##訟 -##訣 -##訥 -##訪 -##設 -##許 -##訳 -##訴 -##訶 -##診 -##註 -##証 -##詆 -##詐 -##詔 -##評 -##詛 -##詞 -##詠 -##詡 -##詢 -##詣 -##試 -##詩 -##詫 -##詬 -##詭 -##詮 -##詰 -##話 -##該 -##詳 -##詹 -##詼 -##誅 -##誇 -##誉 -##誌 -##認 -##誓 -##誕 -##誘 -##語 -##誠 -##誡 -##誣 -##誤 -##誥 -##誦 -##誨 -##說 -##説 -##読 -##誰 -##課 -##誹 -##誼 -##調 -##諄 -##談 -##請 -##諏 -##諒 -##論 -##諗 -##諜 -##諡 -##諦 -##諧 -##諫 -##諭 -##諮 -##諱 -##諳 -##諷 -##諸 -##諺 -##諾 -##謀 -##謁 -##謂 -##謄 -##謊 -##謎 -##謐 -##謔 -##謗 -##謙 -##講 -##謝 -##謠 -##謨 -##謬 -##謹 -##謾 -##譁 -##證 -##譎 -##譏 -##識 -##譙 -##譚 -##譜 -##警 -##譬 -##譯 -##議 -##譲 -##譴 -##護 -##譽 -##讀 -##變 -##讓 -##讚 -##讞 -##计 -##订 -##认 -##讥 -##讧 -##讨 -##让 -##讪 -##讫 -##训 -##议 -##讯 -##记 -##讲 -##讳 -##讴 -##讶 -##讷 -##许 -##讹 -##论 -##讼 -##讽 -##设 -##访 -##诀 -##证 -##诃 -##评 -##诅 -##识 -##诈 -##诉 -##诊 -##诋 -##词 -##诏 -##译 -##试 -##诗 -##诘 -##诙 -##诚 -##诛 -##话 -##诞 -##诟 -##诠 -##诡 -##询 -##诣 -##诤 -##该 -##详 -##诧 -##诩 -##诫 -##诬 -##语 -##误 -##诰 -##诱 -##诲 -##说 -##诵 -##诶 -##请 -##诸 -##诺 -##读 -##诽 -##课 -##诿 -##谀 -##谁 -##调 -##谄 -##谅 -##谆 -##谈 -##谊 -##谋 -##谌 -##谍 -##谎 -##谏 -##谐 -##谑 -##谒 -##谓 -##谔 -##谕 -##谗 -##谘 -##谙 -##谚 -##谛 -##谜 -##谟 -##谢 -##谣 -##谤 -##谥 -##谦 -##谧 -##谨 -##谩 -##谪 -##谬 -##谭 -##谯 -##谱 -##谲 -##谴 -##谶 -##谷 -##豁 -##豆 -##豇 -##豈 -##豉 -##豊 -##豌 -##豎 -##豐 -##豔 -##豚 -##象 -##豢 -##豪 -##豫 -##豬 -##豹 -##豺 -##貂 -##貅 -##貌 -##貓 -##貔 -##貘 -##貝 -##貞 -##負 -##財 -##貢 -##貧 -##貨 -##販 -##貪 -##貫 -##責 -##貯 -##貰 -##貳 -##貴 -##貶 -##買 -##貸 -##費 -##貼 -##貽 -##貿 -##賀 -##賁 -##賂 -##賃 -##賄 -##資 -##賈 -##賊 -##賑 -##賓 -##賜 -##賞 -##賠 -##賡 -##賢 -##賣 -##賤 -##賦 -##質 -##賬 -##賭 -##賴 -##賺 -##購 -##賽 -##贅 -##贈 -##贊 -##贍 -##贏 -##贓 -##贖 -##贛 -##贝 -##贞 -##负 -##贡 -##财 -##责 -##贤 -##败 -##账 -##货 -##质 -##贩 -##贪 -##贫 -##贬 -##购 -##贮 -##贯 -##贰 -##贱 -##贲 -##贴 -##贵 -##贷 -##贸 -##费 -##贺 -##贻 -##贼 -##贾 -##贿 -##赁 -##赂 -##赃 -##资 -##赅 -##赈 -##赊 -##赋 -##赌 -##赎 -##赏 -##赐 -##赓 -##赔 -##赖 -##赘 -##赚 -##赛 -##赝 -##赞 -##赠 -##赡 -##赢 -##赣 -##赤 -##赦 -##赧 -##赫 -##赭 -##走 -##赳 -##赴 -##赵 -##赶 -##起 -##趁 -##超 -##越 -##趋 -##趕 -##趙 -##趟 -##趣 -##趨 -##足 -##趴 -##趵 -##趸 -##趺 -##趾 -##跃 -##跄 -##跆 -##跋 -##跌 -##跎 -##跑 -##跖 -##跚 -##跛 -##距 -##跟 -##跡 -##跤 -##跨 -##跩 -##跪 -##路 -##跳 -##践 -##跷 -##跹 -##跺 -##跻 -##踉 -##踊 -##踌 -##踏 -##踐 -##踝 -##踞 -##踟 -##踢 -##踩 -##踪 -##踮 -##踱 -##踴 -##踵 -##踹 -##蹂 -##蹄 -##蹇 -##蹈 -##蹉 -##蹊 -##蹋 -##蹑 -##蹒 -##蹙 -##蹟 -##蹣 -##蹤 -##蹦 -##蹩 -##蹬 -##蹭 -##蹲 -##蹴 -##蹶 -##蹺 -##蹼 -##蹿 -##躁 -##躇 -##躉 -##躊 -##躋 -##躍 -##躏 -##躪 -##身 -##躬 -##躯 -##躲 -##躺 -##軀 -##車 -##軋 -##軌 -##軍 -##軒 -##軟 -##転 -##軸 -##軼 -##軽 -##軾 -##較 -##載 -##輒 -##輓 -##輔 -##輕 -##輛 -##輝 -##輟 -##輩 -##輪 -##輯 -##輸 -##輻 -##輾 -##輿 -##轄 -##轅 -##轆 -##轉 -##轍 -##轎 -##轟 -##车 -##轧 -##轨 -##轩 -##转 -##轭 -##轮 -##软 -##轰 -##轲 -##轴 -##轶 -##轻 -##轼 -##载 -##轿 -##较 -##辄 -##辅 -##辆 -##辇 -##辈 -##辉 -##辊 -##辍 -##辐 -##辑 -##输 -##辕 -##辖 -##辗 -##辘 -##辙 -##辛 -##辜 -##辞 -##辟 -##辣 -##辦 -##辨 -##辩 -##辫 -##辭 -##辮 -##辯 -##辰 -##辱 -##農 -##边 -##辺 -##辻 -##込 -##辽 -##达 -##迁 -##迂 -##迄 -##迅 -##过 -##迈 -##迎 -##运 -##近 -##返 -##还 -##这 -##进 -##远 -##违 -##连 -##迟 -##迢 -##迤 -##迥 -##迦 -##迩 -##迪 -##迫 -##迭 -##述 -##迴 -##迷 -##迸 -##迹 -##迺 -##追 -##退 -##送 -##适 -##逃 -##逅 -##逆 -##选 -##逊 -##逍 -##透 -##逐 -##递 -##途 -##逕 -##逗 -##這 -##通 -##逛 -##逝 -##逞 -##速 -##造 -##逢 -##連 -##逮 -##週 -##進 -##逵 -##逶 -##逸 -##逻 -##逼 -##逾 -##遁 -##遂 -##遅 -##遇 -##遊 -##運 -##遍 -##過 -##遏 -##遐 -##遑 -##遒 -##道 -##達 -##違 -##遗 -##遙 -##遛 -##遜 -##遞 -##遠 -##遢 -##遣 -##遥 -##遨 -##適 -##遭 -##遮 -##遲 -##遴 -##遵 -##遶 -##遷 -##選 -##遺 -##遼 -##遽 -##避 -##邀 -##邁 -##邂 -##邃 -##還 -##邇 -##邈 -##邊 -##邋 -##邏 -##邑 -##邓 -##邕 -##邛 -##邝 -##邢 -##那 -##邦 -##邨 -##邪 -##邬 -##邮 -##邯 -##邰 -##邱 -##邳 -##邵 -##邸 -##邹 -##邺 -##邻 -##郁 -##郅 -##郊 -##郎 -##郑 -##郜 -##郝 -##郡 -##郢 -##郤 -##郦 -##郧 -##部 -##郫 -##郭 -##郴 -##郵 -##郷 -##郸 -##都 -##鄂 -##鄉 -##鄒 -##鄔 -##鄙 -##鄞 -##鄢 -##鄧 -##鄭 -##鄰 -##鄱 -##鄲 -##鄺 -##酉 -##酊 -##酋 -##酌 -##配 -##酐 -##酒 -##酗 -##酚 -##酝 -##酢 -##酣 -##酥 -##酩 -##酪 -##酬 -##酮 -##酯 -##酰 -##酱 -##酵 -##酶 -##酷 -##酸 -##酿 -##醃 -##醇 -##醉 -##醋 -##醍 -##醐 -##醒 -##醚 -##醛 -##醜 -##醞 -##醣 -##醪 -##醫 -##醬 -##醮 -##醯 -##醴 -##醺 -##釀 -##釁 -##采 -##釉 -##释 -##釋 -##里 -##重 -##野 -##量 -##釐 -##金 -##釗 -##釘 -##釜 -##針 -##釣 -##釦 -##釧 -##釵 -##鈀 -##鈉 -##鈍 -##鈎 -##鈔 -##鈕 -##鈞 -##鈣 -##鈦 -##鈪 -##鈴 -##鈺 -##鈾 -##鉀 -##鉄 -##鉅 -##鉉 -##鉑 -##鉗 -##鉚 -##鉛 -##鉤 -##鉴 -##鉻 -##銀 -##銃 -##銅 -##銑 -##銓 -##銖 -##銘 -##銜 -##銬 -##銭 -##銮 -##銳 -##銷 -##銹 -##鋁 -##鋅 -##鋒 -##鋤 -##鋪 -##鋰 -##鋸 -##鋼 -##錄 -##錐 -##錘 -##錚 -##錠 -##錢 -##錦 -##錨 -##錫 -##錮 -##錯 -##録 -##錳 -##錶 -##鍊 -##鍋 -##鍍 -##鍛 -##鍥 -##鍰 -##鍵 -##鍺 -##鍾 -##鎂 -##鎊 -##鎌 -##鎏 -##鎔 -##鎖 -##鎗 -##鎚 -##鎧 -##鎬 -##鎮 -##鎳 -##鏈 -##鏖 -##鏗 -##鏘 -##鏞 -##鏟 -##鏡 -##鏢 -##鏤 -##鏽 -##鐘 -##鐮 -##鐲 -##鐳 -##鐵 -##鐸 -##鐺 -##鑄 -##鑊 -##鑑 -##鑒 -##鑣 -##鑫 -##鑰 -##鑲 -##鑼 -##鑽 -##鑾 -##鑿 -##针 -##钉 -##钊 -##钎 -##钏 -##钒 -##钓 -##钗 -##钙 -##钛 -##钜 -##钝 -##钞 -##钟 -##钠 -##钡 -##钢 -##钣 -##钤 -##钥 -##钦 -##钧 -##钨 -##钩 -##钮 -##钯 -##钰 -##钱 -##钳 -##钴 -##钵 -##钺 -##钻 -##钼 -##钾 -##钿 -##铀 -##铁 -##铂 -##铃 -##铄 -##铅 -##铆 -##铉 -##铎 -##铐 -##铛 -##铜 -##铝 -##铠 -##铡 -##铢 -##铣 -##铤 -##铨 -##铩 -##铬 -##铭 -##铮 -##铰 -##铲 -##铵 -##银 -##铸 -##铺 -##链 -##铿 -##销 -##锁 -##锂 -##锄 -##锅 -##锆 -##锈 -##锉 -##锋 -##锌 -##锏 -##锐 -##锑 -##错 -##锚 -##锟 -##锡 -##锢 -##锣 -##锤 -##锥 -##锦 -##锭 -##键 -##锯 -##锰 -##锲 -##锵 -##锹 -##锺 -##锻 -##镀 -##镁 -##镂 -##镇 -##镉 -##镌 -##镍 -##镐 -##镑 -##镕 -##镖 -##镗 -##镛 -##镜 -##镣 -##镭 -##镯 -##镰 -##镳 -##镶 -##長 -##长 -##門 -##閃 -##閉 -##開 -##閎 -##閏 -##閑 -##閒 -##間 -##閔 -##閘 -##閡 -##関 -##閣 -##閥 -##閨 -##閩 -##閱 -##閲 -##閹 -##閻 -##閾 -##闆 -##闇 -##闊 -##闌 -##闍 -##闔 -##闕 -##闖 -##闘 -##關 -##闡 -##闢 -##门 -##闪 -##闫 -##闭 -##问 -##闯 -##闰 -##闲 -##间 -##闵 -##闷 -##闸 -##闹 -##闺 -##闻 -##闽 -##闾 -##阀 -##阁 -##阂 -##阅 -##阆 -##阇 -##阈 -##阉 -##阎 -##阐 -##阑 -##阔 -##阕 -##阖 -##阙 -##阚 -##阜 -##队 -##阡 -##阪 -##阮 -##阱 -##防 -##阳 -##阴 -##阵 -##阶 -##阻 -##阿 -##陀 -##陂 -##附 -##际 -##陆 -##陇 -##陈 -##陋 -##陌 -##降 -##限 -##陕 -##陛 -##陝 -##陞 -##陟 -##陡 -##院 -##陣 -##除 -##陨 -##险 -##陪 -##陰 -##陲 -##陳 -##陵 -##陶 -##陷 -##陸 -##険 -##陽 -##隅 -##隆 -##隈 -##隊 -##隋 -##隍 -##階 -##随 -##隐 -##隔 -##隕 -##隘 -##隙 -##際 -##障 -##隠 -##隣 -##隧 -##隨 -##險 -##隱 -##隴 -##隶 -##隸 -##隻 -##隼 -##隽 -##难 -##雀 -##雁 -##雄 -##雅 -##集 -##雇 -##雉 -##雋 -##雌 -##雍 -##雎 -##雏 -##雑 -##雒 -##雕 -##雖 -##雙 -##雛 -##雜 -##雞 -##離 -##難 -##雨 -##雪 -##雯 -##雰 -##雲 -##雳 -##零 -##雷 -##雹 -##電 -##雾 -##需 -##霁 -##霄 -##霆 -##震 -##霈 -##霉 -##霊 -##霍 -##霎 -##霏 -##霑 -##霓 -##霖 -##霜 -##霞 -##霧 -##霭 -##霰 -##露 -##霸 -##霹 -##霽 -##霾 -##靂 -##靄 -##靈 -##青 -##靓 -##靖 -##静 -##靚 -##靛 -##靜 -##非 -##靠 -##靡 -##面 -##靥 -##靦 -##革 -##靳 -##靴 -##靶 -##靼 -##鞅 -##鞋 -##鞍 -##鞏 -##鞑 -##鞘 -##鞠 -##鞣 -##鞦 -##鞭 -##韆 -##韋 -##韌 -##韓 -##韜 -##韦 -##韧 -##韩 -##韬 -##韭 -##音 -##韵 -##韶 -##韻 -##響 -##頁 -##頂 -##頃 -##項 -##順 -##須 -##頌 -##預 -##頑 -##頒 -##頓 -##頗 -##領 -##頜 -##頡 -##頤 -##頫 -##頭 -##頰 -##頷 -##頸 -##頹 -##頻 -##頼 -##顆 -##題 -##額 -##顎 -##顏 -##顔 -##願 -##顛 -##類 -##顧 -##顫 -##顯 -##顱 -##顴 -##页 -##顶 -##顷 -##项 -##顺 -##须 -##顼 -##顽 -##顾 -##顿 -##颁 -##颂 -##预 -##颅 -##领 -##颇 -##颈 -##颉 -##颊 -##颌 -##颍 -##颐 -##频 -##颓 -##颔 -##颖 -##颗 -##题 -##颚 -##颛 -##颜 -##额 -##颞 -##颠 -##颡 -##颢 -##颤 -##颦 -##颧 -##風 -##颯 -##颱 -##颳 -##颶 -##颼 -##飄 -##飆 -##风 -##飒 -##飓 -##飕 -##飘 -##飙 -##飚 -##飛 -##飞 -##食 -##飢 -##飨 -##飩 -##飪 -##飯 -##飲 -##飼 -##飽 -##飾 -##餃 -##餅 -##餉 -##養 -##餌 -##餐 -##餒 -##餓 -##餘 -##餚 -##餛 -##餞 -##餡 -##館 -##餮 -##餵 -##餾 -##饅 -##饈 -##饋 -##饌 -##饍 -##饑 -##饒 -##饕 -##饗 -##饞 -##饥 -##饨 -##饪 -##饬 -##饭 -##饮 -##饯 -##饰 -##饱 -##饲 -##饴 -##饵 -##饶 -##饷 -##饺 -##饼 -##饽 -##饿 -##馀 -##馁 -##馄 -##馅 -##馆 -##馈 -##馋 -##馍 -##馏 -##馒 -##馔 -##首 -##馗 -##香 -##馥 -##馨 -##馬 -##馭 -##馮 -##馳 -##馴 -##駁 -##駄 -##駅 -##駆 -##駐 -##駒 -##駕 -##駛 -##駝 -##駭 -##駱 -##駿 -##騁 -##騎 -##騏 -##験 -##騙 -##騨 -##騰 -##騷 -##驀 -##驅 -##驊 -##驍 -##驒 -##驕 -##驗 -##驚 -##驛 -##驟 -##驢 -##驥 -##马 -##驭 -##驮 -##驯 -##驰 -##驱 -##驳 -##驴 -##驶 -##驷 -##驸 -##驹 -##驻 -##驼 -##驾 -##驿 -##骁 -##骂 -##骄 -##骅 -##骆 -##骇 -##骈 -##骊 -##骋 -##验 -##骏 -##骐 -##骑 -##骗 -##骚 -##骛 -##骜 -##骞 -##骠 -##骡 -##骤 -##骥 -##骧 -##骨 -##骯 -##骰 -##骶 -##骷 -##骸 -##骼 -##髂 -##髅 -##髋 -##髏 -##髒 -##髓 -##體 -##髖 -##高 -##髦 -##髪 -##髮 -##髯 -##髻 -##鬃 -##鬆 -##鬍 -##鬓 -##鬚 -##鬟 -##鬢 -##鬣 -##鬥 -##鬧 -##鬱 -##鬼 -##魁 -##魂 -##魄 -##魅 -##魇 -##魍 -##魏 -##魔 -##魘 -##魚 -##魯 -##魷 -##鮑 -##鮨 -##鮪 -##鮭 -##鮮 -##鯉 -##鯊 -##鯖 -##鯛 -##鯨 -##鯰 -##鯽 -##鰍 -##鰓 -##鰭 -##鰲 -##鰻 -##鰾 -##鱈 -##鱉 -##鱔 -##鱗 -##鱷 -##鱸 -##鱼 -##鱿 -##鲁 -##鲈 -##鲍 -##鲑 -##鲛 -##鲜 -##鲟 -##鲢 -##鲤 -##鲨 -##鲫 -##鲱 -##鲲 -##鲶 -##鲷 -##鲸 -##鳃 -##鳄 -##鳅 -##鳌 -##鳍 -##鳕 -##鳖 -##鳗 -##鳝 -##鳞 -##鳥 -##鳩 -##鳳 -##鳴 -##鳶 -##鴉 -##鴕 -##鴛 -##鴦 -##鴨 -##鴻 -##鴿 -##鵑 -##鵜 -##鵝 -##鵡 -##鵬 -##鵰 -##鵲 -##鶘 -##鶩 -##鶯 -##鶴 -##鷗 -##鷲 -##鷹 -##鷺 -##鸚 -##鸞 -##鸟 -##鸠 -##鸡 -##鸢 -##鸣 -##鸥 -##鸦 -##鸨 -##鸪 -##鸭 -##鸯 -##鸳 -##鸵 -##鸽 -##鸾 -##鸿 -##鹂 -##鹃 -##鹄 -##鹅 -##鹈 -##鹉 -##鹊 -##鹌 -##鹏 -##鹑 -##鹕 -##鹘 -##鹜 -##鹞 -##鹤 -##鹦 -##鹧 -##鹫 -##鹭 -##鹰 -##鹳 -##鹵 -##鹹 -##鹼 -##鹽 -##鹿 -##麂 -##麋 -##麒 -##麓 -##麗 -##麝 -##麟 -##麥 -##麦 -##麩 -##麴 -##麵 -##麸 -##麺 -##麻 -##麼 -##麽 -##麾 -##黃 -##黄 -##黍 -##黎 -##黏 -##黑 -##黒 -##黔 -##默 -##黛 -##黜 -##黝 -##點 -##黠 -##黨 -##黯 -##黴 -##鼋 -##鼎 -##鼐 -##鼓 -##鼠 -##鼬 -##鼹 -##鼻 -##鼾 -##齁 -##齊 -##齋 -##齐 -##齒 -##齡 -##齢 -##齣 -##齦 -##齿 -##龄 -##龅 -##龈 -##龊 -##龋 -##龌 -##龍 -##龐 -##龔 -##龕 -##龙 -##龚 -##龛 -##龜 -##龟 -##︰ -##︱ -##︶ -##︿ -##﹁ -##﹂ -##﹍ -##﹏ -##﹐ -##﹑ -##﹒ -##﹔ -##﹕ -##﹖ -##﹗ -##﹙ -##﹚ -##﹝ -##﹞ -##﹡ -##﹣ -##! -##" -### -##$ -##% -##& -##' -##( -##) -##* -##, -##- -##. -##/ -##: -##; -##< -##? -##@ -##[ -##\ -##] -##^ -##_ -##` -##f -##h -##j -##u -##w -##z -##{ -##} -##。 -##「 -##」 -##、 -##・ -##ッ -##ー -##イ -##ク -##シ -##ス -##ト -##ノ -##フ -##ラ -##ル -##ン -##゙ -##゚ -## ̄ -##¥ -##👍 -##🔥 -##😂 -##😎 diff --git a/contrib/BertTextClassification/mxBase/main.cpp b/contrib/BertTextClassification/mxBase/main.cpp deleted file mode 100644 index c37b87b5e..000000000 --- a/contrib/BertTextClassification/mxBase/main.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright(C) 2021. Huawei Technologies Co.,Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include "BertClassification.h" -#include "test/Test.h" - -namespace { - const uint32_t MAX_LENGTH = 300; - const uint32_t LABEL_NUMBER = 5; - const uint32_t SAMPLE_NUMBER = 99; - const std::string LABEL_LIST[LABEL_NUMBER] = {"体育", "健康", "军事", "教育", "汽车"}; -} - -void InitBertParam(InitParam &initParam) { - initParam.deviceId = 0; - initParam.labelPath = "./model/bert_text_classification_labels.names"; - initParam.modelPath = "./model/bert_text_classification.om"; - initParam.vocabTextPath = "data/vocab.txt"; - initParam.maxLength = MAX_LENGTH; - initParam.labelNumber = LABEL_NUMBER; -} - -int main(int argc, char* argv[]) { - if (argc <= 1) { - LogWarn << "Please input text path, such as './mxBase_text_classification ./data/sample.txt'."; - return APP_ERR_OK; - } - - InitParam initParam; - InitBertParam(initParam); - auto bert = std::make_shared(); - // Initialize the configuration information required for model inference. - APP_ERROR ret = bert->Init(initParam); - if (ret != APP_ERR_OK) { - LogError << "BertClassification init failed, ret=" << ret << "."; - bert->DeInit(); - return ret; - } - - std::string textPath = argv[1]; - std::string aa = textPath.substr(textPath.find_last_of(".")); - if (textPath.substr(textPath.find_last_of(".")) != ".txt") { - LogError << "please input the txt file!"; - bert->DeInit(); - return APP_ERR_COMM_FAILURE; - } - std::string text; - std::ifstream infile; - // Open text file. - infile.open(textPath, std::ios_base::in); - // Check text file validity. - if (infile.fail()) { - LogError << "Failed to open textPath file: " << textPath << "."; - bert->DeInit(); - return APP_ERR_COMM_OPEN_FAIL; - } - - while (std::getline(infile, text)) { - std::string label; - // Inference begin. - ret = bert->Process(text, label); - std::cout << "origin text:" << text <DeInit(); - return ret; - } - } - - if (text == "") { - LogError << "The sample.txt text is null, please input right text!"; - bert->DeInit(); - return APP_ERR_COMM_FAILURE; - } - // Destroy. - bert->DeInit(); - return APP_ERR_OK; -} diff --git a/contrib/BertTextClassification/mxBase/model/bert_text_classification_labels.names b/contrib/BertTextClassification/mxBase/model/bert_text_classification_labels.names deleted file mode 100644 index 9dd5a8216..000000000 --- a/contrib/BertTextClassification/mxBase/model/bert_text_classification_labels.names +++ /dev/null @@ -1,5 +0,0 @@ -体育 -健康 -军事 -教育 -汽车 \ No newline at end of file diff --git a/contrib/BertTextClassification/mxBase/out/prediction_label.txt b/contrib/BertTextClassification/mxBase/out/prediction_label.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/contrib/BertTextClassification/mxBase/test/Test.cpp b/contrib/BertTextClassification/mxBase/test/Test.cpp deleted file mode 100644 index e52f79342..000000000 --- a/contrib/BertTextClassification/mxBase/test/Test.cpp +++ /dev/null @@ -1,151 +0,0 @@ -// -// Created by 13352 on 2021/10/19. -// - -#include "Test.h" -#include -#include - -namespace { - const uint32_t MAX_LENGTH = 300; - const uint32_t LABEL_NUMBER = 5; - const uint32_t SAMPLE_NUMBER = 99; - const std::string LABEL_LIST[LABEL_NUMBER] = {"体育", "健康", "军事", "教育", "汽车"}; -} - -void Test::InitBertParam(InitParam &initParam) { - initParam.deviceId = 0; - initParam.labelPath = "./model/bert_text_classification_labels.names"; - initParam.modelPath = "./model/bert_text_classification.om"; - initParam.vocabTextPath = "data/vocab.txt"; - initParam.maxLength = MAX_LENGTH; - initParam.labelNumber = LABEL_NUMBER; -} - -APP_ERROR Test::test_accuracy() { - InitParam initParam; - InitBertParam(initParam); - auto bert = std::make_shared(); - - // Initialize the configuration information required for model inference. - APP_ERROR ret = bert->Init(initParam); - if (ret != APP_ERR_OK) { - LogError << "BertClassification init failed, ret=" << ret << "."; - bert->DeInit(); - return ret; - } - - // Open test file. - std::ifstream fin("data/test.csv"); - std::string line, prediction_label; - std::vector> prediction_label_lists; - - // Init prediction_label_lists. - for (int i = 0;i < LABEL_NUMBER;i++) { - std::vector temp; - prediction_label_lists.push_back(temp); - } - int index = 0, count = 0; - clock_t startTime,endTime; - startTime = clock(); - while (getline(fin, line)) { - std::istringstream sin(line); - std::string label, text; - std::string field; - while (getline(sin, field, ',')) { - label = field; - break; - } - text = line.substr(line.find_first_of(',') + 1); - // Remove the start and end ". - if (text.find("\"") == 0) { - text = text.replace(text.find("\""),1,""); - text = text.replace(text.find_last_of("\""),1,""); - } - // Start inference. - ret = bert->Process(text, prediction_label); - - if (count != 0 && count % SAMPLE_NUMBER == 0) { - index++; - } - - // Determine whether the prediction result is correct. - if (prediction_label == label){ - prediction_label_lists[index].push_back("true"); - } - else{ - prediction_label_lists[index].push_back("false"); - } - - count++; - if (ret != APP_ERR_OK) { - LogError << "BertClassification process failed, ret=" << ret << "."; - bert->DeInit(); - return ret; - } - } - endTime = clock(); - std::cout << "The average time is: " <<(double)(endTime - startTime) / CLOCKS_PER_SEC / SAMPLE_NUMBER / LABEL_NUMBER - << "s" << std::endl; - bert->DeInit(); - - // Calculate accuracy. - int all_count = 0; - index = 0; - double accuracy; - for (auto label_list : prediction_label_lists) { - count = 0; - for (auto label : label_list) { - if (label == "true") { - count++; - all_count++; - } - } - accuracy = static_cast(count) / SAMPLE_NUMBER; - std::cout << LABEL_LIST[index] << "类的精确度为:" << accuracy << std::endl; - index++; - } - accuracy = static_cast(all_count) / SAMPLE_NUMBER / LABEL_NUMBER; - std::cout << "全部类的精确度为:" << accuracy << std::endl; - return APP_ERR_OK; -} - -APP_ERROR Test::test_input() { - std::vector input_text; - InitParam initParam; - InitBertParam(initParam); - auto bert = std::make_shared(); - // Initialize the configuration information required for model inference. - APP_ERROR ret = bert->Init(initParam); - if (ret != APP_ERR_OK) { - LogError << "BertClassification init failed, ret=" << ret << "."; - bert->DeInit(); - return ret; - } - std::string text; - std::ifstream infile; - // Open text file. - infile.open("data/test.txt", std::ios_base::in); - // Check text file validity. - if (infile.fail()) { - LogError << "Failed to open textPath file: test.txt."; - bert->DeInit(); - return APP_ERR_COMM_OPEN_FAIL; - } - while (std::getline(infile, text)) { - std::string label; - // Inference begin. - ret = bert->Process(text, label); - std::cout << "origin text:" << text <DeInit(); - return ret; - } - } - - // Destroy. - bert->DeInit(); - return APP_ERR_OK; -} \ No newline at end of file diff --git a/contrib/BertTextClassification/mxBase/test/Test.h b/contrib/BertTextClassification/mxBase/test/Test.h deleted file mode 100644 index c4acc3456..000000000 --- a/contrib/BertTextClassification/mxBase/test/Test.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Created by 13352 on 2021/10/19. -// - -#ifndef MXBASE_TEXT_CLASSIFICATION_TEST_H -#define MXBASE_TEXT_CLASSIFICATION_TEST_H - - -#include - -class Test { -public: - static void InitBertParam(InitParam &initParam); - static APP_ERROR test_accuracy(); - static APP_ERROR test_input(); -}; - - -#endif // MXBASE_TEXT_CLASSIFICATION_TEST_H -- Gitee From 648b3e03c1b58fd64c12184a1578e2addc8f948d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 22 Oct 2024 08:49:46 +0000 Subject: [PATCH 097/129] update contrib/EdgeDetectionPicture/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md index 7144d8f8c..0850eee0b 100644 --- a/contrib/EdgeDetectionPicture/README.md +++ b/contrib/EdgeDetectionPicture/README.md @@ -8,13 +8,14 @@ 其中包含Rcf模型的后处理模块开发。 主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit #### 1.2 支持的产品 -昇腾310(推理) +昇腾310B #### 1.3 支持的版本 本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | #### 1.4 代码目录结构说明 -- Gitee From ae0f75a5e83c9de638fd8cb041d035c287d06294 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 01:38:46 +0000 Subject: [PATCH 098/129] update contrib/CrowdCounting/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CrowdCounting/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/CrowdCounting/README.md b/contrib/CrowdCounting/README.md index 2c8200716..e1c16155e 100644 --- a/contrib/CrowdCounting/README.md +++ b/contrib/CrowdCounting/README.md @@ -7,7 +7,7 @@ ### 1.2 支持的产品 -支持昇腾310芯片 +支持昇腾310B芯片 ### 1.3 支持的版本 @@ -15,6 +15,7 @@ | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ### 1.4 代码目录结构说明 @@ -70,5 +71,5 @@ cd到CrowdCounting目录下,执行如下编译命令: bash build.sh ``` ./crowd_counting ./xxx.jpg ``` - +结果为本目录下生成的result.jpg,可下载本地查看。 -- Gitee From 10e26b6d67a329db29558b14ae8df06db4c5a93c Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 01:41:56 +0000 Subject: [PATCH 099/129] update contrib/CrowdCounting/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CrowdCounting/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/CrowdCounting/README.md b/contrib/CrowdCounting/README.md index e1c16155e..0afa2ca32 100644 --- a/contrib/CrowdCounting/README.md +++ b/contrib/CrowdCounting/README.md @@ -71,5 +71,6 @@ cd到CrowdCounting目录下,执行如下编译命令: bash build.sh ``` ./crowd_counting ./xxx.jpg ``` -结果为本目录下生成的result.jpg,可下载本地查看。 +**步骤3** +查看结果:结果为本目录下生成的result.jpg,可下载本地查看。 -- Gitee From 89194f8cc2b6558d0e95de9293c25dbe47f23746 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 01:49:09 +0000 Subject: [PATCH 100/129] update contrib/EdgeDetectionPicture/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md index 0850eee0b..538c1a7b7 100644 --- a/contrib/EdgeDetectionPicture/README.md +++ b/contrib/EdgeDetectionPicture/README.md @@ -42,16 +42,15 @@ 在编译运行项目前,需要设置环境变量: -- 环境变量介绍 - ``` - . {cann_install_path}/ascend-toolkit/set_env.sh - . {sdk_install_path}/mxVision/set_env.sh +``` +. {cann_install_path}/ascend-toolkit/set_env.sh +. {sdk_install_path}/mxVision/set_env.sh - # 环境变量介绍 - cann_install_path: CANN 安装路径 - sdk_install_path: SDK 安装路径 - ``` +# 环境变量介绍 +cann_install_path: CANN 安装路径 +sdk_install_path: SDK 安装路径 +``` @@ -79,7 +78,8 @@ bash build.sh ``` ./edge_detection_picture ./data ``` -生成边缘检测图像 result/**.jpg +**步骤3** 查看结果 +查看上一步骤生成的边缘检测图像 result/**.jpg ## 5 精度验证 下载开源数据集 BSDS500 [下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/data.zip), 使用 BSR/BSDS500/data/images/test数据进行测试 -- Gitee From 0a83d9806e3b55429acb340b5bd420929c529ac5 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 02:34:24 +0000 Subject: [PATCH 101/129] update contrib/IAT/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/IAT/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md index 42d28a9c6..a4b27b643 100644 --- a/contrib/IAT/README.md +++ b/contrib/IAT/README.md @@ -7,7 +7,7 @@ ### 1.2 支持的产品 -支持昇腾310芯片 +支持昇腾310B芯片 ### 1.3 支持的版本 @@ -15,6 +15,7 @@ | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ### 1.4 三方依赖 @@ -60,7 +61,6 @@ ascend_toolkit_path: CANN 安装路径 ## 3 运行 -### 3.1 推理示例代码 **步骤1** (下载原模型代码) @@ -117,14 +117,15 @@ onnxsim IAT_lol.onnx IAT_lol-sim.onnx atc --framework=5 --model=./IAT_lol-sim.onnx --input_shape="input_1:1,3,400,600" --output=IAT_lol-sim --soc_version=Ascend310 ``` -**步骤4** (运行及输出结果) +**步骤4** 将要推理的图片放到本项目./data/文件夹下, 并将其改为test.png, 将.om模型放到./models/文件夹下, 命名为iatsim.om。运行: ``` python main.py ``` +**步骤5** 查看结果: -即可在./data/目录下得到推理后的结果. +可在./data/目录下查看进行推理后的结果. -- Gitee From 80decdd4f860626b6088d5d38d51be37c46647ea Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 02:35:25 +0000 Subject: [PATCH 102/129] update contrib/EdgeDetectionPicture/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md index 538c1a7b7..61d9f7574 100644 --- a/contrib/EdgeDetectionPicture/README.md +++ b/contrib/EdgeDetectionPicture/README.md @@ -85,19 +85,19 @@ bash build.sh 下载开源数据集 BSDS500 [下载地址](https://mindx.sdk.obs.cn-north-4.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/EdgeDetectionPicture/data.zip), 使用 BSR/BSDS500/data/images/test数据进行测试 -(1) 下载开源代码 +**步骤1** 下载开源代码 ``` shell git clone https://github.com/Walstruzz/edge_eval_python.git cd edge_eval_python ``` -(2) 编译cxx +**步骤2** 编译cxx ``` shell cd cxx/src source build.sh ``` -(3) 将test中的图像经过边缘检测后的结果保存在result文件夹中 +**步骤3** 将test中的图像经过边缘检测后的结果保存在result文件夹中 ``` shell ./edge_detection_picture path/to/BSR/BSDS500/data/images/test/ @@ -105,7 +105,7 @@ source build.sh ``` -(4) 修改检测代码 +**步骤4** 修改检测代码 vim mian.py 注释第17行代码 nms_process(model_name_list, result_dir, save_dir, key, file_format), @@ -117,7 +117,7 @@ vim /impl/edges_eval_dir.py vim eval_edge.py 修改14行为 res_dir = result_dir -(5) 测试精度 +**步骤5** 测试精度 ``` shell python main.py --result_dir path/to/result --gt_dir path/to/BSR/BSDS500/data/groundTruth/test -- Gitee From bfd85a552d6c2645cc8ccc076205600868a5936a Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 02:39:19 +0000 Subject: [PATCH 103/129] update contrib/TSM/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/TSM/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/TSM/README.md b/contrib/TSM/README.md index 13e99c33d..127b3734c 100644 --- a/contrib/TSM/README.md +++ b/contrib/TSM/README.md @@ -7,13 +7,14 @@ ### 1.2 支持的产品 -以昇腾Atlas310卡为主要的硬件平台 +以昇腾Atlas310B卡为主要的硬件平台 ### 1.3 支持的版本 本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ### 1.4 三方依赖 -- Gitee From a57e7d7aa069f7e4f39597c364e2abb6040ac145 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 02:59:12 +0000 Subject: [PATCH 104/129] update contrib/VCOD_SLTNet/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VCOD_SLTNet/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md index e718eb802..fb2ac4f15 100644 --- a/contrib/VCOD_SLTNet/README.md +++ b/contrib/VCOD_SLTNet/README.md @@ -9,7 +9,7 @@ ### 1.2 支持的产品 -支持昇腾310芯片 +支持昇腾310B芯片 ### 1.3 支持的版本 @@ -18,6 +18,8 @@ | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | + ### 1.4 三方依赖 -- Gitee From 760519b2b64e53d5d2def66a1a09eb7be8a6c58e Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 03:37:50 +0000 Subject: [PATCH 105/129] update contrib/EdgeDetectionPicture/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 2 ++ contrib/EdgeDetectionPicture/image.png | Bin 0 -> 3627 bytes 2 files changed, 2 insertions(+) create mode 100644 contrib/EdgeDetectionPicture/image.png diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md index 61d9f7574..9bbb3fe88 100644 --- a/contrib/EdgeDetectionPicture/README.md +++ b/contrib/EdgeDetectionPicture/README.md @@ -127,6 +127,8 @@ python main.py --result_dir path/to/result --gt_dir path/to/BSR/BSDS500/data/g result_dir: results directory gt_dir : ground truth directory +**步骤6** 查看结果: +![输入图片说明](image.png) ## 6 常见问题 diff --git a/contrib/EdgeDetectionPicture/image.png b/contrib/EdgeDetectionPicture/image.png new file mode 100644 index 0000000000000000000000000000000000000000..3edd911814daf5fba749f29187b581340ad49ebc GIT binary patch literal 3627 zcmV+`4%G39P)5abkvZxJ6OcN&NiCI0k@?V_Fz2LsfREQ)-jo@B|g z-roOw_3A1z@S%Yt z;0QPZZ-?9bto@tshd&?h=Sk;3Zl8eNHp{HMkUW* zLh|wcmFs=ZU&%pOoaSnaXf7+8{Hp?BI-yn_dyk;D3KB4?ZP6%_h!0v?5c3pA;2%SP zjgEmyb4wGJd|pFq7rEG63l;JdAU@7?LhS0F$9v+hq63j>=619KOXvG3u<++8bXW5r zBOh*4;Lt?hvFy_@-_$DgWOHWl!+E-5CjqW06nr>?)zc-BQ4}~O`aXbxrOz{RiA6?k zy}!hpW4%3lFJCisDp0EE1B}_Ws3)1Y*!kBH_$>%*LC4edl?m%SJ?AM5)5z%9;G@mp z3)K0z-NPW=pyNtzn~r5JbTFCtUei1=I~n8#innzJ&Z=Q`x`~eP1IE{hRq1scc!s_c z0nxo|NI{F*WyRPt4(e-4M$>Y=rL0NEO^Zs|1h|Q$ld>c5s}R_PjxVPvji=z^Qn)}; zn~7Z?<1*^GDt!(m=j|GM@xn6Q%kVs7{T`!SiRY$ACj(VbnBYGhf&C(|4IPL1 zT7g6z)8n zCpnpp?jssfnSSjE><)pA=s1i|=j$z!GHL&U_;8VmPsJ{yW2hxPaceqm=AQ3lmF)8b zt9FXKk`<>vY+7KTZ9~Cmsa!N`Xq8IkQJ$Rt7330ur4Iy0cqmEr&Uw-q7gyQCha|pw zS!%B=l~iiji{U;($J(Me#y6215hxJzpN_!p5!i~3(+d?abb|I7nF87vG95O~EkJ=0 zYo-`U$L(B7F>oCTB}&W6r;FF=IGdTqba^=0)QakmBmn(o8?)GtcOWCSz?kT%Eag4u z>noAz$k-VcKXGK;E}NYdE5#XSg<)Ryw3Y!=74^Y>6rNWga;51)BKaPtr^154{59RL z=TAO6Pq31rJj)T-F9Msy!)qJqaVz{GSqOp_;wg^6o)OrNj!PRL%<@g6P+eyEXzAQOJr}3^3iYxfo-A8s zE}&GSEKWyAN(xmYd5x6?Ot6T-l{uQF&avtm9ak+fs<0)u zKd%$rEGL%okexf*KukJLl5rkW&v;TgP;?wuuE-28+rAi?iw~bm^hCNOWy9=n=|V17 z%t~X)necw6ECRym9;zO;*QDc?MLo&qDXe*Rx7#=!I|Ba{0t0jm%@rpD(q9}X0jHE^ zAL)iX|5{~(2v)?THp*PxYfWvmh|1;Dj*ofD?@J-UbvH>@bcUBNUuB{-B; zA&b<@HY>+5tZ+j3nJ07U?C>*`r5mh2NUrgUF3An6W1?)D{9!IbczgE3kXEQo78pbh z{7e@0Br~1atBR;wf!b3Xfqw%5M#o4-|Ay+Wts~$FI0C;30jFc{dmI5rz!BI50#3)f zaKmrv;oTNTz!6x6fYY(lu_NFJI0Cys!0C7wZdlfrdMQW15%^6AI2}73I|7b?Bd`ku zoQ`+lhTqh~yDg4@Bd`nsr(>sMN5Bzq1a^Ud)A26cu&gijQjUNl@S6}oIu0AvaE}z* zr53lJrL4zXj%&*(@cmK74f#&%g6u<+Uk7dwCDRJ^7N7NMOK#^js_tb~k!&9V8^rDu z$=30spmz1R)gD&;jdN)`BJKi3foiv>wY3s&HfmYweN`{r7#YL6arkWKm{&v3h6y=K zwuOh-quAGZDH=iHHDy2QScR_u7Di$_RHePx{K>xmg-B*d%?qfP?@eXjQL%8w?;J3l zO%{#86X`hB1Rq=YWOc+3%c2tU#7z9|;sdwj#vAg^U5kIIscAd)f3Vr2Bd7t5aeL$Y=JD1MF8K5kX|NMe-%sb565>Vps=^h=nfF0l5= zBq4u=_eH(RB4|4{8sByptDp&Wa!N<%6=>iYV3k%TV3$7|Smk~B@$)a8qZnk{mlbUg zhr!VT=THly$`;P7tY*=yVW4CA=|V6M$0JNoD8_0{zQm8_01(GJJ&GdNWLz*&w!uaz z)dtXn@&N~~q>{W{y+XYvk~vCDI^HXi8EqC7XbU73TFf_ZbP>BK82)gol^*PUQkm)_ z%c=;cH;Zdo7IBETy@rP6aZ%mSPpvuy8f(6DqTGY0O_DWXW_CsjBI*K%kIy^aEP zN~NNy%=(2wkJzqWlYT zf><3bMO0M*p-=c}7|t|#QD;`xsIDlf@6;(ZL)v$~LdRRdSnR6kyas1oR;L67-g@rT z#i;$U!8{++{d81E??4>j%nthtO^eD&SSUAiF@hVQBGO#jlH0jsHQHgSu`)V_)DGqM zD))&bLBpWqgyi^ftCc_}wNPN8M)>$2082kEswpO`_pMPUgtJ-Nm(WmC3e@n|u65M$ z2p`ay48_Q^vM5Me@ap#4#cHeLbSt6t8p2VC#+kQnfU7b{*JZhnP@e^K%$1-kS7DBi zd`fuKo#-1qZGu|1n=$mX^kFueYD#YBuJNA+onw{E0Ru6 z--zTuAsL8AXMp?8Da*RbeS;O z{>f1i{HsEL_|1xKy-$^-*9o^e8ttPA2<$dE^ae!}?9C{8XS}9*u0dmUSw13RSfyaA z9L1Y4G1|ViSEn$<#>i^rq|hKUtevb-rXHbU`dpc@lNZ^YMaY853Oa_uX5W_F&MnHI zwDFWd&_Mwni$-0$K$6&Aqhs#t1s*hP51}H!9KUXT5Cicv+2%PB9knM==D%aB%xWbZnp(=ZT*DGqJcK~KMz3S}D}%7$LgUQme*Mr#sC!!L$yyCDB!RO_kA0y*u8pVisLEt!?nX0tAebp?;`#vm;qUMyESg8k7Gi#p&4Q x&Cu^H7#jaip)<(Qj^rRvX$jh+?muose*p&cXHr#V7OnsQ002ovPDHLkV1oPl(KG-6 literal 0 HcmV?d00001 -- Gitee From a1f109f6795a47fb2b1c820eff988a4f2b0016d4 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 03:38:10 +0000 Subject: [PATCH 106/129] update contrib/EdgeDetectionPicture/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md index 9bbb3fe88..8d541ec69 100644 --- a/contrib/EdgeDetectionPicture/README.md +++ b/contrib/EdgeDetectionPicture/README.md @@ -127,6 +127,7 @@ python main.py --result_dir path/to/result --gt_dir path/to/BSR/BSDS500/data/g result_dir: results directory gt_dir : ground truth directory + **步骤6** 查看结果: ![输入图片说明](image.png) -- Gitee From bb8fd04f0871c4663d6d7a1c8cc4b18f35d00e4b Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 03:54:33 +0000 Subject: [PATCH 107/129] update contrib/VCOD_SLTNet/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VCOD_SLTNet/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md index fb2ac4f15..bc5741224 100644 --- a/contrib/VCOD_SLTNet/README.md +++ b/contrib/VCOD_SLTNet/README.md @@ -197,7 +197,7 @@ python -m onnxsim --input-shape="1,9,352,352" --dynamic-input-shape sltnet.onnx 步骤三、onnx模型转om模型 ``` -atc --framework=5 --model=sltnet.onnx --output=sltnet --input_shape="image:1,9,352,352" --soc_version=Ascend310 --log=error +atc --framework=5 --model=sltnet.onnx --output=sltnet --input_shape="image:1,9,352,352" --soc_version=Ascend310B1 --log=error ``` 注意: -- Gitee From 73e6ee1f28c7c9093bff7401b59e24c88ba825f6 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 03:59:21 +0000 Subject: [PATCH 108/129] update contrib/VCOD_SLTNet/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VCOD_SLTNet/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md index bc5741224..86446dbee 100644 --- a/contrib/VCOD_SLTNet/README.md +++ b/contrib/VCOD_SLTNet/README.md @@ -210,6 +210,7 @@ atc --framework=5 --model=sltnet.onnx --output=sltnet --input_shape="image:1,9,3 ## 4. 运行 +**步骤1** 使用如下命令,运行 `inference.py` 脚本: ``` @@ -232,6 +233,7 @@ device_id:设备编号 注意,该脚本无需放入修改的 SLT-Net 目录,在任意位置均可执行,只需设置好上述参数即可。 +**步骤2**查看结果: 运行输出如下: ``` -- Gitee From 880d44863346bb4a54269df71b06ec3ec8038058 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 03:59:43 +0000 Subject: [PATCH 109/129] update contrib/VCOD_SLTNet/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VCOD_SLTNet/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md index 86446dbee..86ad7b3a0 100644 --- a/contrib/VCOD_SLTNet/README.md +++ b/contrib/VCOD_SLTNet/README.md @@ -233,7 +233,7 @@ device_id:设备编号 注意,该脚本无需放入修改的 SLT-Net 目录,在任意位置均可执行,只需设置好上述参数即可。 -**步骤2**查看结果: +**步骤2** 查看结果: 运行输出如下: ``` -- Gitee From f3bdb8e3d7865830fbe5bc2cb350f7bae6442cbc Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 29 Oct 2024 04:04:08 +0000 Subject: [PATCH 110/129] update contrib/TSM/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/TSM/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/TSM/README.md b/contrib/TSM/README.md index 127b3734c..f15cc9065 100644 --- a/contrib/TSM/README.md +++ b/contrib/TSM/README.md @@ -129,3 +129,6 @@ def video2img(): subprocess.call(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) ``` + +**步骤5** 查看结果 +可以查看到结果为26种手势之一。 -- Gitee From b2df649ed47c3f5ae127331e49a651f268a4de48 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 1 Nov 2024 08:51:43 +0000 Subject: [PATCH 111/129] update contrib/CamouflagedObjectDetection/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CamouflagedObjectDetection/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md index 8e0b324af..22f3fb0c3 100644 --- a/contrib/CamouflagedObjectDetection/README.md +++ b/contrib/CamouflagedObjectDetection/README.md @@ -8,13 +8,14 @@ ### 1.2 支持的产品 -昇腾Atlas310 +本项目以昇腾Atlas310B为主要的硬件平台。 ### 1.3 支持的版本 本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: | MxVision版本 | CANN版本 | Driver/Firmware版本 | | --------- | ------------------ | -------------- | | 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ### 1.4 三方依赖 | 软件名称 | 版本 | @@ -91,6 +92,7 @@ atc --framework=5 --model=DGNet.onnx --output=DGNet --input_shape="image:1,3,352 ```bash python inference_om.py --om_path ./snapshots/DGNet/DGNet.om --save_path ./seg_results_om/Exp-DGNet-OM/NC4K/ --data_path ./data/NC4K/Imgs ``` +**步骤3** 查看结果 ## 5 性能验证 -- Gitee From 49e40d57b6a9ed6376b4958d86b1213e116eaf48 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Fri, 1 Nov 2024 08:55:17 +0000 Subject: [PATCH 112/129] update contrib/IAT/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/IAT/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md index a4b27b643..713559f1a 100644 --- a/contrib/IAT/README.md +++ b/contrib/IAT/README.md @@ -24,10 +24,8 @@ | Python | 3.9.2 | | numpy | 1.22.3 | | opencv-python | 4.5.5 | -| onnxsim | 0.4.10 | - -### 1.4 代码目录结构说明 +### 1.5 代码目录结构说明 eg:本sample工程名称为XXX,工程目录如下图所示: -- Gitee From c725dbe89d741e78e183f063ca8fccb4a216d6cb Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 01:42:56 +0000 Subject: [PATCH 113/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index ed44ab175..701701581 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -8,7 +8,7 @@ ### 1.2 支持的产品 -本项目以昇腾Atlas310B为主要的硬件平台。 +本项目以昇腾Atlas 500 A2为主要的硬件平台。 ### 1.3 支持的版本 本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: -- Gitee From e6f02f4a39b58de9f8b1d170609dc08bda326b3e Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 01:43:15 +0000 Subject: [PATCH 114/129] update contrib/EdgeDetectionPicture/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/EdgeDetectionPicture/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/EdgeDetectionPicture/README.md b/contrib/EdgeDetectionPicture/README.md index 8d541ec69..ea733ce1e 100644 --- a/contrib/EdgeDetectionPicture/README.md +++ b/contrib/EdgeDetectionPicture/README.md @@ -8,7 +8,7 @@ 其中包含Rcf模型的后处理模块开发。 主要处理流程为: Init > ReadImage >Resize > Inference >PostProcess >DeInit #### 1.2 支持的产品 -昇腾310B +本项目以昇腾Atlas 500 A2为主要的硬件平台。 #### 1.3 支持的版本 本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: -- Gitee From 900089f2585ded29899e9c4a5b303c98ea3e6736 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 01:43:34 +0000 Subject: [PATCH 115/129] update contrib/TSM/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/TSM/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/TSM/README.md b/contrib/TSM/README.md index f15cc9065..090270634 100644 --- a/contrib/TSM/README.md +++ b/contrib/TSM/README.md @@ -7,7 +7,7 @@ ### 1.2 支持的产品 -以昇腾Atlas310B卡为主要的硬件平台 +本项目以昇腾Atlas 500 A2为主要的硬件平台。 ### 1.3 支持的版本 本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: -- Gitee From 6b796bbeb09d6003df04d16621ff318f434aae31 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 01:43:49 +0000 Subject: [PATCH 116/129] update contrib/CrowdCounting/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CrowdCounting/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/CrowdCounting/README.md b/contrib/CrowdCounting/README.md index 0afa2ca32..d63b1cc5b 100644 --- a/contrib/CrowdCounting/README.md +++ b/contrib/CrowdCounting/README.md @@ -7,7 +7,7 @@ ### 1.2 支持的产品 -支持昇腾310B芯片 +本项目以昇腾Atlas 500 A2为主要的硬件平台。 ### 1.3 支持的版本 -- Gitee From d0ed61927b0d4e12ad18506f1d0818fb42bb1717 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 01:44:11 +0000 Subject: [PATCH 117/129] update contrib/CamouflagedObjectDetection/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/CamouflagedObjectDetection/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/CamouflagedObjectDetection/README.md b/contrib/CamouflagedObjectDetection/README.md index 22f3fb0c3..260480d20 100644 --- a/contrib/CamouflagedObjectDetection/README.md +++ b/contrib/CamouflagedObjectDetection/README.md @@ -8,7 +8,7 @@ ### 1.2 支持的产品 -本项目以昇腾Atlas310B为主要的硬件平台。 +本项目以昇腾Atlas 500 A2为主要的硬件平台。 ### 1.3 支持的版本 本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: -- Gitee From 3f48e0c70139cb727143dc57d2e15d210834807d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 01:44:30 +0000 Subject: [PATCH 118/129] update contrib/IAT/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/IAT/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/IAT/README.md b/contrib/IAT/README.md index 713559f1a..0ffb8bf1a 100644 --- a/contrib/IAT/README.md +++ b/contrib/IAT/README.md @@ -7,7 +7,7 @@ ### 1.2 支持的产品 -支持昇腾310B芯片 +本项目以昇腾Atlas 500 A2为主要的硬件平台。 ### 1.3 支持的版本 -- Gitee From 938a594e8f3e2472cbf505c8f0477e215fdf85ab Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 01:44:50 +0000 Subject: [PATCH 119/129] update contrib/VCOD_SLTNet/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VCOD_SLTNet/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/VCOD_SLTNet/README.md b/contrib/VCOD_SLTNet/README.md index 86ad7b3a0..5c1a5f0e2 100644 --- a/contrib/VCOD_SLTNet/README.md +++ b/contrib/VCOD_SLTNet/README.md @@ -9,7 +9,7 @@ ### 1.2 支持的产品 -支持昇腾310B芯片 +本项目以昇腾Atlas 500 A2为主要的硬件平台。 ### 1.3 支持的版本 -- Gitee From fd56806c71eb6ee583a6985cb3a3940b0a46c9eb Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 07:06:34 +0000 Subject: [PATCH 120/129] update tutorials/mxBaseSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/mxBaseSample/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tutorials/mxBaseSample/README.md b/tutorials/mxBaseSample/README.md index f2b6414fa..d9f2a5b44 100644 --- a/tutorials/mxBaseSample/README.md +++ b/tutorials/mxBaseSample/README.md @@ -24,11 +24,10 @@ # 设置环境变量 . ${ascend-toolkit-path}/set_env.sh . ${SDK-path}/set_env.sh - +``` # 环境变量介绍 ascend-toolkit-path: CANN 安装路径 SDK-path: SDK mxVision 安装路径 -``` ## 3 准备模型 **步骤1** 模型获取 -- Gitee From 910b57e6cccfd06a4791833b6356a2d0fe2c97e5 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 07:06:48 +0000 Subject: [PATCH 121/129] update tutorials/mxBaseSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/mxBaseSample/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/mxBaseSample/README.md b/tutorials/mxBaseSample/README.md index d9f2a5b44..b716bb0f3 100644 --- a/tutorials/mxBaseSample/README.md +++ b/tutorials/mxBaseSample/README.md @@ -25,7 +25,7 @@ . ${ascend-toolkit-path}/set_env.sh . ${SDK-path}/set_env.sh ``` -# 环境变量介绍 +环境变量介绍 ascend-toolkit-path: CANN 安装路径 SDK-path: SDK mxVision 安装路径 -- Gitee From 9e7241fe5d72854c752bd66f7e4ae445dcfd337d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 07:07:05 +0000 Subject: [PATCH 122/129] update tutorials/mxBaseSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/mxBaseSample/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tutorials/mxBaseSample/README.md b/tutorials/mxBaseSample/README.md index b716bb0f3..a27bbc2a8 100644 --- a/tutorials/mxBaseSample/README.md +++ b/tutorials/mxBaseSample/README.md @@ -25,8 +25,10 @@ . ${ascend-toolkit-path}/set_env.sh . ${SDK-path}/set_env.sh ``` -环境变量介绍 +环境变量介绍: + ascend-toolkit-path: CANN 安装路径 + SDK-path: SDK mxVision 安装路径 ## 3 准备模型 -- Gitee From 90f078e9d48c578fd641998181b1e2cd8d35e3ca Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 07:07:40 +0000 Subject: [PATCH 123/129] update tutorials/DvppWrapperSample/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- tutorials/DvppWrapperSample/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/DvppWrapperSample/README.md b/tutorials/DvppWrapperSample/README.md index 4166067b6..7ebe0aa13 100644 --- a/tutorials/DvppWrapperSample/README.md +++ b/tutorials/DvppWrapperSample/README.md @@ -8,7 +8,7 @@ ### 1.2 支持的产品 -本项目以昇腾Atlas310p为主要的硬件平台。 +本项目支持昇腾Atlas 300I pro、 Atlas300V pro。 ### 1.3 支持的版本 -- Gitee From ea30f709e2926d496a53837fc00298a5024ee492 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 07:11:08 +0000 Subject: [PATCH 124/129] update contrib/VehicleIdentification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VehicleIdentification/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/VehicleIdentification/README.md b/contrib/VehicleIdentification/README.md index 527fa1abb..14ea1fcc4 100644 --- a/contrib/VehicleIdentification/README.md +++ b/contrib/VehicleIdentification/README.md @@ -9,7 +9,7 @@ ### 1.1 支持的产品 -支持昇腾310芯片 +本项目以昇腾Atlas 500 A2为主要的硬件平台。 ### 1.2 支持的版本 -- Gitee From bea553be76c40fcb5b09e773a8d9e2efaca48e81 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 07:13:16 +0000 Subject: [PATCH 125/129] update contrib/VehicleIdentification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VehicleIdentification/README.md | 59 ++++++------------------- 1 file changed, 13 insertions(+), 46 deletions(-) diff --git a/contrib/VehicleIdentification/README.md b/contrib/VehicleIdentification/README.md index 14ea1fcc4..c8fc1c8a3 100644 --- a/contrib/VehicleIdentification/README.md +++ b/contrib/VehicleIdentification/README.md @@ -1,33 +1,25 @@ # 车型识别 ## 1 介绍 + +### 1.1 简介 在本系统中,目的是基于MindX SDK,在昇腾平台上,开发端到端车型识别的参考设计,实现对图像中的车辆进行车型识别的功能,并把可视化结果保存到本地,达到功能要求。 样例输入:带有车辆的jpg图片。 样例输出:框出并标有车辆车型与置信度的jpg图片。 -### 1.1 支持的产品 +### 1.2 支持的产品 本项目以昇腾Atlas 500 A2为主要的硬件平台。 -### 1.2 支持的版本 - -CANN:7.0.RC1 - -SDK:mxVision 5.0.RC3(可通过cat SDK目录下的 version.info 查看) +### 1.3 支持的版本 -版本号查询方法,在Atlas产品环境下,运行命令: - -```bash -npu-smi info -``` -可以查询支持SDK的版本号 - - -### 1.3 软件方案介绍 - -本方案中,采用yolov3预训练模型对输入图片进行车辆识别,车辆识别后对识别出的车辆图像进行抠图,然后使用GoogLeNet_cars模型进行车型识别,最终根据GoogLeNet_cars模型识别得到的车型信息和置信度生成框出并标有车辆车型与置信度的jpg图片。 +本样例配套的MxVision版本、CANN版本、Driver/Firmware版本如下所示: +| MxVision版本 | CANN版本 | Driver/Firmware版本 | +| --------- | ------------------ | -------------- | +| 5.0.0 | 7.0.0 | 23.0.0 | +| 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | ### 1.4 代码目录结构与说明 @@ -62,34 +54,7 @@ npu-smi info └── build.sh # 编译车型识别后处理插件脚本 ``` -### 1.5 技术实现流程图 - -![process](./img/process.png) - -图1 车型识别流程图 - - - -![pipeline](./img/pipeline.png) - -图2 车型识别pipeline示意图 - - -### 1.6 适用场景 -项目适用于光照条件较好,车辆重叠程度低,车辆轮廓明显,且图片较清晰的测试图片 - -**注**:由于GoogLeNet_cars模型限制,仅支持识别在`./models/vehicle/car.names`文件中的 **431** 种车辆。且由于此模型为2015年训练,在识别2015年之后外观有较大变化的车辆时误差较大。 - -## 2 环境依赖 - -| 软件名称 | 版本 | -| :--------: | :------: | -|Ubuntu|18.04.1 LTS | -| MindX SDK | 5.0.RC3 | -| CANN | 7.0.RC1 | -|Python|3.9.2| -|numpy|1.22.3| -|opencv-python|4.5.5| +## 2 设置环境变量 在编译运行项目前,需要设置环境变量: @@ -117,7 +82,7 @@ source ~/.bashrc env ``` -## 3 模型获取 +## 3 准备模型 ### 3.1 yolo模型转换 @@ -230,6 +195,8 @@ chmod 640 ./lib/libvehiclepostprocess.so python3 main.py ``` +**步骤4** 查看结果 + 执行后会在终端按顺序输出车辆的车型信息和置信度 生成的结果图片中添加方框框出车辆,在方框左上角标出车型信息和置信度,按 **{原名}_result.jpg** 的命名规则存储在`./result`目录下,查看结果文件验证检测结果。 -- Gitee From db1686f0736b54f337ee64c587007d94fca39ea2 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 07:13:38 +0000 Subject: [PATCH 126/129] update contrib/VehicleIdentification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VehicleIdentification/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/VehicleIdentification/README.md b/contrib/VehicleIdentification/README.md index c8fc1c8a3..034b852bc 100644 --- a/contrib/VehicleIdentification/README.md +++ b/contrib/VehicleIdentification/README.md @@ -22,7 +22,7 @@ | 6.0.RC2 | 8.0.RC2 | 24.1.RC2 | -### 1.4 代码目录结构与说明 +### 1.4 代码目录结构说明 本工程名称为VehicleIdentification,工程目录如下图所示: ``` -- Gitee From db5d94b3f9522708cdaca7a8202f1099613e3581 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 5 Nov 2024 06:47:52 +0000 Subject: [PATCH 127/129] update contrib/VehicleIdentification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VehicleIdentification/README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/contrib/VehicleIdentification/README.md b/contrib/VehicleIdentification/README.md index 034b852bc..988610e50 100644 --- a/contrib/VehicleIdentification/README.md +++ b/contrib/VehicleIdentification/README.md @@ -60,10 +60,12 @@ - 环境变量介绍 +执行如下命令,打开.bashrc文件 ```bash -# 执行如下命令,打开.bashrc文件 vi .bashrc -# 在.bashrc文件中添加以下环境变量 +``` +在.bashrc文件中添加以下环境变量 +``` export MX_SDK_HOME=${SDK安装路径} export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/driver/lib64/ @@ -73,12 +75,16 @@ export GST_PLUGIN_SCANNER=${MX_SDK_HOME}/opensource/libexec/gstreamer-1.0/gst-pl export GST_PLUGIN_PATH=${MX_SDK_HOME}/opensource/lib/gstreamer-1.0:${MX_SDK_HOME}/lib/plugins export PYTHONPATH=${MX_SDK_HOME}/python:$PYTHONPATH +``` -# 保存退出.bashrc文件 -# 执行如下命令使环境变量生效 +保存退出.bashrc文件 +执行如下命令使环境变量生效 +``` source ~/.bashrc +``` -#查看环境变量 +查看环境变量 +``` env ``` -- Gitee From 4b9edc289fc3975a46354ff38d9dd70556dd7395 Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 5 Nov 2024 07:53:49 +0000 Subject: [PATCH 128/129] update contrib/BertTextClassification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/BertTextClassification/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/BertTextClassification/README.md b/contrib/BertTextClassification/README.md index 701701581..52b0a3cb1 100644 --- a/contrib/BertTextClassification/README.md +++ b/contrib/BertTextClassification/README.md @@ -75,11 +75,11 @@ # 设置环境变量 . ${ascend-toolkit-path}/set_env.sh . ${SDK-path}/set_env.sh - -# 环境变量介绍 +``` +环境变量介绍 ascend-toolkit-path: CANN 安装路径 SDK-path: SDK mxVision 安装路径 -``` + ## 3 准备模型 **步骤1** 请参考https://mindx.sdk.obs.myhuaweicloud.com/mindxsdk-referenceapps%20/contrib/BertTextClassification/bert_text_classification.pb -- Gitee From 013634cd7151bf5534dbaebf04fffb252404f24d Mon Sep 17 00:00:00 2001 From: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> Date: Tue, 5 Nov 2024 07:54:38 +0000 Subject: [PATCH 129/129] update contrib/VehicleIdentification/README.md. Signed-off-by: ComistryMo <12393292+comistrymo@user.noreply.gitee.com> --- contrib/VehicleIdentification/README.md | 43 +++++-------------------- 1 file changed, 8 insertions(+), 35 deletions(-) diff --git a/contrib/VehicleIdentification/README.md b/contrib/VehicleIdentification/README.md index 988610e50..b6ad062c3 100644 --- a/contrib/VehicleIdentification/README.md +++ b/contrib/VehicleIdentification/README.md @@ -56,37 +56,18 @@ ## 2 设置环境变量 -在编译运行项目前,需要设置环境变量: - -- 环境变量介绍 - -执行如下命令,打开.bashrc文件 -```bash -vi .bashrc -``` -在.bashrc文件中添加以下环境变量 -``` -export MX_SDK_HOME=${SDK安装路径} - -export LD_LIBRARY_PATH=${MX_SDK_HOME}/lib:${MX_SDK_HOME}/opensource/lib:${MX_SDK_HOME}/opensource/lib64:/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:/usr/local/Ascend/driver/lib64/ +确保环境中正确安装mxVision SDK。 -export GST_PLUGIN_SCANNER=${MX_SDK_HOME}/opensource/libexec/gstreamer-1.0/gst-plugin-scanner - -export GST_PLUGIN_PATH=${MX_SDK_HOME}/opensource/lib/gstreamer-1.0:${MX_SDK_HOME}/lib/plugins - -export PYTHONPATH=${MX_SDK_HOME}/python:$PYTHONPATH -``` - -保存退出.bashrc文件 -执行如下命令使环境变量生效 -``` -source ~/.bashrc -``` +在编译运行项目前,需要设置环境变量: -查看环境变量 ``` -env +# 设置环境变量 +. ${ascend-toolkit-path}/set_env.sh +. ${SDK-path}/set_env.sh ``` +环境变量介绍 +ascend-toolkit-path: CANN 安装路径 +SDK-path: SDK mxVision 安装路径 ## 3 准备模型 @@ -101,14 +82,6 @@ env 在`./models/yolo`目录下执行一下命令 ```bash -# 设置环境变量(请确认install_path路径是否正确) -# Set environment PATH (Please confirm that the install_path is correct). - -export install_path=/usr/local/Ascend/ascend-toolkit/latest -export PATH=/usr/local/python3.9.2/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH -export PYTHONPATH=${install_path}/atc/python/site-packages:${install_path}/atc/python/site-packages/auto_tune.egg/auto_tune:${install_path}/atc/python/site-packages/schedule_search.egg -export LD_LIBRARY_PATH=${install_path}/atc/lib64:$LD_LIBRARY_PATH -export ASCEND_OPP_PATH=${install_path}/opp # 执行,转换YOLOv3模型 # Execute, transform YOLOv3 model. -- Gitee