Open trlsmax opened 2 years ago
Hi! Could you give me this model to check correctness of it's conversion?
Just send you the model by email.
I added YoloV5Decoder to parse YoloV5 output:
#include "Synet/Decoders/YoloV5.h"
Synet::YoloV5Decoder decoder;
decoder.Init();
Regions objects = decoder.GetRegions(net, original.width, original.height, 0.5f, 0.5f)[0];
Thank you. But I still can't get any detection.
int main(int argc, char* argv[])
{
Net net;
net.Load("test.xml", "test.bin");
net.Reshape(1920, 1920, 1);
Shape shape = net.NchwShape();
View original;
original.Load("test0.png");
View resized(shape[3], shape[2], original.format);
Simd::Resize(original, resized, ::SimdResizeMethodArea);
net.SetInput(resized, 0.0f, 255.0f);
net.Forward();
Synet::YoloV5Decoder decoder;
decoder.Init();
Regions objects = decoder.GetRegions(net, original.width, original.height, 0.5f, 0.5f)[0];
// objects.size() == 0 here
uint32_t white = 0xFFFFFFFF;
for (size_t i = 0; i < objects.size(); ++i)
{
const Region& object = objects[i];
ptrdiff_t l = ptrdiff_t(object.x - object.w / 2);
ptrdiff_t t = ptrdiff_t(object.y - object.h / 2);
ptrdiff_t r = ptrdiff_t(object.x + object.w / 2);
ptrdiff_t b = ptrdiff_t(object.y + object.h / 2);
Simd::DrawRectangle(original, l, t, r, b, white);
}
original.Save("test0r.ppm");
return 0;
}
I trained a custom model with yolov5 and export to onnx format, then convert to synet format. The following code detected nothing, but the onnx model works fine with detect.py of yolov5.