Open monkeycc opened 1 week ago
Hello! Great job on researching the existing resources! 🚀
To extract the names
and imgsz
from a YAML configuration file when using an ONNX model, you can load the YAML in Python and use its contents directly in your script.
Here's a small code snippet to help you achieve that:
import yaml
# Load YAML configuration file
config_path = 'path/to/your/config.yaml'
with open(config_path, 'r') as file:
config = yaml.load(file, Loader=yaml.FullLoader)
# Extracting names and imgsz
names = config['names']
imgsz = config['imgsz']
print('Names:', names)
print('Image Size:', imgsz)
Make sure to replace 'path/to/your/config.yaml'
with the actual path to your config file. This will allow you to fetch the class names and the image size directly, making your workflow with the ONNX model easier and cleaner.
Hope this helps! Let us know if there's anything else you need! 🌟
Search before asking
Question
How to read onnx and obtain names, imgsz
https://github.com/ultralytics/ultralytics/tree/main/examples/YOLOv8-ONNXRuntime https://github.com/ultralytics/ultralytics/blob/main/examples/YOLOv8-OpenCV-ONNX-Python/main.py
What must be read from the yaml configuration file Instead of directly obtaining data from onnx
names
imgsz
Additional
No response