wz fix evaluation
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "MxBase/DeviceManager/DeviceManager.h"
|
||||
#include "MxBase/Log/Log.h"
|
||||
|
@@ -49,12 +49,17 @@
|
||||
|- FCOSPostprocess
|
||||
| |- FCOSDetectionPostProcess.cpp
|
||||
| |_ FCOSDetectionPostProcess.h
|
||||
|- imageforTest
|
||||
| |- 000000000785.jpg
|
||||
| |- 000000000872.jpg
|
||||
| |_ other images
|
||||
|- build.sh
|
||||
|- CMakeLists.txt
|
||||
|- main.py
|
||||
|- binresult
|
||||
|- evaluate.py
|
||||
|_ README.md
|
||||
|- README.md
|
||||
|_ test.sh
|
||||
```
|
||||
|
||||
### 1.5 技术实现流程图
|
||||
@@ -120,7 +125,52 @@ ATC run success, welcome to the next use.
|
||||
|
||||
|
||||
## 5 精度测试
|
||||
本项目和 https://gitee.com/ascend/mindxsdk-referenceapps/tree/master/contrib/FCOS 地址处的项目的模型和后处理过程一样。详细的精度测试参考地址处的项目。
|
||||
本项目和 https://gitee.com/ascend/mindxsdk-referenceapps/tree/master/contrib/FCOS 地址处的项目的模型和后处理过程一样。详细的精度测试参考地址处的项目。在本项目,由于其后处理插件以及模型和上面地址处的是一致的,这里就不单独进行精度测试。仅仅利用imageforTest内的照片跑出来的结果来与地址处的项目进行对比。这里旨在说明两个项目的代码运行结果是基本一致的。
|
||||
|
||||
在进行精度比对之前,首先需要修改几处代码。
|
||||
首先在FCOSDetection.cpp文件里面的301行下面加上代码:
|
||||
```cpp
|
||||
std::string resPath = imagePath;
|
||||
for (uint32_t i = 0; i<resPath.size(); i++) {
|
||||
if (resPath.at(i) == '.') {
|
||||
resPath.replace(i, 4, ".txt");
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::ofstream outfile;
|
||||
outfile.open(resPath, std::ios::out);
|
||||
```
|
||||
在这之后,在同一个函数里面的
|
||||
```cpp
|
||||
cv::rectangle(imgBgr,
|
||||
cv::Rect(newX0, newY0, newX1 - newX0, newY1 - newY0), green,
|
||||
thickness);
|
||||
```
|
||||
代码下面加入以下代码:
|
||||
```cpp
|
||||
outfile << labelMap_[((int)resultInfo[j].classId)];
|
||||
outfile << "\n";
|
||||
outfile << newX0;
|
||||
outfile << " ";
|
||||
outfile << newY0;
|
||||
outfile << " ";
|
||||
outfile << newX1 - newX0;
|
||||
outfile << " ";
|
||||
outfile << newY1 - newY0;
|
||||
outfile << "\n";
|
||||
```
|
||||
在加入完毕以上代码之后就在终端输入命令:
|
||||
```
|
||||
bash test.sh
|
||||
```
|
||||
即可在imageforTest文件夹下面看到以txt文件存放的结果。每个txt文件对应于一张图片。
|
||||
|
||||

|
||||
|
||||
在每个txt文件中,其中的内容如下:
|
||||
|
||||

|
||||
在每个txt文件中都存放了对应图片的所有检测到的物体类别及其目标框$(x_0,y_0,w,h)$。但是这个项目和上述地址处的项目的同一张图片的txt文件里面的每一个目标框结果存放顺序不同(不影响结果)。经过多次对比,发现本项目的结果和上述地址处的项目最终结果生成的目标框的位置基本一样、类别也一致。
|
||||
## 6 常见问题
|
||||
|
||||
### 6.1 类别标签问题
|
||||
|
BIN
FCOS/image/image4.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
FCOS/image/image5.png
Normal file
After Width: | Height: | Size: 234 KiB |
BIN
FCOS/imageforTest/000000000785.jpg
Normal file
After Width: | Height: | Size: 130 KiB |
BIN
FCOS/imageforTest/000000000872.jpg
Normal file
After Width: | Height: | Size: 310 KiB |
BIN
FCOS/imageforTest/000000002261.jpg
Normal file
After Width: | Height: | Size: 193 KiB |
BIN
FCOS/imageforTest/000000002532.jpg
Normal file
After Width: | Height: | Size: 205 KiB |
BIN
FCOS/imageforTest/000000004765.jpg
Normal file
After Width: | Height: | Size: 136 KiB |
BIN
FCOS/imageforTest/000000005477.jpg
Normal file
After Width: | Height: | Size: 151 KiB |
BIN
FCOS/imageforTest/000000005529.jpg
Normal file
After Width: | Height: | Size: 220 KiB |
BIN
FCOS/imageforTest/000000008532.jpg
Normal file
After Width: | Height: | Size: 107 KiB |
BIN
FCOS/imageforTest/000000011051.jpg
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
FCOS/imageforTest/000000013774.jpg
Normal file
After Width: | Height: | Size: 169 KiB |
BIN
FCOS/imageforTest/000000017905.jpg
Normal file
After Width: | Height: | Size: 181 KiB |
BIN
FCOS/imageforTest/000000018519.jpg
Normal file
After Width: | Height: | Size: 180 KiB |
BIN
FCOS/imageforTest/000000021167.jpg
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
FCOS/imageforTest/000000021604.jpg
Normal file
After Width: | Height: | Size: 98 KiB |
BIN
FCOS/imageforTest/000000022479.jpg
Normal file
After Width: | Height: | Size: 95 KiB |
BIN
FCOS/imageforTest/000000022935.jpg
Normal file
After Width: | Height: | Size: 140 KiB |
BIN
FCOS/imageforTest/000000025228.jpg
Normal file
After Width: | Height: | Size: 161 KiB |
BIN
FCOS/imageforTest/000000043816.jpg
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
FCOS/imageforTest/000000052507.jpg
Normal file
After Width: | Height: | Size: 225 KiB |
BIN
FCOS/imageforTest/000000053626.jpg
Normal file
After Width: | Height: | Size: 167 KiB |
31
FCOS/test.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Copyright(C) 2022. 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.
|
||||
|
||||
|
||||
function getdir(){
|
||||
for element in `ls $1`
|
||||
do
|
||||
dir_or_file=$1"/"$element
|
||||
if [ -d $dir_or_file ]
|
||||
then
|
||||
getdir $dir_or_file
|
||||
else
|
||||
echo $dir_or_file
|
||||
./mxBase_sample $dir_or_file
|
||||
fi
|
||||
done
|
||||
}
|
||||
root_dir="./imageforTest"
|
||||
getdir $root_dir
|