takuya-takeuchi / NcnnDotNet

ncnn wrapper written in C++ and C# for Windows, MacOS, Linux, iOS and Android
MIT License
82 stars 24 forks source link

what wrong of the code? scoreBlob, bboxBlob,landmarkBlob are all zero! #64

Open philsonxu opened 1 year ago

philsonxu commented 1 year ago
public static void Retina(NcnnDotNet.OpenCV.Mat src)
{
    // Model from https://github.com/nihui/ncnn-assets/tree/master/models
    Net net = new Net();
    net.Opt.UseVulkanCompute = false;
    net.LoadParam(@"Models\mnet.25-opt.param");
    net.LoadModel(@"Models\mnet.25-opt.bin");

    var imgW = src.Cols;
    var imgH = src.Rows;
    NcnnDotNet.Mat @in = NcnnDotNet.Mat.FromPixelsResize(
        pixel: src.Data,
        type: PixelType.Bgr2Rgb,
        width: src.Cols,
        height: src.Rows,
        targetWidth: imgW,
        targetHeight: imgH
    );

    NcnnDotNet.Extractor ex = net.CreateExtractor();

    ex.Input("data", @in);

    var scoreBlob = new NcnnDotNet.Mat();
    var bboxBlob = new NcnnDotNet.Mat();
    var landmarkBlob = new NcnnDotNet.Mat();
    ex.Extract("face_rpn_cls_prob_reshape_stride32", scoreBlob);
    ex.Extract("face_rpn_bbox_pred_stride32", bboxBlob);
    ex.Extract("face_rpn_landmark_pred_stride32", landmarkBlob);
}
takuya-takeuchi commented 1 year ago

@philsonxu I can not reproduce it by examples\RetinaFace.

dotnet remove reference ../../src/NcnnDotNet\NcnnDotNet.csproj
dotnet add package NcnnDotNet
dotnet run --configuration Release -- lenna.png

image

takuya-takeuchi commented 1 year ago

if you can, please upload image file.