Search code examples
pytorchyolomodulenotfounderrordarknet

ModuleNotFoundError: No module named 'ultralytics.yolo' when trying to use export.py from ultralytics


I´m trying to use the export.py script from the ultralytics repository in github (https://github.com/ultralytics/yolov5). Previously I installed all the requirements by using the command:

    pip install -U -r requirements.txt

But when I use:

    python export.py --img-size 640 --batch-size 1 --weights ../best.pt

I get the following error:

No module named 'ultralytics.yolo' (IMAGE)

Any idea on how to solve this error?

thanks in advance!


Solution

  • Nevermind, I was just using the repository incorrectly. As I wanted to export the neural network from pyTorch format to ONNX, I just needed to execute the following command:

        yolo export model=<my_model> format=onnx imgsz=224,128
    

    Now it works correctly.