RangiLyu / nanodet

NanoDet-Plusāš”Super fast and lightweight anchor-free object detection model. šŸ”„Only 980 KB(int8) / 1.8MB (fp16) and run 97FPS on cellphonešŸ”„
Apache License 2.0
5.63k stars 1.03k forks source link

Weird predictions after conversion to NCNN #555

Open adithya1-7 opened 5 months ago

adithya1-7 commented 5 months ago

After training a custom model and converting it to NCNN, I'm getting unexpected weird detections as below. There were no issues with torch or ONNX inference. Anyone able to solve it? When I convert the given pretrained model to NCNN, it works fine. This is strange behaviour. I suspect it has something to do with code changes that happened after 2021

bad

fire717 commented 4 months ago

I got a similiar problem. I trained a custom model which class num=1 and export ncnn. I can use https://github.com/RangiLyu/nanodet/blob/main/demo_ncnn/nanodet.cpp to run predict, and got a right object,but the box is always not right. It feels like the x and y always be smaller than right label.For example, for a input 320x320 test image, the right box is [21,11,285,314] in [x1,y1,x2,y2] order, but the predict is [56,0,255,275].

I have change the setting in nanodet.h which not help:

    int input_size[2] = {320,320};
    int num_class = 1;
    int reg_max = 7; // `reg_max` set in the training config. Default: 7.
    std::vector<int> strides = { 8, 16, 32};