已合并
YOLOF模型整改问题修改 & 仓库模型列表修改 #3344
shikang2022创建于 2023年1月5日
YOLOF模型整改问题修改 & 仓库模型列表修改 #3344
已合并
shikang2022创建于 2023年1月5日
master合入到master
6 个文件变更+21-16
@@ -353,5 +353,4 @@
353- [GoogleNet_for_Pytorch](https://gitee.com/ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/cv/GoogleNet_for_Pytorch)353- [GoogleNet_for_Pytorch](https://gitee.com/ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/cv/GoogleNet_for_Pytorch)
354- [PSENet_for_Pytorch](https://gitee.com/ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/cv/PSENet_for_Pytorch)354- [PSENet_for_Pytorch](https://gitee.com/ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/cv/PSENet_for_Pytorch)
355- [RawNet2_for_Pytorch](https://gitee.com/ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/audio/RawNet2_for_Pytorch)355- [RawNet2_for_Pytorch](https://gitee.com/ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/audio/RawNet2_for_Pytorch)
356-- [ResNeXt50_for_Pytorch](https://gitee.com/ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/cv/ResNeXt50_for_Pytorch)
357- [TransformerXL_for_Pytorch](https://gitee.com/ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/nlp/TransformerXL_for_Pytorch)356- [TransformerXL_for_Pytorch](https://gitee.com/ascend/ModelZoo-PyTorch/tree/master/ACL_PyTorch/built-in/nlp/TransformerXL_for_Pytorch)
@@ -13,19 +13,18 @@
13# limitations under the License.13# limitations under the License.
14import numpy as np14import numpy as np
15import argparse15import argparse
16- 16+import sys
17+sys.path.append("./YOLOF/playground/detection/coco/yolof/yolof.cspdarknet53.DC5.9x/")
18+sys.path.append("./YOLOF")
19+from config import config
17import torch20import torch
18from cvpods.structures import Boxes, Instances21from cvpods.structures import Boxes, Instances
19from cvpods.modeling.postprocessing import detector_postprocess22from cvpods.modeling.postprocessing import detector_postprocess
20from cvpods.engine import RUNNERS23from cvpods.engine import RUNNERS
21from cvpods.evaluation import build_evaluator24from cvpods.evaluation import build_evaluator
22- 
23import sys25import sys
24import os26import os
25 27 
26-sys.path.append("{0}/YOLOF/playground/detection/coco/yolof/yolof.cspdarknet53.DC5.9x/".format(sys.path[0]))
27-from config import config
28- 
29const_shape = (608, 608)28const_shape = (608, 608)
30dataset_name = "coco_2017_val"29dataset_name = "coco_2017_val"
31 30 
@@ -15,13 +15,12 @@
15import torch15import torch
16import argparse16import argparse
17import numpy as np17import numpy as np
18+import sys
19+sys.path.append("./YOLOF")
18from cvpods.engine import default_setup20from cvpods.engine import default_setup
19from cvpods.checkpoint import DefaultCheckpointer21from cvpods.checkpoint import DefaultCheckpointer
20- 22+sys.path.append("./YOLOF/playground/detection/coco/yolof/yolof.cspdarknet53.DC5.9x/")
21-import sys23+sys.path.append("./YOLOF/playground/detection/coco/yolof/")
22- 
23-sys.path.append("{0}/YOLOF/playground/detection/coco/yolof/yolof.cspdarknet53.DC5.9x/".format(sys.path[0]))
24-sys.path.append("{0}/YOLOF/playground/detection/coco/yolof/".format(sys.path[0]))
25from net import build_model24from net import build_model
26from config import config25from config import config
27 26 
@@ -147,8 +147,9 @@ YOLOF引入了一种解决该优化问题的替代方案而无需使用复杂的
147 ```147 ```
148 python YOLOF_pth2onnx.py \148 python YOLOF_pth2onnx.py \
149 --model_config=YOLOF/playground/detection/coco/yolof/yolof.cspdarknet53.DC5.9x \149 --model_config=YOLOF/playground/detection/coco/yolof/yolof.cspdarknet53.DC5.9x \
150- --out=yolof.onnx \150+ --out=yolof_bs${bs}.onnx \
151 --pth_path=./YOLOF_CSP_D_53_DC5_9x.pth151 --pth_path=./YOLOF_CSP_D_53_DC5_9x.pth
152+ --batch_size=${bs}
152 ```153 ```
153 - 参数说明:154 - 参数说明:
154 155 
@@ -156,7 +157,8 @@ YOLOF引入了一种解决该优化问题的替代方案而无需使用复杂的
156 - --framework:5代表ONNX模型。157 - --framework:5代表ONNX模型。
157 - --out:输出的Onnx模型。158 - --out:输出的Onnx模型。
158 - --pth_path:模型权重文件159 - --pth_path:模型权重文件
159- 获得yolof.onnx文件。160+ - --batch_size:bs大小
161+ 获得yolof_bs${bs}.onnx文件。
160 162 
161 163 
162 3. 使用ATC工具将ONNX模型转OM模型。164 3. 使用ATC工具将ONNX模型转OM模型。
@@ -188,7 +190,7 @@ YOLOF引入了一种解决该优化问题的替代方案而无需使用复杂的
188 3. 执行ATC命令。190 3. 执行ATC命令。
189 191 
190 ```192 ```
191- atc --framework=5 --model=yolof.onnx --output=yolof_bs${bs} --input_shape="input:${bs},3,608,608" --log=error --soc_version=Ascend{chip_name}193+ atc --framework=5 --model=yolof_bs${bs}.onnx --output=yolof_bs${bs} --input_shape="input:${bs},3,608,608" --log=error --soc_version=Ascend{chip_name}
192 ```194 ```
193 195 
194 - 参数说明:196 - 参数说明:
@@ -230,7 +232,7 @@ YOLOF引入了一种解决该优化问题的替代方案而无需使用复杂的
230 调用脚本YOLOF_postprocess.py计算推理精度232 调用脚本YOLOF_postprocess.py计算推理精度
231 233 
232 ```234 ```
233- python YOLOF_postprocess.py --pth_path YOLOF_CSP_D_53_DC5_9x.pth --bin_data_path result --meta_info_path yolof_meta.info235+ python YOLOF_postprocess.py --pth_path YOLOF_CSP_D_53_DC5_9x.pth --bin_data_path result --meta_info_path yolof_meta.info
234 ```236 ```
235 237 
236 - 参数说明:238 - 参数说明:
@@ -1,6 +1,12 @@
1torch == 1.7.11torch == 1.7.1
2torchvision == 0.8.22torchvision == 0.8.2
3- 3+portalocker
4+cloudpickle
5+tabulate
6+termcolor
7+pycocotools
8+easydict
9+colorama
4onnx==1.7.010onnx==1.7.0
5onnx-simplifier11onnx-simplifier
6opencv-python12opencv-python