techwingslab / yolov5-net

YOLOv5 object detection with C#, ML.NET, ONNX
MIT License
351 stars 104 forks source link

Can not work with Gray images #39

Open MrXin95 opened 3 years ago

MrXin95 commented 3 years ago

When I tested, I found that the input gray image(8bit) can not work. Is it necessary to add the code that converts the gray image(8bit) into RGB image(24bit)? SharedScreenshot

kkarahainko commented 3 years ago

@MrXin95 can you provide test image? for now it works with rgb images, maybe I'll add auto-convertion.

MrXin95 commented 3 years ago

0

0 image

I've tested that any image with a bit depth of 8 doesn't work. Because the images processed in the code are RGB images (24bit) The first is the image I need to test, and the second is the gray image I download freely on the Internet

MrXin95 commented 3 years ago

I use OpenCvSharp4.Windows to solve it.

                Mat mat = new Mat(img_root, ImreadModes.Color);      //read any images witch RGB mode

                using var image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);    //convert mat to bitmap

                List<YoloPrediction> predictions = scorer.Predict(image);

However, I found that the prediction speed of the model almost did not change, but the speed of drawing the prediction box was a few seconds slow. At first, I thought that the incoming original image was in image format, and the image I converted was in bitmap format, but after I converted bitmap to image format, the drawing speed did not increase. What other good methods do you have?

kkarahainko commented 3 years ago

@MrXin95 thanks, model trained on 8bit images? (as I know its not supported in yolov5 as well)

MrXin95 commented 2 years ago

Yes, I trained model with 8-bit images, because in my project, the image provided by the camera is like this. The images in the model are indeed three channels, but yolov5 can automatically convert 8-bit images into 24bit before training. You can have a try. We can train the model with 8bit images, and the test is also no problem in python with them.

kankanjiuzou123 commented 2 years ago

Yes, I trained model with 8-bit images, because in my project, the image provided by the camera is like this. The images in the model are indeed three channels, but yolov5 can automatically convert 8-bit images into 24bit before training. You can have a try. We can train the model with 8bit images, and the test is also no problem in python with them.

兄弟,你用自己的模型测试图片,一张图大概多长时间?

MrXin95 commented 2 years ago

Yes, I trained model with 8-bit images, because in my project, the image provided by the camera is like this. The images in the model are indeed three channels, but yolov5 can automatically convert 8-bit images into 24bit before training. You can have a try. We can train the model with 8bit images, and the test is also no problem in python with them.

兄弟,你用自己的模型测试图片,一张图大概多长时间?

纯推理二十几毫秒,加上前后处理一百多毫秒