Comments (3)
I am unfamiliar with this function, but the answer is that the ONNX produced by YOLO-NAS is just a basic ONNX, so it could be used by any framework supporting the layers used in YOLO-NAS.
Please note that the quantized ONNX is specific for TensorRT, so you need to create a basic ONNX.
from super-gradients.
YOLONAS supports native export to ONNX format:
from super_gradients.training import models
pretrained_model = models.get("yolo_nas_s", pretrained_weights="coco").cuda().eval()
dummy_input = torch.randn(1, 3, 640, 640).cuda()
yolo_model.prep_model_for_conversion(input_size=(640, 640))
torch.onnx.export(yolo_model, dummy_input, "yolo_nas_s.onnx", verbose=False, opset_version=13, do_constant_folding=True)
You can use generated ONNX file to load into TRT or ONNXRuntime as is.
Regarding OpenCV - I'm afraid you cannot use it "as is", due to some error inside ONNX parser on OpenCV side:
torch.onnx.export(yolo_model, dummy_input, "yolo_nas_s.onnx", verbose=False, opset_version=13, do_constant_folding=True)
>onnx_model = cv2.dnn.readNet("yolo_nas_s.onnx")
E cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1073: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20221220::ONNXImporter::handleNode'
E > Node [[email protected]]:(onnx_node!/heads/Constant_11) parse error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_graph_simplifier.cpp:848: error: (-215:Assertion failed) !field.empty() in function 'cv::dnn::dnn4_v20221220::getMatFromTensor'
In theory, running model through onnxsim
or lowering opset version during export can help, but we haven't tested this and leave this to community to figure out since ONNX support in OpenCV is beyond our control.
I hope this answers your question.
from super-gradients.
Join the discussion on DagsHub!
from super-gradients.
Related Issues (20)
- RuntimeError: Given groups=1, weight of size [48, 3, 3, 3], expected input[2, 640, 640, 640] to have 3 channels, but got 640 channels instead
- Change Quantization Precision HOT 1
- knowledge distillation to object detection(YOLONAS) HOT 1
- Clarification on license for modifications to Yolo-NAS with pre-trained weights HOT 6
- Speed inference Time HOT 6
- Error training yolo_nas_l HOT 4
- Issues with Bounding Box Coordinates Exceeding Image Dimensions After ONNX Export
- DiceLoss is unknown object type HOT 2
- SSD MobileNet V2 recipe HOT 1
- Any model for instance segmentation?
- DataParallel Multi-gpu training problem HOT 4
- Incorrect arguments in super_gradients/training/utils/distributed_training_utils.py HOT 1
- Correct image transforms for Yolo-NAS
- Work with keypoints for recognize some poses HOT 1
- Custom metrics that depends on image_path?
- DetectionRandomAffine target-size is in wrong format HOT 2
- COCO Recipe reporting low precision
- ImportError: cannot import name 'utils' from partially initialized module 'super_gradients.training' (most likely due to a circular import HOT 4
- yolo-nas-sat model availability
- AttributeError: 'RegSeg48' object has no attribute 'set_dataset_processing_params' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from super-gradients.