Giter Site home page Giter Site logo

support yolov5 about hiddenlayer HOT 2 CLOSED

wwdok avatar wwdok commented on June 11, 2024 2
support yolov5

from hiddenlayer.

Comments (2)

craymichael avatar craymichael commented on June 11, 2024 2

I just found a fix (for my use case at least). Before the hiddenlayer graph-building, add this to set the ONNX opset version globally:

from torch.onnx.symbolic_helper import _set_opset_version
_set_opset_version(11)

...

hl.build_graph(model, x)

from hiddenlayer.

wwdok avatar wwdok commented on June 11, 2024 1

@craymichael 's solution is workable ! Now i can successfully get the yolov5 graph, the code is:

import torch
from torch.onnx.symbolic_helper import _set_opset_version
_set_opset_version(11)

model = torch.hub.load('ultralytics/yolov5', 'yolov5n', pretrained=True)
# print("==>> model: ", model)

import hiddenlayer as hl
graph = hl.build_graph(model, torch.zeros([1, 3, 512, 512]))

# To export graph, you need to install Graphviz excutable, and add it to environ path
import os 
os.environ["PATH"] += os.pathsep + "D:/Dependency/Graphviz/bin/"  # change this to your actual path
graph.save('yolov5.pdf') 

The generated graph is:
yolov5.pdf

from hiddenlayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.