dotnet / dotnet/machinelearning

ML.NET object detection Predict() takes 5 seconds to process

Open
#5,881 5 comments 0 reactions 0 assignees View on GitHub
area-AutoML
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

**System Information (please complete the following information):**
- OS & Version: Windows 10
- ML.NET Version: ML.NET v1.6
- .NET Version: NET 5.0

**Describe the bug**
I've created a ONNX model for Object Detection with Visual Studio and ML Model Builder (using an Azure workspace), using VOTT to define the 4 objects I want to detect.
I'm testing the model as explained in the tutorial, and it works well, detects the 4 objects, result is ok:

var sampleData = new MLModel1.ModelInput()
{
ImageSource = @"C:\Data\sample1.jpg",
};

//Load model and predict output
var result = MLModel1.Predict(sampleData);

Problem is it takes 5 seconds (10 seconds on first run, 5 on the following ones).
Sample.jpg is a 700x400 pixels image, 85kb, the computer is an Intel i7 2.9GHz.

Am I doing something wrong or this is the speed I should expect? Here's the image, the objects to detect are the REF, LOT, the hourglass icon and the factory icon.

![OCR_b](https://user-images.githubusercontent.com/6052847/126082286-d0f89f79-5f47-4c46-a56d-2abb0358c50f.jpg)

**To Reproduce**
Followed the Object Detection sample on Documentation

**Expected behavior**
Much faster processing time

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.