dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
9.01k stars 1.88k forks source link

Is an Object Detection suppose to take 3.5 seconds? #7046

Open borakeh opened 6 months ago

borakeh commented 6 months ago

System Information (please complete the following information):

Describe the bug I just managed to setup my first project and things seem to be working quite well, however I noticed that doing a simple object detection takes about 3.5 seconds. I'm not sure if this is normal due to some PredictEngine overhead or something but it seems quite long considering I'm using a 4090 and the images aren't big.

The model was trained using 10 images and I'm only trying to predict 1 object on 1 image.

DoorDetection.ModelInput sampleData = new DoorDetection.ModelInput()
{
    Image = image,
};

Stopwatch stopwatch = Stopwatch.StartNew();

var predictionResult = DoorDetection.Predict(sampleData);

stopwatch.Stop();
Console.WriteLine(stopwatch.ElapsedMilliseconds);

To Reproduce Steps to reproduce the behavior:

  1. Clone my project https://github.com/borakeh/ObjectDetection
  2. I guess make sure the images are on the desktop in the correct folder Folder Structure
    • Desktop/doors
    • Desktop/doors/doorsOut
  3. Run the project and check how long it takes.

Expected behavior I would assume it would be a bit faster.

Screenshots, Code, Sample Projects No screenshots.

Additional context No additional context.