From 852a6be16277a29c19644cedc806d685965c5569 Mon Sep 17 00:00:00 2001 From: luisquintanilla Date: Mon, 28 Jun 2021 09:43:02 -0400 Subject: [PATCH 1/9] Add scale comment --- .../tutorials/object-detection-model-builder.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/machine-learning/tutorials/object-detection-model-builder.md b/docs/machine-learning/tutorials/object-detection-model-builder.md index 2213d9966aea5..62d72aa8e7cdf 100644 --- a/docs/machine-learning/tutorials/object-detection-model-builder.md +++ b/docs/machine-learning/tutorials/object-detection-model-builder.md @@ -255,6 +255,21 @@ Two projects are created as a result of the training process. Top: 89.453415, Left: 481.95343, Right: 724.8073, Bottom: 388.32385, Label: Stop-Sign, Score: 0.99539465 ``` + > [!NOTE] + >The bounding box coordinates are normalized for a width of 800 pixels and height of 600 pixels. To scale the coordinates for your image, you need to: + > + > 1. Multiply top and bottom coordinates by the original image height / multiply left and right coordinates by the original image width. + > 1. Divide top and bottom coordinates by 600 / divide left and right coordinates by 800. + > + > For example, given the original image dimensions (`actualImageHeight`,`actualImageWidth`) and a prediction `prediction` with bounding boxes: + > + > ```csharp + > var top = originalImageHeight * prediction.Top / 600 + > var bottom = originalImageHeight * prediction.Bottom / 600 + > var left = originalImageWidth * prediction.Left / 800 + > var right = originalImageWidth * prediction.Right / 800 + > ``` + Congratulations! You've successfully built a machine learning model to detect stop signs in images using Model Builder. You can find the source code for this tutorial at the [dotnet/machinelearning-samples](https://github.com/dotnet/machinelearning-samples/tree/main/samples/modelbuilder/ObjectDetection_StopSigns) GitHub repository. ## Additional resources From 94e110b273edb7cbed18878eca590a1a85ed7362 Mon Sep 17 00:00:00 2001 From: Luis Quintanilla <46974588+luisquintanilla@users.noreply.github.com> Date: Mon, 28 Jun 2021 11:36:57 -0400 Subject: [PATCH 2/9] Update docs/machine-learning/tutorials/object-detection-model-builder.md Thanks Co-authored-by: Youssef Victor --- .../tutorials/object-detection-model-builder.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/machine-learning/tutorials/object-detection-model-builder.md b/docs/machine-learning/tutorials/object-detection-model-builder.md index 62d72aa8e7cdf..9b4207ed5cd5d 100644 --- a/docs/machine-learning/tutorials/object-detection-model-builder.md +++ b/docs/machine-learning/tutorials/object-detection-model-builder.md @@ -264,10 +264,10 @@ Two projects are created as a result of the training process. > For example, given the original image dimensions (`actualImageHeight`,`actualImageWidth`) and a prediction `prediction` with bounding boxes: > > ```csharp - > var top = originalImageHeight * prediction.Top / 600 - > var bottom = originalImageHeight * prediction.Bottom / 600 - > var left = originalImageWidth * prediction.Left / 800 - > var right = originalImageWidth * prediction.Right / 800 + > var top = originalImageHeight * prediction.Top / 600; + > var bottom = originalImageHeight * prediction.Bottom / 600; + > var left = originalImageWidth * prediction.Left / 800; + > var right = originalImageWidth * prediction.Right / 800; > ``` Congratulations! You've successfully built a machine learning model to detect stop signs in images using Model Builder. You can find the source code for this tutorial at the [dotnet/machinelearning-samples](https://github.com/dotnet/machinelearning-samples/tree/main/samples/modelbuilder/ObjectDetection_StopSigns) GitHub repository. From 7867a8bab3f51e7d43cf6f2901aa5b21a3d8f9fb Mon Sep 17 00:00:00 2001 From: Luis Quintanilla <46974588+luisquintanilla@users.noreply.github.com> Date: Mon, 28 Jun 2021 11:37:22 -0400 Subject: [PATCH 3/9] Update docs/machine-learning/tutorials/object-detection-model-builder.md Co-authored-by: Youssef Victor --- .../tutorials/object-detection-model-builder.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/machine-learning/tutorials/object-detection-model-builder.md b/docs/machine-learning/tutorials/object-detection-model-builder.md index 9b4207ed5cd5d..6a8392aa29798 100644 --- a/docs/machine-learning/tutorials/object-detection-model-builder.md +++ b/docs/machine-learning/tutorials/object-detection-model-builder.md @@ -258,7 +258,7 @@ Two projects are created as a result of the training process. > [!NOTE] >The bounding box coordinates are normalized for a width of 800 pixels and height of 600 pixels. To scale the coordinates for your image, you need to: > - > 1. Multiply top and bottom coordinates by the original image height / multiply left and right coordinates by the original image width. + > 1. Multiply top and bottom coordinates by the original image height, and multiply left and right coordinates by the original image width. > 1. Divide top and bottom coordinates by 600 / divide left and right coordinates by 800. > > For example, given the original image dimensions (`actualImageHeight`,`actualImageWidth`) and a prediction `prediction` with bounding boxes: From e7bcff88fb7b751004a667bb54bc0cff7c15b77c Mon Sep 17 00:00:00 2001 From: Luis Quintanilla <46974588+luisquintanilla@users.noreply.github.com> Date: Mon, 28 Jun 2021 11:37:29 -0400 Subject: [PATCH 4/9] Update docs/machine-learning/tutorials/object-detection-model-builder.md Co-authored-by: Youssef Victor --- .../tutorials/object-detection-model-builder.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/machine-learning/tutorials/object-detection-model-builder.md b/docs/machine-learning/tutorials/object-detection-model-builder.md index 6a8392aa29798..aff14097dd92e 100644 --- a/docs/machine-learning/tutorials/object-detection-model-builder.md +++ b/docs/machine-learning/tutorials/object-detection-model-builder.md @@ -256,7 +256,7 @@ Two projects are created as a result of the training process. ``` > [!NOTE] - >The bounding box coordinates are normalized for a width of 800 pixels and height of 600 pixels. To scale the coordinates for your image, you need to: + > The bounding box coordinates are normalized for a width of 800 pixels and height of 600 pixels. To scale the coordinates for your image, you need to: > > 1. Multiply top and bottom coordinates by the original image height, and multiply left and right coordinates by the original image width. > 1. Divide top and bottom coordinates by 600 / divide left and right coordinates by 800. From 03c8d5c39c6b4d208977af99c64b6aa5caa9bd6e Mon Sep 17 00:00:00 2001 From: Luis Quintanilla <46974588+luisquintanilla@users.noreply.github.com> Date: Mon, 28 Jun 2021 11:37:37 -0400 Subject: [PATCH 5/9] Update docs/machine-learning/tutorials/object-detection-model-builder.md Co-authored-by: Youssef Victor --- .../tutorials/object-detection-model-builder.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/machine-learning/tutorials/object-detection-model-builder.md b/docs/machine-learning/tutorials/object-detection-model-builder.md index aff14097dd92e..601c5f4651139 100644 --- a/docs/machine-learning/tutorials/object-detection-model-builder.md +++ b/docs/machine-learning/tutorials/object-detection-model-builder.md @@ -259,7 +259,7 @@ Two projects are created as a result of the training process. > The bounding box coordinates are normalized for a width of 800 pixels and height of 600 pixels. To scale the coordinates for your image, you need to: > > 1. Multiply top and bottom coordinates by the original image height, and multiply left and right coordinates by the original image width. - > 1. Divide top and bottom coordinates by 600 / divide left and right coordinates by 800. + > 1. Divide top and bottom coordinates by 600, and divide left and right coordinates by 800. > > For example, given the original image dimensions (`actualImageHeight`,`actualImageWidth`) and a prediction `prediction` with bounding boxes: > From 0e0a50b530102eea4988edad9e2c195f1d469ac5 Mon Sep 17 00:00:00 2001 From: luisquintanilla Date: Mon, 28 Jun 2021 13:24:49 -0400 Subject: [PATCH 6/9] Update based on feedback --- .../tutorials/object-detection-model-builder.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/machine-learning/tutorials/object-detection-model-builder.md b/docs/machine-learning/tutorials/object-detection-model-builder.md index 601c5f4651139..6f4387201c37a 100644 --- a/docs/machine-learning/tutorials/object-detection-model-builder.md +++ b/docs/machine-learning/tutorials/object-detection-model-builder.md @@ -261,7 +261,7 @@ Two projects are created as a result of the training process. > 1. Multiply top and bottom coordinates by the original image height, and multiply left and right coordinates by the original image width. > 1. Divide top and bottom coordinates by 600, and divide left and right coordinates by 800. > - > For example, given the original image dimensions (`actualImageHeight`,`actualImageWidth`) and a prediction `prediction` with bounding boxes: + > For example, given the original image dimensions,`actualImageHeight` and `actualImageWidth`, and a prediction `prediction` with bounding box coordinates, the following code snippet shows how to scale the bounding box dimensions: > > ```csharp > var top = originalImageHeight * prediction.Top / 600; From 19ff7886b42b9f2a80bc223ade7a6e6d73ae9133 Mon Sep 17 00:00:00 2001 From: luisquintanilla Date: Thu, 1 Jul 2021 16:06:25 -0400 Subject: [PATCH 7/9] Fixing build issue --- docs/csharp/language-reference/attributes/general.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/csharp/language-reference/attributes/general.md b/docs/csharp/language-reference/attributes/general.md index e70b0a6cc1b5f..0eb6d32d2418f 100644 --- a/docs/csharp/language-reference/attributes/general.md +++ b/docs/csharp/language-reference/attributes/general.md @@ -47,7 +47,6 @@ In C# 10, you can use constant string interpolation and the `nameof` operator to :::code language="csharp" source="snippets/ObsoleteExample.cs" id="Snippet2" ::: - ## `AttributeUsage` attribute The `AttributeUsage` attribute determines how a custom attribute class can be used. is an attribute you apply to custom attribute definitions. The `AttributeUsage` attribute enables you to control: From 4c788841855ec8ea5dcfc3b3b01b00db66b4c5ca Mon Sep 17 00:00:00 2001 From: luisquintanilla Date: Tue, 6 Jul 2021 21:02:18 -0400 Subject: [PATCH 8/9] Updates based on feedback --- .../tutorials/object-detection-model-builder.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/machine-learning/tutorials/object-detection-model-builder.md b/docs/machine-learning/tutorials/object-detection-model-builder.md index 6f4387201c37a..2631b33527b83 100644 --- a/docs/machine-learning/tutorials/object-detection-model-builder.md +++ b/docs/machine-learning/tutorials/object-detection-model-builder.md @@ -256,12 +256,12 @@ Two projects are created as a result of the training process. ``` > [!NOTE] - > The bounding box coordinates are normalized for a width of 800 pixels and height of 600 pixels. To scale the coordinates for your image, you need to: + > (Optional) The bounding box coordinates are normalized for a width of 800 pixels and a height of 600 pixels. To scale the bounding box coordinates for your image in further post-processing, you need to: > - > 1. Multiply top and bottom coordinates by the original image height, and multiply left and right coordinates by the original image width. - > 1. Divide top and bottom coordinates by 600, and divide left and right coordinates by 800. + > 1. Multiply the top and bottom coordinates by the original image height, and multiply the left and right coordinates by the original image width. + > 1. Divide the top and bottom coordinates by 600, and divide the left and right coordinates by 800. > - > For example, given the original image dimensions,`actualImageHeight` and `actualImageWidth`, and a prediction `prediction` with bounding box coordinates, the following code snippet shows how to scale the bounding box dimensions: + > For example, given the original image dimensions,`actualImageHeight` and `actualImageWidth`, and a `ModelOutput` called `prediction`, the following code snippet shows how to scale the `BoundingBox` coordinates: > > ```csharp > var top = originalImageHeight * prediction.Top / 600; @@ -269,6 +269,8 @@ Two projects are created as a result of the training process. > var left = originalImageWidth * prediction.Left / 800; > var right = originalImageWidth * prediction.Right / 800; > ``` + > + > An image may have more than one bounding box, so the same process needs to be applied to each of the bounding boxes in the image. Congratulations! You've successfully built a machine learning model to detect stop signs in images using Model Builder. You can find the source code for this tutorial at the [dotnet/machinelearning-samples](https://github.com/dotnet/machinelearning-samples/tree/main/samples/modelbuilder/ObjectDetection_StopSigns) GitHub repository. From e7ed8f4221e97f5cf800c09b9efe544a37d2aa03 Mon Sep 17 00:00:00 2001 From: luisquintanilla Date: Tue, 6 Jul 2021 21:17:49 -0400 Subject: [PATCH 9/9] Making optional more visible --- .../tutorials/object-detection-model-builder.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/machine-learning/tutorials/object-detection-model-builder.md b/docs/machine-learning/tutorials/object-detection-model-builder.md index 2631b33527b83..f7f5f5b7e979c 100644 --- a/docs/machine-learning/tutorials/object-detection-model-builder.md +++ b/docs/machine-learning/tutorials/object-detection-model-builder.md @@ -256,7 +256,7 @@ Two projects are created as a result of the training process. ``` > [!NOTE] - > (Optional) The bounding box coordinates are normalized for a width of 800 pixels and a height of 600 pixels. To scale the bounding box coordinates for your image in further post-processing, you need to: + > **(Optional)** The bounding box coordinates are normalized for a width of 800 pixels and a height of 600 pixels. To scale the bounding box coordinates for your image in further post-processing, you need to: > > 1. Multiply the top and bottom coordinates by the original image height, and multiply the left and right coordinates by the original image width. > 1. Divide the top and bottom coordinates by 600, and divide the left and right coordinates by 800.