Comments (10)
I compared the source code of this repository with sstainba/Yolov8.Net and noticed a difference here. You've used padding. What's the purpose of this padding? Could this be the reason for the false positives?
from yolov8.
My test image has an original resolution of 1280x960, my model size is 640x640.
In this repository, after resizing, my test image is 640x480, and through breakpoint inspection, I found the yPadding used is 80.
I noticed that sstainba/Yolov8.Net's approach during preprocessing is to directly resize my test image to 640x640 and then scale the bounding boxes in the output to correspond to the original dimensions and size.
from yolov8.
The purpose of padding is to improve the results, because when the aspect ratio remains the same as the original image the predictions are more accurate.
It would be good if you give me a minimal way to reproduce the problem at my, and I hope I can fix it soon
from yolov8.
@dme-compunet
I think sending you my .onnx model and test images for testing would be the most straightforward. You can compare the results from running this repository to those from running python YOLOv8.
How would you recommend receiving the images? Via e-mail, OneDrive/Google Drive, or is there a file-sharing website you'd recommend?
from yolov8.
@FunJoo Google Drive is excellent for me
from yolov8.
@dme-compunet https://drive.google.com/drive/folders/1to6dEr7hXMTRaoOtAH-iyDZjcC2aU4OU?usp=sharing
from yolov8.
@FunJoo a temporary solution for you is to change the YoloV8.Preprocess
method to something like this:
private Tensor<float> Preprocess(Image<Rgb24> image)
{
var modelSize = _metadata.ImageSize;
var ratio = Math.Min((float)modelSize.Width / image.Width, (float)modelSize.Height / image.Height);
var processSize = new Size((int)(image.Width * ratio), (int)(image.Height * ratio));
var xPadding = (modelSize.Width - processSize.Width) / 2;
var yPadding = (modelSize.Height - processSize.Height) / 2;
image.Mutate(x => x.Resize(processSize));
var dimensions = new int[] { 1, 3, modelSize.Height, modelSize.Width };
var input = new DenseTensor<float>(dimensions);
input.Fill(1f); // fill padding background with white color
image.ForEachPixel((point, pixel) =>
{
var x = point.X + xPadding;
var y = point.Y + yPadding;
var r = pixel.R / 255f;
var g = pixel.G / 255f;
var b = pixel.B / 255f;
input[0, 0, y, x] = r;
input[0, 1, y, x] = g;
input[0, 2, y, x] = b;
});
return input;
}
(the input.Fill(1f);
was added)
Your problem was that the model predicted the black padding as a vessels, maybe the right solution is to padding the image with a stretch of the last row of pixels to the end, in addition to adding PreprocessWithAspectRatio
property to YoloV8Parameters
that will give the possibility to perform pre-processing without the use of padding.
from yolov8.
@dme-compunet Thank you, I will take this as my temporary solution. It indeed avoids the false positives, but the preprocessing adds 20~40 milliseconds.
from yolov8.
@FunJoo I updated the repo, now the default is processing without keeping original aspect ratios, to process with original aspect ratios (sometimes improves the prediction results) you need to change the ProcessWithOriginalAspectRatio
property in YoloV8Parameters
to true
from yolov8.
@dme-compunet I've already updated and successfully implemented it. Thank you so much :)
from yolov8.
Related Issues (20)
- Difference between Python and DotNet HOT 1
- Is there a best example of multithreading or WebApi? HOT 1
- How to enable GPU HOT 3
- Inconsistent model results HOT 2
- Suggest adding OBB support HOT 2
- [discussion] optimize code logic to improve operational efficiency HOT 2
- Index was outside the bounds of the array. HOT 5
- Logic for resizing images to fit the size of the model input data. HOT 4
- Inference with Camera HOT 2
- It's not really using the GPU
- Getting lower confidence values HOT 2
- Load Image HOT 2
- Possible to select between fp16 and fp32? HOT 1
- Error Sequence contains no elements on image plotting HOT 3
- some pictures does not show transparent boxes HOT 1
- Произошла ошибка в обработке клиента onnxruntime_providers_cuda.dll мой проект пробовал на GPU с библиотекой YoloV8.Gpu v4.0.0 HOT 15
- DetectObb is not showing any bounding boxes for object (car in my case) HOT 6
- Processing video files HOT 1
- can't set configuration for create a predictor HOT 4
- YOLOv10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yolov8.