enazoe / yolo-tensorrt

TensorRT8.Support Yolov5n,s,m,l,x .darknet -> tensorrt. Yolov4 Yolov3 use raw darknet *.weights and *.cfg fils. If the wrapper is useful to you,please Star it.
MIT License
1.18k stars 316 forks source link

Invalid network type in trt_utils.loadWeights() on yolov4_scaled branch #147

Open justinkay opened 2 years ago

justinkay commented 2 years ago

I have gotten the executable to build on the yolov4_scaled branch but I encounter this error when loading the weights.

Loading pre-trained weights...
Invalid network type
yolo-trt: /home/ubuntu/yolo-tensorrt/modules/trt_utils.cpp:393: std::vector<float> loadWeights(std::__cxx11::string, const string&): Assertion `0' failed.
Aborted (core dumped)

Error is caused by this line in modules/trt_utils.cpp loadWeights()

    if ((int)(unsigned char)buf[0] == 1)
    {
        file.ignore(11);
    }
    else if ((int)(unsigned char)buf[0] == 2)
    {
        file.ignore(15);
    }
    else
    {
        std::cout << "Invalid network type" << std::endl;
        assert(0);
    }

What is this (int)(unsigned char)buf[0] and what should the value be?