已合并
YOLOF模型整改问题修改 & 仓库模型列表修改 #3344
shikang2022创建于 2023年1月5日
YOLOF模型整改问题修改 & 仓库模型列表修改 #3344
已合并
共 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. |
| 14 | import numpy as np | 14 | import numpy as np |
| 15 | import argparse | 15 | import 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 | ||
| 17 | import torch | 20 | import torch |
| 18 | from cvpods.structures import Boxes, Instances | 21 | from cvpods.structures import Boxes, Instances |
| 19 | from cvpods.modeling.postprocessing import detector_postprocess | 22 | from cvpods.modeling.postprocessing import detector_postprocess |
| 20 | from cvpods.engine import RUNNERS | 23 | from cvpods.engine import RUNNERS |
| 21 | from cvpods.evaluation import build_evaluator | 24 | from cvpods.evaluation import build_evaluator |
| 22 | - | ||
| 23 | import sys | 25 | import sys |
| 24 | import os | 26 | import 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 | - | ||
| 29 | const_shape = (608, 608) | 28 | const_shape = (608, 608) |
| 30 | dataset_name = "coco_2017_val" | 29 | dataset_name = "coco_2017_val" |
| 31 | 30 | ||
The file is empty
| @@ -15,13 +15,12 @@ | |||
| 15 | import torch | 15 | import torch |
| 16 | import argparse | 16 | import argparse |
| 17 | import numpy as np | 17 | import numpy as np |
| 18 | +import sys | ||
| 19 | +sys.path.append("./YOLOF") | ||
| 18 | from cvpods.engine import default_setup | 20 | from cvpods.engine import default_setup |
| 19 | from cvpods.checkpoint import DefaultCheckpointer | 21 | from cvpods.checkpoint import DefaultCheckpointer |
| 20 | - | 22 | +sys.path.append("./YOLOF/playground/detection/coco/yolof/yolof.cspdarknet53.DC5.9x/") |
| 21 | -import sys | 23 | +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])) | ||
| 25 | from net import build_model | 24 | from net import build_model |
| 26 | from config import config | 25 | from 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.pth | 151 | --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.info | 235 | + 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 @@ | |||
| 1 | torch == 1.7.1 | 1 | torch == 1.7.1 |
| 2 | torchvision == 0.8.2 | 2 | torchvision == 0.8.2 |
| 3 | - | 3 | +portalocker |
| 4 | +cloudpickle | ||
| 5 | +tabulate | ||
| 6 | +termcolor | ||
| 7 | +pycocotools | ||
| 8 | +easydict | ||
| 9 | +colorama | ||
| 4 | onnx==1.7.0 | 10 | onnx==1.7.0 |
| 5 | onnx-simplifier | 11 | onnx-simplifier |
| 6 | opencv-python | 12 | opencv-python |