当前位置:网站首页>The onnx model of yolov5 removes the transfer layer
The onnx model of yolov5 removes the transfer layer
2022-04-23 06:33:00 【ZhangLH66】
import onnx
from onnx import helper, checker
from onnx import TensorProto
import re
import argparse
model = ""
onnx_model = onnx.load(model)
graph = onnx_model.graph
# print(graph)
node = graph.node
# node[213].output[0] = node[212].output[0]
# node[213].output[0] = node[213].input[0]
# for idx in graph.node:
# print(idx)
# graph.node[]
graph.node.remove(graph.node[215])
#
graph.node.remove(graph.node[214])
graph.node.remove(graph.node[213])
# node[212].name = 'output'
for i in range(len(node)):
# print(node[i])
if node[i].name == 'Conv_212':
node[i].output[0]="output"
if node[i].name == 'Conv_193':
node[i].output[0]="390"
if node[i].name == 'Conv_174':
node[i].output[0]="391"
onnx.checker.check_model(onnx_model)
onnx.save(onnx_model,"best_del_transpose.onnx")
版权声明
本文为[ZhangLH66]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210614497652.html
边栏推荐
- Use of multithreaded executors
- [leetcode 150] evaluation of inverse Polish expression
- Stability building best practices
- Rust 中的 Cell 共享可变指针
- Import of data
- Generation of verification code
- Linear algebra Chapter 2 - matrices and their operations
- 線性代數第二章-矩陣及其運算
- -- SQL query and return limit rows
- 12. Monkeys climb mountains
猜你喜欢
[leetcode 59] spiral matrix II
A sharp tool to improve work efficiency
[leetcode 54] spiral matrix
Pytorch notes - observe dataloader & build lenet with torch to process cifar-10 complete code
Illustrate the significance of hashcode
-- SQL query and return limit rows
Paper on Image Restoration - [red net, nips16] image restoration using very deep revolutionary encoder decoder networks wi
Contrôle automatique (version Han min)
Explanation of login page
Addition, deletion, query and modification of data
随机推荐
serde - rust的序列化方案
C array
The problem that the page will refresh automatically after clicking the submit button on the form is solved
Robocode教程3——Robo机器剖析
Qthread simple test understanding
Busybox initrd and initialization process
Guaba and Computational Geometry
Reading of denoising paper - [ridnet, iccv19] real image denoising with feature attention
檢測技術與原理
Programming record - picture rotation function SciPy ndimage. Simple use and effect observation of rotate()
Example of ticket selling with reentrant lock
Miscellaneous 1
Generate excel template (drop-down selection, multi-level linkage)
How does MySQL convert stored seconds into dates
[leetcode 54] spiral matrix
9.Life, the Universe, and Everything
Export of data
GDAL+OGR学习
Installation and usage skills of idea
A sharp tool to improve work efficiency