• DepthAI
  • Trying to convert trained(.pt file) Yolo model on tools.luxonis.com

Hey guys, I'm trying to convert my trained yolov6n model (.pt file) on tools.luxonis.com to a blob file to use on the OAK camera, but I'm getting an error like this:

I tried all three options and got the same error, how can I fix that issue?
Thanks for the answers
Fakhrullo

  • Ah, I see. Now, it makes sense. I saw in the ultralytics documentation that they support YoloV6 as well. So you can keep using the code you have and (for now) use the YoloV8 export option in the tools when converting the model. Another option would be to use YoloV6's training script. We have prepared a tutorial for that. You can also find more information in the YoloV6's repository. If you would choose this, then you could use the YoloV6 export option in the tools.

    Best,
    Jan

8 days later

Hi jakaskerl
Here's the link below where you can find the model I'm trying to convert to a blob file:

I hope it will be fixed soon

thanks,
Fakhrullo

Hi @Fakhrullo,

I'll look into it and let you know when I find something. In the meantime, could you please share with us what export arguments (# of shaves, RVC2 or RVC3, etc.) you used?

Best,
Jan

    Hi JanCuhel
    Here's the image below you can see the configuration I used, and I also used all Yolo versions(related to yolov6) and none of them worked

    I hope it helps
    thanks,
    Fakhrullo

    Hi @Fakhrullo

    thanks for your reply. I tried to load the weights (best.pt) that you shared with us, but I was unable to load them using:

    import torch
    torch.load("best.pt")

    It returned the following error:
    KeyError: "filename 'storages' not found"

    It seems like the file is corrupted. Can you please try it as well and ensure it's not corrupted?

    Best
    Jan

      4 days later

      JanCuhel

      Hi JanCuhel
      Sorry for late response, I couldn't reach my laptop for a few days, well I also noticed that the file I shared seems to be broken, I will reupload the model I trained and I will make sure it's working properly before uploading it.

      Thanks,
      Fakhrullo

      Please be aware that you need to download the .pt file, somehow google drive is opening .pt file like a zip file 😅

      Here's the image, after opening the drive link, just press the download button without opening best file

      Thanks. I'll look into it and get back to you as soon as I discover something.

      Best,
      Jan

      I found out that your model is convertible using the YoloV8 option in tools. Here's the exported model. Can you please verify that it works? I tried to run the model on an OAK device, and it ran without an error, but I don't know what the model is supposed to detect.

      Could you please also share the details about how you train the model? It's very interesting that to load the weights, the package ultralytics (which is used for YoloV8) is required.

      Best
      Jan

        Hi JanCuhel
        I'm very new in this sphere, so I found some tutorials to train Yolov8 and I thought if I change the model it would just train the other models as well (in my case yolov6n) here's the code I used to train the model:


        # Load a model
        from ultralytics import YOLO
        
        model = YOLO('yolov6n.yaml')  # load a 
        pretrained model (recommended for training)
        
        # Train the model
        results = model.train(data='/content/Yolo/dataset/data.yaml', epochs=10, imgsz=640)

        Ah, I see. Now, it makes sense. I saw in the ultralytics documentation that they support YoloV6 as well. So you can keep using the code you have and (for now) use the YoloV8 export option in the tools when converting the model. Another option would be to use YoloV6's training script. We have prepared a tutorial for that. You can also find more information in the YoloV6's repository. If you would choose this, then you could use the YoloV6 export option in the tools.

        Best,
        Jan

          JanCuhel
          Thanks in advance bro, you helped me so much and took so many stress 😅 wish you best bro

          Best regards
          Fakhrullo

          Glad to hear that I was able to help you! Thank you, you too!

          Best,
          Jan