From ce04c3f5bae3c59c80a577d808b19d965c930d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Wed, 3 Apr 2024 17:52:59 +0800 Subject: [PATCH 01/19] add --- Samples/YOLOV5MultiInput/README.md | 12 ++++++++++++ Samples/YOLOV5USBCamera/README.md | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/Samples/YOLOV5MultiInput/README.md b/Samples/YOLOV5MultiInput/README.md index 9719db5..a2f7761 100644 --- a/Samples/YOLOV5MultiInput/README.md +++ b/Samples/YOLOV5MultiInput/README.md @@ -105,6 +105,18 @@ bash sample_run.sh stdout ``` +#### 性能数据 + + 以下为该样例,单路共计处理115帧,单路帧率3FPS,共计16路离线mp4视频作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: + | 场景 | 数据 | +|-------------------|----------| +| 使用msame工具计算模型推理耗时 | 18.19 ms | +| 处理单帧图片预处理耗时 | 30.99ms | +| 处理单帧图片推理耗时 | 21.75 ms | +| 处理单帧图片后处理耗时 | 0.69 ms | +| 后处理FPS | 42fps | + + #### 相关操作 - 获取更多样例,请单击[Link](https://gitee.com/ascend/samples/tree/master/inference/modelInference)。 diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index 4d5f179..2b1ef43 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -107,6 +107,17 @@ bash sample_run.sh stdout ``` +#### 性能数据 + + 以下为该样例,单路共计处理100帧,单路帧率10FPS的usbcamera采集数据作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: + | 场景 | 数据 | +|-------------------|----------| +| 使用msame工具计算模型推理耗时 | 22.37 ms | +| 处理单帧图片预处理耗时 | 10.00 ms | +| 处理单帧图片推理耗时 | 22.85 ms | +| 处理单帧图片后处理耗时 | 33.93 ms | +| 后处理FPS | 10fps | + #### 相关操作 - 获取更多样例,请单击[Link](https://gitee.com/ascend/samples/tree/master/inference/modelInference)。 -- Gitee From f0bc590e86725d0dcd5fba8afbad48c5b622dec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Mon, 8 Apr 2024 03:20:05 +0000 Subject: [PATCH 02/19] update Samples/YOLOV5MultiInput/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5MultiInput/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Samples/YOLOV5MultiInput/README.md b/Samples/YOLOV5MultiInput/README.md index a2f7761..d203467 100644 --- a/Samples/YOLOV5MultiInput/README.md +++ b/Samples/YOLOV5MultiInput/README.md @@ -110,11 +110,10 @@ 以下为该样例,单路共计处理115帧,单路帧率3FPS,共计16路离线mp4视频作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: | 场景 | 数据 | |-------------------|----------| -| 使用msame工具计算模型推理耗时 | 18.19 ms | -| 处理单帧图片预处理耗时 | 30.99ms | -| 处理单帧图片推理耗时 | 21.75 ms | -| 处理单帧图片后处理耗时 | 0.69 ms | -| 后处理FPS | 42fps | +| 案例端到端执行平均耗时 | 23.81 毫秒/帧 | +| 预处理平均耗时 | 30.99 毫秒/帧 | +| 推理平均耗时 | 21.75 毫秒/帧 | +| 后处理平均耗时 | 0.69 毫秒/帧 | #### 相关操作 -- Gitee From 68063136ab5184bf8985b4ec127b3faa76723766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Mon, 8 Apr 2024 06:49:02 +0000 Subject: [PATCH 03/19] update Samples/YOLOV5USBCamera/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5USBCamera/README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index 2b1ef43..86e030c 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -109,14 +109,13 @@ #### 性能数据 - 以下为该样例,单路共计处理100帧,单路帧率10FPS的usbcamera采集数据作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: + 以下为该样例,单路共计处理100帧,单路分辨率640*480,帧率30FPS的usbcamera采集数据作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: | 场景 | 数据 | |-------------------|----------| -| 使用msame工具计算模型推理耗时 | 22.37 ms | -| 处理单帧图片预处理耗时 | 10.00 ms | -| 处理单帧图片推理耗时 | 22.85 ms | -| 处理单帧图片后处理耗时 | 33.93 ms | -| 后处理FPS | 10fps | +| 案例端到端执行平均耗时 | 37.44 ms | +| 预处理平均耗时 | 10.00 ms | +| 推理平均耗时 | 22.85 ms | +| 后处理平均耗时 | 33.93 ms | #### 相关操作 -- Gitee From 74c3b7a7fbde5873da5ee3fc9c3edec4f65b5ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Mon, 8 Apr 2024 06:54:36 +0000 Subject: [PATCH 04/19] update Samples/YOLOV5USBCamera/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5USBCamera/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index 86e030c..1035fbf 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -112,10 +112,10 @@ 以下为该样例,单路共计处理100帧,单路分辨率640*480,帧率30FPS的usbcamera采集数据作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: | 场景 | 数据 | |-------------------|----------| -| 案例端到端执行平均耗时 | 37.44 ms | -| 预处理平均耗时 | 10.00 ms | -| 推理平均耗时 | 22.85 ms | -| 后处理平均耗时 | 33.93 ms | +| 案例端到端执行平均耗时 | 37.44 毫秒/帧 | +| 预处理平均耗时 | 10.00 毫秒/帧 | +| 推理平均耗时 | 22.85 毫秒/帧 | +| 后处理平均耗时 | 33.93 毫秒/帧 | #### 相关操作 -- Gitee From b62602f9e5625af0edf10f079df42bb841accc88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Mon, 8 Apr 2024 06:55:47 +0000 Subject: [PATCH 05/19] update Samples/YOLOV5MultiInput/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5MultiInput/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples/YOLOV5MultiInput/README.md b/Samples/YOLOV5MultiInput/README.md index d203467..f57942a 100644 --- a/Samples/YOLOV5MultiInput/README.md +++ b/Samples/YOLOV5MultiInput/README.md @@ -107,7 +107,7 @@ #### 性能数据 - 以下为该样例,单路共计处理115帧,单路帧率3FPS,共计16路离线mp4视频作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: + 以下为该样例,单路共计处理115帧,单路分辨率1920*1080,帧率3FPS,共计16路离线mp4视频作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: | 场景 | 数据 | |-------------------|----------| | 案例端到端执行平均耗时 | 23.81 毫秒/帧 | -- Gitee From baca7a567e04eeea7e697dacc50002871f86de7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Mon, 8 Apr 2024 13:09:52 +0000 Subject: [PATCH 06/19] update Samples/YOLOV5MultiInput/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5MultiInput/README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Samples/YOLOV5MultiInput/README.md b/Samples/YOLOV5MultiInput/README.md index f57942a..051b6eb 100644 --- a/Samples/YOLOV5MultiInput/README.md +++ b/Samples/YOLOV5MultiInput/README.md @@ -107,14 +107,13 @@ #### 性能数据 - 以下为该样例,单路共计处理115帧,单路分辨率1920*1080,帧率3FPS,共计16路离线mp4视频作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: + 以下为该样例,共计16路1920*1080P离线mp4视频作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: | 场景 | 数据 | |-------------------|----------| -| 案例端到端执行平均耗时 | 23.81 毫秒/帧 | -| 预处理平均耗时 | 30.99 毫秒/帧 | -| 推理平均耗时 | 21.75 毫秒/帧 | -| 后处理平均耗时 | 0.69 毫秒/帧 | - +| 案例端到端执行耗时 | 23.81 毫秒/帧 | +| 预处理耗时 | 30.99 毫秒/帧 | +| 推理耗时 | 21.75 毫秒/帧 | +| 后处理耗时 | 0.69 毫秒/帧 | #### 相关操作 -- Gitee From b4adb701de3b658d1ba462a72e97f19f38e2bbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Mon, 8 Apr 2024 13:16:07 +0000 Subject: [PATCH 07/19] update Samples/YOLOV5MultiInput/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5MultiInput/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Samples/YOLOV5MultiInput/README.md b/Samples/YOLOV5MultiInput/README.md index 051b6eb..bcfd565 100644 --- a/Samples/YOLOV5MultiInput/README.md +++ b/Samples/YOLOV5MultiInput/README.md @@ -110,9 +110,9 @@ 以下为该样例,共计16路1920*1080P离线mp4视频作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: | 场景 | 数据 | |-------------------|----------| -| 案例端到端执行耗时 | 23.81 毫秒/帧 | -| 预处理耗时 | 30.99 毫秒/帧 | -| 推理耗时 | 21.75 毫秒/帧 | +| 案例端到端执行耗时 | 21.47 毫秒/帧 | +| 预处理耗时 | 28.96 毫秒/帧 | +| 推理耗时 | 20.70 毫秒/帧 | | 后处理耗时 | 0.69 毫秒/帧 | #### 相关操作 -- Gitee From 74c837e8e5ddf228be08444c7688f681ad4d0e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Mon, 8 Apr 2024 13:17:28 +0000 Subject: [PATCH 08/19] update Samples/YOLOV5USBCamera/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5USBCamera/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index 1035fbf..337db16 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -109,7 +109,7 @@ #### 性能数据 - 以下为该样例,单路共计处理100帧,单路分辨率640*480,帧率30FPS的usbcamera采集数据作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: + 以下为该样例,单路640*480P,帧率30FPS的usbcamera采集数据作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: | 场景 | 数据 | |-------------------|----------| | 案例端到端执行平均耗时 | 37.44 毫秒/帧 | -- Gitee From 1a8f218c9b76ab10298832f6854cc9934d2a690c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Mon, 8 Apr 2024 13:25:11 +0000 Subject: [PATCH 09/19] update Samples/YOLOV5USBCamera/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5USBCamera/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index 337db16..20ec04c 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -112,10 +112,10 @@ 以下为该样例,单路640*480P,帧率30FPS的usbcamera采集数据作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: | 场景 | 数据 | |-------------------|----------| -| 案例端到端执行平均耗时 | 37.44 毫秒/帧 | -| 预处理平均耗时 | 10.00 毫秒/帧 | -| 推理平均耗时 | 22.85 毫秒/帧 | -| 后处理平均耗时 | 33.93 毫秒/帧 | +| 案例端到端执行耗时 | 39.43 毫秒/帧 | +| 预处理耗时 | 4.98 毫秒/帧 | +| 推理耗时 | 22.73 毫秒/帧 | +| 后处理耗时 | 34.17 毫秒/帧 | #### 相关操作 -- Gitee From 49145ffbb5007a98568ea83acf17c48e6c8662e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Tue, 9 Apr 2024 08:01:32 +0000 Subject: [PATCH 10/19] update Samples/YOLOV5USBCamera/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5USBCamera/README.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index 20ec04c..ab7deae 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -107,15 +107,11 @@ bash sample_run.sh stdout ``` -#### 性能数据 - - 以下为该样例,单路640*480P,帧率30FPS的usbcamera采集数据作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: - | 场景 | 数据 | -|-------------------|----------| -| 案例端到端执行耗时 | 39.43 毫秒/帧 | -| 预处理耗时 | 4.98 毫秒/帧 | -| 推理耗时 | 22.73 毫秒/帧 | -| 后处理耗时 | 34.17 毫秒/帧 | +#### 推理性能:310B4 + +| 批量大小 | 平均吞吐量 | +|------|-------| +| 1 | 25图片/秒 | #### 相关操作 -- Gitee From 757bfdd743e1d3510d8ab9da6c09114c3c437e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Tue, 9 Apr 2024 08:04:51 +0000 Subject: [PATCH 11/19] update Samples/YOLOV5MultiInput/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5MultiInput/README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Samples/YOLOV5MultiInput/README.md b/Samples/YOLOV5MultiInput/README.md index bcfd565..18f19ae 100644 --- a/Samples/YOLOV5MultiInput/README.md +++ b/Samples/YOLOV5MultiInput/README.md @@ -105,15 +105,12 @@ bash sample_run.sh stdout ``` -#### 性能数据 - - 以下为该样例,共计16路1920*1080P离线mp4视频作为输入,stdout作为输出打印方式情形下,案例执行的部分性能数据: - | 场景 | 数据 | -|-------------------|----------| -| 案例端到端执行耗时 | 21.47 毫秒/帧 | -| 预处理耗时 | 28.96 毫秒/帧 | -| 推理耗时 | 20.70 毫秒/帧 | -| 后处理耗时 | 0.69 毫秒/帧 | +#### 推理性能:310B4 + +| 批量大小 | 平均吞吐量 | +|------|-------| +| 1 | 46图片/秒 | + #### 相关操作 -- Gitee From fbb8be857f11cb6b75925daf1cdd6fbcec67178b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Tue, 9 Apr 2024 08:06:04 +0000 Subject: [PATCH 12/19] update Samples/YOLOV5MultiInput/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5MultiInput/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples/YOLOV5MultiInput/README.md b/Samples/YOLOV5MultiInput/README.md index 18f19ae..58ef250 100644 --- a/Samples/YOLOV5MultiInput/README.md +++ b/Samples/YOLOV5MultiInput/README.md @@ -105,7 +105,7 @@ bash sample_run.sh stdout ``` -#### 推理性能:310B4 +#### 推理性能 | 批量大小 | 平均吞吐量 | |------|-------| -- Gitee From 5ab9fe5279c6e451cec4362b4be64f95292384c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Tue, 9 Apr 2024 08:06:27 +0000 Subject: [PATCH 13/19] update Samples/YOLOV5USBCamera/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5USBCamera/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index ab7deae..ceb98e1 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -107,7 +107,7 @@ bash sample_run.sh stdout ``` -#### 推理性能:310B4 +#### 推理性能 | 批量大小 | 平均吞吐量 | |------|-------| -- Gitee From 7258147b4db6ae679994a3657d3aaf401cc65585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Tue, 9 Apr 2024 11:29:16 +0000 Subject: [PATCH 14/19] update Samples/YOLOV5USBCamera/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5USBCamera/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index ceb98e1..89a962c 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -109,9 +109,9 @@ #### 推理性能 -| 批量大小 | 平均吞吐量 | -|------|-------| -| 1 | 25图片/秒 | +| 批量大小 | 平均吞吐量 | 预处理耗时 | 推理耗时 | 后处理耗时 | +|------|---------|-----------|------------|------------| +| 1 | 25 图片/秒 | 4.98 毫秒/帧 | 22.73 毫秒/帧 | 34.17 毫秒/帧 | #### 相关操作 -- Gitee From a865a1010e60f8be91756976c6805dd7a1222e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Tue, 9 Apr 2024 11:35:58 +0000 Subject: [PATCH 15/19] update Samples/YOLOV5MultiInput/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5MultiInput/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Samples/YOLOV5MultiInput/README.md b/Samples/YOLOV5MultiInput/README.md index 58ef250..a772c90 100644 --- a/Samples/YOLOV5MultiInput/README.md +++ b/Samples/YOLOV5MultiInput/README.md @@ -107,9 +107,9 @@ #### 推理性能 -| 批量大小 | 平均吞吐量 | -|------|-------| -| 1 | 46图片/秒 | +| 批量大小 | 平均吞吐量 | 预处理耗时 | 推理耗时 | 后处理耗时 | +|------|---------|-----------|------------|------------| +| 1 | 46 图片/秒 | 28.96 毫秒/帧 | 20.70 毫秒/帧 | 0.69 毫秒/帧 | #### 相关操作 -- Gitee From 8c9565d9f2e76f4432aca96a09703c88ae00ffd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Tue, 9 Apr 2024 11:47:07 +0000 Subject: [PATCH 16/19] update Samples/YOLOV5MultiInput/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5MultiInput/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Samples/YOLOV5MultiInput/README.md b/Samples/YOLOV5MultiInput/README.md index a772c90..3748547 100644 --- a/Samples/YOLOV5MultiInput/README.md +++ b/Samples/YOLOV5MultiInput/README.md @@ -107,9 +107,9 @@ #### 推理性能 -| 批量大小 | 平均吞吐量 | 预处理耗时 | 推理耗时 | 后处理耗时 | -|------|---------|-----------|------------|------------| -| 1 | 46 图片/秒 | 28.96 毫秒/帧 | 20.70 毫秒/帧 | 0.69 毫秒/帧 | +| 平均吞吐量 | 预处理耗时 | 推理耗时 | 后处理耗时 | +|---------|-----------|------------|------------| +| 46 图片/秒 | 28.96 毫秒/帧 | 20.70 毫秒/帧 | 0.69 毫秒/帧 | #### 相关操作 -- Gitee From ff080bf2d3f5f5f80e3ea5c819075a85e81ac59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Tue, 9 Apr 2024 11:47:39 +0000 Subject: [PATCH 17/19] update Samples/YOLOV5USBCamera/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5USBCamera/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index 89a962c..9760631 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -109,9 +109,9 @@ #### 推理性能 -| 批量大小 | 平均吞吐量 | 预处理耗时 | 推理耗时 | 后处理耗时 | -|------|---------|-----------|------------|------------| -| 1 | 25 图片/秒 | 4.98 毫秒/帧 | 22.73 毫秒/帧 | 34.17 毫秒/帧 | +| 平均吞吐量 | 预处理耗时 | 推理耗时 | 后处理耗时 | +|---------|-----------|------------|------------| +| 25 图片/秒 | 4.98 毫秒/帧 | 22.73 毫秒/帧 | 34.17 毫秒/帧 | #### 相关操作 -- Gitee From 6c7518e7271ef02c0a4e68a36e21e3ab4d53a5e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Thu, 11 Apr 2024 20:23:46 +0800 Subject: [PATCH 18/19] m --- Samples/YOLOV5USBCamera/src/label.h | 40 ----- Samples/YOLOV5USBCamera/src/main.cpp | 245 +++++++++++---------------- 2 files changed, 101 insertions(+), 184 deletions(-) delete mode 100644 Samples/YOLOV5USBCamera/src/label.h diff --git a/Samples/YOLOV5USBCamera/src/label.h b/Samples/YOLOV5USBCamera/src/label.h deleted file mode 100644 index 246a2f4..0000000 --- a/Samples/YOLOV5USBCamera/src/label.h +++ /dev/null @@ -1,40 +0,0 @@ -/** -* Copyright (c) Huawei Technologies Co., Ltd. 2020-2022. 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. - -* File label.h -* Description: label result -*/ -#ifndef modelInference_label_H -#define modelInference_label_H -using namespace std; -const string label[] ={"person", "bicycle", "car", "motorbike", -"aeroplane", "bus", "train", "truck", "boat", -"traffic light", "fire hydrant", "stop sign", "parking meter", -"bench", "bird", "cat", "dog", "horse", -"sheep", "cow", "elephant", "bear", "zebra", -"giraffe", "backpack", "umbrella", "handbag", "tie", -"suitcase", "frisbee", "skis", "snowboard", "sports ball", -"kite", "baseball bat", "baseball glove", "skateboard", -"surfboard", -"tennis racket", "bottle", "wine glass", "cup", -"fork", "knife", "spoon", "bowl", "banana", -"apple", "sandwich", "orange", "broccoli", "carrot", -"hot dog", "pizza", "donut", "cake", "chair", -"sofa", "potted plant", "bed", "dining table", "toilet", -"TV monitor", "laptop", "mouse", "remote", "keyboard", -"cell phone", "microwave", "oven", "toaster", "sink", -"refrigerator", "book", "clock", "vase", "scissors", -"teddy bear", "hair drier", "toothbrush"}; -#endif //modelInference_label_H diff --git a/Samples/YOLOV5USBCamera/src/main.cpp b/Samples/YOLOV5USBCamera/src/main.cpp index b17ce56..8f8ef05 100644 --- a/Samples/YOLOV5USBCamera/src/main.cpp +++ b/Samples/YOLOV5USBCamera/src/main.cpp @@ -15,44 +15,78 @@ #include "acllite_media/CameraRead.h" #include "acllite_dvpp_lite/VideoRead.h" #include "acllite_common/Queue.h" -#include "label.h" using namespace std; using namespace acllite; using namespace cv; -aclrtContext context = nullptr; -uint32_t cvWidth = 1920; -uint32_t cvHeight = 1080; -cv::Mat cvImg = cv::Mat(cvHeight, cvWidth, CV_8UC3, cv::Scalar(0, 0, 0)); -uint32_t modelWidth = 640; -uint32_t modelHeight = 640; -bool exitFlag = false; -struct MsgData { - std::shared_ptr data = nullptr; - uint32_t size = 0; - bool videoEnd = false; - cv::Mat srcImg; -}; +namespace { + aclrtContext context = nullptr; + uint32_t cvWidth = 1920; + uint32_t cvHeight = 1080; + cv::Mat cvImg = cv::Mat(cvHeight, cvWidth, CV_8UC3, cv::Scalar(0, 0, 0)); + uint32_t modelWidth = 640; + uint32_t modelHeight = 640; + bool exitFlag = false; + size_t imageInfoSize; + void* imageInfoBuf; + struct MsgData { + std::shared_ptr data = nullptr; + uint32_t size = 0; + bool videoEnd = false; + cv::Mat srcImg; + }; -struct MsgOut { - cv::Mat srcImg; - bool videoEnd = false; - vector inferOutputs; -}; + struct MsgOut { + cv::Mat srcImg; + bool videoEnd = false; + vector inferOutputs; + }; -Queue msgDataQueue(32); -Queue msgOutQueue(32); -std::string displayMode = ""; -typedef struct BoundBox { - float x; - float y; - float width; - float height; - float score; - size_t classIndex; - size_t index; - } BoundBox; + Queue msgDataQueue(32); + Queue msgOutQueue(32); + std::string displayMode = ""; + const static std::vector yolov3Label = { "person", "bicycle", "car", "motorbike", + "aeroplane", "bus", "train", "truck", "boat", + "traffic light", "fire hydrant", "stop sign", "parking meter", + "bench", "bird", "cat", "dog", "horse", + "sheep", "cow", "elephant", "bear", "zebra", + "giraffe", "backpack", "umbrella", "handbag", "tie", + "suitcase", "frisbee", "skis", "snowboard", "sports ball", + "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", + "tennis racket", "bottle", "wine glass", "cup", + "fork", "knife", "spoon", "bowl", "banana", + "apple", "sandwich", "orange", "broccoli", "carrot", + "hot dog", "pizza", "donut", "cake", "chair", + "sofa", "potted plant", "bed", "dining table", "toilet", + "TV monitor", "laptop", "mouse", "remote", "keyboard", + "cell phone", "microwave", "oven", "toaster", "sink", + "refrigerator", "book", "clock", "vase", "scissors", + "teddy bear", "hair drier", "toothbrush" }; + + enum BBoxIndex { TOPLEFTX = 0, TOPLEFTY, BOTTOMRIGHTX, BOTTOMRIGHTY, SCORE, LABEL }; + // bounding box line solid + const uint32_t lineSolid = 2; + // opencv draw label params. + const double fountScale = 0.5; + const cv::Scalar fontColor(0, 0, 255); + const uint32_t labelOffset = 11; + // opencv color list for boundingbox + const vector colors { + cv::Scalar(237, 149, 100), cv::Scalar(0, 215, 255), cv::Scalar(50, 205, 50), + cv::Scalar(139, 85, 26) }; + struct Rect { + uint32_t ltX = 0; + uint32_t ltY = 0; + uint32_t rbX = 0; + uint32_t rbY = 0; + }; + struct BBox { + Rect rect; + uint32_t score; + string text; + }; +} bool Initparam(int argc, char *argv[]) { @@ -69,127 +103,35 @@ bool Initparam(int argc, char *argv[]) return true; } -bool sortScore(BoundBox box1, BoundBox box2) -{ - return box1.score > box2.score; -} - void GetResult(std::vector& inferOutputs, cv::Mat& srcImage, uint32_t modelWidth, uint32_t modelHeight) { - uint32_t outputDataBufId = 0; - float *classBuff = static_cast(inferOutputs[outputDataBufId].data.get()); - float confidenceThreshold = 0.25; - size_t classNum = 80; - size_t offset = 5; - size_t totalNumber = classNum + offset; - size_t modelOutputBoxNum = 25200; - size_t startIndex = 5; + float *detectData = static_cast(inferOutputs[0].data.get()); + uint32_t* boxNum = static_cast(inferOutputs[1].data.get()); + if (boxNum == nullptr) return; + uint32_t totalBox = boxNum[0]; int srcWidth = srcImage.cols; int srcHeight = srcImage.rows; - - vector boxes; - size_t yIndex = 1; - size_t widthIndex = 2; - size_t heightIndex = 3; - size_t classConfidenceIndex = 4; float widthScale = (float)(srcWidth) / modelWidth; float heightScale = (float)(srcHeight) / modelHeight; float finalScale = (widthScale > heightScale) ? widthScale : heightScale; - for (size_t i = 0; i < modelOutputBoxNum; ++i) { - float maxValue = 0; - float maxIndex = 0; - for (size_t j = startIndex; j < totalNumber; ++j) { - float value = classBuff[i * totalNumber + j] * classBuff[i * totalNumber + classConfidenceIndex]; - if (value > maxValue) { - maxIndex = j - startIndex; - maxValue = value; - } - } - float classConfidence = classBuff[i * totalNumber + classConfidenceIndex]; - if (classConfidence >= confidenceThreshold) { - size_t index = i * totalNumber + maxIndex + startIndex; - float finalConfidence = classConfidence * classBuff[index]; - BoundBox box; - box.x = classBuff[i * totalNumber] * finalScale; - box.y = classBuff[i * totalNumber + yIndex] * finalScale; - box.width = classBuff[i * totalNumber + widthIndex] * finalScale; - box.height = classBuff[i * totalNumber + heightIndex] * finalScale; - box.score = finalConfidence; - box.classIndex = maxIndex; - box.index = i; - if (maxIndex < classNum) { - boxes.push_back(box); - } - } - } - vector result; - result.clear(); - float NMSThreshold = 0.45; - int32_t maxLength = modelWidth > modelHeight ? modelWidth : modelHeight; - std::sort(boxes.begin(), boxes.end(), sortScore); - BoundBox boxMax; - BoundBox boxCompare; - while (boxes.size() != 0) { - size_t index = 1; - result.push_back(boxes[0]); - while (boxes.size() > index) { - boxMax.score = boxes[0].score; - boxMax.classIndex = boxes[0].classIndex; - boxMax.index = boxes[0].index; - boxMax.x = boxes[0].x + maxLength * boxes[0].classIndex; - boxMax.y = boxes[0].y + maxLength * boxes[0].classIndex; - boxMax.width = boxes[0].width; - boxMax.height = boxes[0].height; - - boxCompare.score = boxes[index].score; - boxCompare.classIndex = boxes[index].classIndex; - boxCompare.index = boxes[index].index; - boxCompare.x = boxes[index].x + boxes[index].classIndex * maxLength; - boxCompare.y = boxes[index].y + boxes[index].classIndex * maxLength; - boxCompare.width = boxes[index].width; - boxCompare.height = boxes[index].height; - float xLeft = max(boxMax.x, boxCompare.x); - float yTop = max(boxMax.y, boxCompare.y); - float xRight = min(boxMax.x + boxMax.width, boxCompare.x + boxCompare.width); - float yBottom = min(boxMax.y + boxMax.height, boxCompare.y + boxCompare.height); - float width = max(0.0f, xRight - xLeft); - float hight = max(0.0f, yBottom - yTop); - float area = width * hight; - float iou = area / (boxMax.width * boxMax.height + boxCompare.width * boxCompare.height - area); - if (iou > NMSThreshold) { - boxes.erase(boxes.begin() + index); - continue; - } - ++index; - } - boxes.erase(boxes.begin()); - } - const double fountScale = 0.5; - const uint32_t lineSolid = 2; - const uint32_t labelOffset = 11; - const cv::Scalar fountColor(0, 0, 255); - const vector colors{ - cv::Scalar(237, 149, 100), cv::Scalar(0, 215, 255), - cv::Scalar(50, 205, 50), cv::Scalar(139, 85, 26)}; - - int half = 2; string textPrint = "["; - for (size_t i = 0; i < result.size(); ++i) { - if (result[i].score < 0.7) { + for (uint32_t i = 0; i < totalBox; i++) { + cv::Point p1, p2; + uint32_t score = uint32_t(detectData[totalBox * SCORE + i] * 100); + if (score < 70) { continue; } - cv::Point leftUpPoint, rightBottomPoint; - leftUpPoint.x = result[i].x - result[i].width / half; - leftUpPoint.y = result[i].y - result[i].height / half; - rightBottomPoint.x = result[i].x + result[i].width / half; - rightBottomPoint.y = result[i].y + result[i].height / half; - cv::rectangle(srcImage, leftUpPoint, rightBottomPoint, colors[i % colors.size()], lineSolid); - string className = label[result[i].classIndex]; - string markString = to_string(result[i].score) + ":" + className; - textPrint += markString; - cv::putText(srcImage, markString, cv::Point(leftUpPoint.x, leftUpPoint.y + labelOffset), - cv::FONT_HERSHEY_COMPLEX, fountScale, fountColor); + p1.x = detectData[totalBox * TOPLEFTX + i] * finalScale; + p1.y = detectData[totalBox * TOPLEFTY + i] * finalScale; + p2.x = detectData[totalBox * BOTTOMRIGHTX + i] * finalScale; + p2.y = detectData[totalBox * BOTTOMRIGHTY + i] * finalScale; + uint32_t objIndex = (uint32_t)detectData[totalBox * LABEL + i]; + string text = yolov3Label[objIndex] + std::to_string(score) + "\%"; + textPrint = textPrint + text + " "; + cv::rectangle(srcImage, p1, p2, colors[i % colors.size()], lineSolid); + cv::putText(srcImage, text, cv::Point(p1.x, p1.y + labelOffset), + cv::FONT_HERSHEY_COMPLEX, fountScale, fontColor); } textPrint += "]"; if (displayMode == "imshow") { @@ -310,7 +252,7 @@ void* ModelExecute(void* arg) { bool ret = SetCurContext(context); CHECK_RET(ret, LOG_PRINT("[ERROR] set cur context for pthread %ld failed.", pthread_self()); return NULL); ModelProc modelProcess; - string modelPath = "../model/yolov5s.om"; + string modelPath = "../model/yolov5s_nms.om"; ret = modelProcess.Load(modelPath); CHECK_RET(ret, LOG_PRINT("[ERROR] load model %s failed.", modelPath.c_str()); return NULL); while(1) { @@ -320,7 +262,7 @@ void* ModelExecute(void* arg) { break; } else { - ret = modelProcess.CreateInput(static_cast(msgData.data.get()), msgData.size); + ret = modelProcess.CreateInput(static_cast(msgData.data.get()), msgData.size, imageInfoBuf, imageInfoSize); CHECK_RET(ret, LOG_PRINT("[ERROR] Create model input failed."); break); MsgOut msgOut; msgOut.srcImg = msgData.srcImg; @@ -365,6 +307,19 @@ void* PostProcess(void* arg) { return NULL; } +bool CreateBuffer(uint32_t modelWidth, uint32_t modelHeight) +{ + const float imageInfo[4] = {(float)modelWidth, (float)modelHeight, + (float)modelWidth, (float)modelHeight}; + imageInfoSize = sizeof(imageInfo); + imageInfoBuf = CopyDataToDevice((void*)imageInfo, imageInfoSize); + if (imageInfoBuf == nullptr) { + LOG_PRINT("[ERROR] Copy image info to device failed"); + return false; + } + return true; +} + int main(int argc, char *argv[]) { int32_t deviceId = 0; AclLiteResource aclResource(deviceId); @@ -373,7 +328,9 @@ int main(int argc, char *argv[]) { context = aclResource.GetContext(); ret = Initparam(argc, argv); CHECK_RET(ret, LOG_PRINT("[ERROR] Initparam failed."); return 1); - + ret = CreateBuffer(modelWidth, modelHeight); + CHECK_RET(ret, LOG_PRINT("[ERROR] CreateBuffer failed."); return 1); + pthread_t preTids, exeTids, posTids; // run usb camera: pthread_create(&preTids, NULL, GetInput, (void*)&deviceId); -- Gitee From 4dd9fdab57316244048b61bea70b6faacea00259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=B0=8F=E4=B8=BB?= Date: Thu, 11 Apr 2024 12:25:17 +0000 Subject: [PATCH 19/19] update Samples/YOLOV5USBCamera/README.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 哈小主 --- Samples/YOLOV5USBCamera/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Samples/YOLOV5USBCamera/README.md b/Samples/YOLOV5USBCamera/README.md index 9760631..04026ca 100644 --- a/Samples/YOLOV5USBCamera/README.md +++ b/Samples/YOLOV5USBCamera/README.md @@ -74,9 +74,9 @@ - 为了方便下载,在这里直接给出原始模型下载及模型转换命令,可以直接拷贝执行。 ``` cd model - wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/yolov5s.onnx --no-check-certificate + wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/yolov5s_nms.onnx --no-check-certificate wget https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/yolov5s/aipp.cfg --no-check-certificate - atc --model=yolov5s.onnx --framework=5 --output=yolov5s --input_shape="images:1,3,640,640" --soc_version=Ascend310B4 --insert_op_conf=aipp.cfg + atc --model=yolov5s_nms.onnx --framework=5 --output=yolov5s_nms --input_shape="images:1,3,640,640;img_info:1,4" --soc_version=Ascend310B4 --insert_op_conf=aipp.cfg ``` atc命令中各参数的解释如下,详细约束说明请参见[《ATC模型转换指南》](https://hiascend.com/document/redirect/CannCommunityAtc)。 -- Gitee