#CustomVision – Sort and manage Json response estimation in a single line of code

Buy Me A Coffee

Hi!

On my Custom Vision samples, I usually send an image to a CustomVision.ai HTTP Endpoint, and I process the Json result. The results are very easy to understand, however, I created a C# converter class to help with the Custom Vision results.

To create this class I navigate: http://json2csharp.com/, and paste a sample result and make some changes on the result. The output and useful class is this one:

It’s a very simple class, and the best way to describe it, is to show an usage scenario

The main remarks points are

  • Lines 1 to 9, open a local file, create a HTTP client and make the HTTP Post request
  • Line 12, convert the json response (string) to a C# object and then get the best prediction
  • Where the best prediction is a single Linq code sorting the predictions by probability and selecting the 1t one.

Easy and amazing!

Happy Coding!

Greetings @ Burlington

El Bruno

References

One thought on “#CustomVision – Sort and manage Json response estimation in a single line of code”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.