#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

Advertisements

#VisualStudio – JSON Viewer, excellent extension to work with #JSON contents

Hi!

When I’m in debug mode in Visual Studio, I always use several options to view debugging data. Text, XML and JSON are the default data viewers ones that we have in the IDE (as far as I know!). What I do not find in the IDE is an external viewer in JSON format.

Lucky us, we can always go to the Visual Studio MarketPlace, where we have many tools (free most of them). And to fix my problem, JSON Viewer covers all my requirements. Copying and pasting JSON content, the end result is the following

 

I1

In the previous image we see how the contents are shown in [Human friendly] format, and we also have the possibility to see the same data with the JSON content formatted

I2

For now, very useful and covers all my expectations.

Happy Coding!

Greetings @ Toronto

El Bruno

References

 

#VisualStudio – JSON Viewer, excelente extensión para trabajar con contenidos JSON

Buenas!

Cuando depuras aplicaciones, Visual Studio nos provee de varias opciones para ver los datos de la depuración. Text, Xml y Json son los visores que tenemos por defecto. Lo que no encuentro de fabrica en el IDE es un visor externo en formato Json.

Por suerte, en el MarketPlace de Visual Studio tenemos muchas herramientas (gratis en su mayoría). Y para solucionar mi problema, JSON Viewer cubre todos los requisitos. Copiando y pegando un contenido JSON, el resultado final es el siguiente

I1

En la imagen anterior vemos como se muestran los contenidos en formato [Human Friendly], y también tenemos la posibilidad de ver los mismos en JSON formateado

I2

Por ahora, muy útil y cubre todas mis expectativas.

Happy Coding!

Saludos @ Toronto

El Bruno

References