You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This feature is currently in public preview. This preview version is provided without a service-level agreement. Certain features might not be supported or might have constrained capabilities. For more information, see [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
@@ -21,96 +25,118 @@ In this article, you'll learn how to train an object detection model to detect s
21
25
22
26
Typically, computer vision models for object detection work well for datasets with relatively large objects. However, due to memory and computational constraints, these models tend to under-perform when tasked to detect small objects in high-resolution images. Because high-resolution images are typically large, they are resized before input into the model, which limits their capability to detect smaller objects--relative to the initial image size.
23
27
24
-
To help with this problem, automated ML supports tiling as part of the public preview computer vision capabilities. The tiling capability in automated ML is based on the concepts in [The Power of Tiling for Small Object Detection](https://openaccess.thecvf.com/content_CVPRW_2019/papers/UAVision/Unel_The_Power_of_Tiling_for_Small_Object_Detection_CVPRW_2019_paper.pdf).
28
+
To help with this problem, automated ML supports tiling as part of the computer vision capabilities. The tiling capability in automated ML is based on the concepts in [The Power of Tiling for Small Object Detection](https://openaccess.thecvf.com/content_CVPRW_2019/papers/UAVision/Unel_The_Power_of_Tiling_for_Small_Object_Detection_CVPRW_2019_paper.pdf).
25
29
26
-
When tiling, each image is divided into a grid of tiles. Adjacent tiles overlap with each other in width and height dimensions. The tiles are cropped from the original as shown in the following image.
30
+
When tiling, each image is divided into a grid of tiles. Adjacent tiles overlap with each other in width and height dimensions. The tiles are cropped from the original as shown in the following image.
:::image type="content" source="./media/how-to-use-automl-small-object-detect/tiles-generation.png" alt-text="Diagram that shows an image being divided into a grid of overlapping tiles.":::
29
33
30
34
## Prerequisites
31
35
32
36
* An Azure Machine Learning workspace. To create the workspace, see [Create workspace resources](quickstart-create-resources.md).
33
37
34
-
* This article assumes some familiarity with how to configure an [automated machine learning experiment for computer vision tasks](how-to-auto-train-image-models.md).
38
+
* This article assumes some familiarity with how to configure an [automated machine learning experiment for computer vision tasks](how-to-auto-train-image-models.md).
35
39
36
40
## Supported models
37
41
38
-
Small object detection using tiling is currently supported for the following models:
39
-
40
-
* fasterrcnn_resnet18_fpn
41
-
* fasterrcnn_resnet50_fpn
42
-
* fasterrcnn_resnet34_fpn
43
-
* fasterrcnn_resnet101_fpn
44
-
* fasterrcnn_resnet152_fpn
45
-
* retinanet_resnet50_fpn
42
+
Small object detection using tiling is supported for all models supported by Automated ML for images for object detection task.
46
43
47
44
## Enable tiling during training
48
45
49
-
To enable tiling, you can set the `tile_grid_size` parameter to a value like (3, 2); where 3 is the number of tiles along the width dimension and 2 is the number of tiles along the height dimension. When this parameter is set to (3, 2), each image is split into a grid of 3 x 2 tiles. Each tile overlaps with the adjacent tiles, so that any objects that fall on the tile border are included completely in one of the tiles. This overlap can be controlled by the `tile_overlap_ratio` parameter, which defaults to 25%.
46
+
To enable tiling, you can set the `tile_grid_size` parameter to a value like '3x2'; where 3 is the number of tiles along the width dimension and 2 is the number of tiles along the height dimension. When this parameter is set to '3x2', each image is split into a grid of 3 x 2 tiles. Each tile overlaps with the adjacent tiles, so that any objects that fall on the tile border are included completely in one of the tiles. This overlap can be controlled by the `tile_overlap_ratio` parameter, which defaults to 25%.
47
+
48
+
When tiling is enabled, the entire image and the tiles generated from it are passed through the model. These images and tiles are resized according to the `min_size` and `max_size` parameters before feeding to the model. The computation time increases proportionally because of processing this extra data.
50
49
51
-
When tiling is enabled, the entire image and the tiles generated from it are passed through the model. These images and tiles are resized according to the `min_size` and `max_size` parameters before feeding to the model. The computation time increases proportionally because of processing this extra data.
50
+
For example, when the `tile_grid_size` parameter is '3x2', the computation time would be approximately seven times higher than without tiling.
52
51
53
-
For example, when the `tile_grid_size`parameter is (3, 2), the computation time would be approximately seven times when compared to no tiling.
52
+
You can specify the value for `tile_grid_size`in your training parameters as a string.
54
53
55
-
You can specify the value for `tile_grid_size` in your hyperparameter space as a string.
The value for `tile_grid_size` parameter depends on the image dimensions and size of objects within the image. For example, larger number of tiles would be helpful when there are smaller objects in the images.
66
73
67
74
To choose the optimal value for this parameter for your dataset, you can use hyperparameter search. To do so, you can specify a choice of values for this parameter in your hyperparameter space.
When a model trained with tiling is deployed, tiling also occurs during inference. Automated ML uses the `tile_grid_size` value from training to generate the tiles during inference. The entire image and corresponding tiles are passed through the model, and the object proposals from them are merged to output final predictions, like in the following image.
:::image type="content" source="./media/how-to-use-automl-small-object-detect/tiles-merge.png" alt-text="Diagram that shows object proposals from image and tiles being merged to form the final predictions.":::
81
107
82
-
> [!NOTE]
108
+
> [!NOTE]
83
109
> It's possible that the same object is detected from multiple tiles, duplication detection is done to remove such duplicates.
84
110
>
85
111
> Duplicate detection is done by running NMS on the proposals from the tiles and the image. When multiple proposals overlap, the one with the highest score is picked and others are discarded as duplicates.Two proposals are considered to be overlapping when the intersection over union (iou) between them is greater than the `tile_predictions_nms_thresh` parameter.
86
112
87
-
You also have the option to enable tiling only during inference without enabling it in training. To do so, set the `tile_grid_size` parameter only during inference, not for training.
113
+
You also have the option to enable tiling only during inference without enabling it in training. To do so, set the `tile_grid_size` parameter only during inference, not for training.
88
114
89
-
Doing so, may improve performance for some datasets, and won't incur the extra cost that comes with tiling at training time.
115
+
Doing so, may improve performance for some datasets, and won't incur the extra cost that comes with tiling at training time.
90
116
91
-
## Tiling hyperparameters
117
+
## Tiling hyperparameters
92
118
93
119
The following are the parameters you can use to control the tiling feature.
94
120
95
121
| Parameter Name | Description | Default |
96
122
| --------------- |-------------| -------|
97
-
|`tile_grid_size`| The grid size to use for tiling each image. Available for use during training, validation, and inference.<br><br>Tuple of two integers passed as a string, e.g`'(3, 2)'`<br><br> *Note: Setting this parameter increases the computation time proportionally, since all tiles and images are processed by the model.*| no default value |
123
+
|`tile_grid_size`| The grid size to use for tiling each image. Available for use during training, validation, and inference.<br><br>Should be passed as a string in`'3x2'` format.<br><br> *Note: Setting this parameter increases the computation time proportionally, since all tiles and images are processed by the model.*| no default value |
98
124
|`tile_overlap_ratio`| Controls the overlap ratio between adjacent tiles in each dimension. When the objects that fall on the tile boundary are too large to fit completely in one of the tiles, increase the value of this parameter so that the objects fit in at least one of the tiles completely.<br> <br> Must be a float in [0, 1).| 0.25 |
99
125
|`tile_predictions_nms_thresh`| The intersection over union threshold to use to do non-maximum suppression (nms) while merging predictions from tiles and image. Available during validation and inference. Change this parameter if there are multiple boxes detected per object in the final predictions. <br><br> Must be float in [0, 1]. | 0.25 |
100
126
101
127
102
128
## Example notebooks
103
129
104
-
See the [object detection sample notebook](https://github.com/Azure/azureml-examples/tree/v2samplesreorg/v1/python-sdk/tutorials/automl-with-azureml/image-object-detection/auto-ml-image-object-detection.ipynb) for detailed code examples of setting up and training an object detection model.
130
+
See the [object detection sample notebook](https://github.com/Azure/azureml-examples/tree/main/sdk/python/jobs/automl-standalone-jobs/automl-image-object-detection-task-fridge-items/automl-image-object-detection-task-fridge-items.ipynb) for detailed code examples of setting up and training an object detection model.
105
131
106
132
>[!NOTE]
107
-
> All images in this article are made available in accordance with the permitted use section of the [MIT licensing agreement](https://choosealicense.com/licenses/mit/).
133
+
> All images in this article are made available in accordance with the permitted use section of the [MIT licensing agreement](https://choosealicense.com/licenses/mit/).
* Learn more about [how and where to deploy a model](/azure/machine-learning/how-to-deploy-managed-online-endpoints).
113
-
* For definitions and examples of the performance charts and metrics provided for each job, see [Evaluate automated machine learning experiment results](how-to-understand-automated-ml.md).
139
+
* For definitions and examples of the performance charts and metrics provided for each job, see [Evaluate automated machine learning experiment results](how-to-understand-automated-ml.md).
114
140
*[Tutorial: Train an object detection model (preview) with AutoML and Python](tutorial-auto-train-image-models.md).
115
141
* See [what hyperparameters are available for computer vision tasks](reference-automl-images-hyperparameters.md).
116
-
*[Make predictions with ONNX on computer vision models from AutoML](how-to-inference-onnx-automl-image-models.md)
142
+
*[Make predictions with ONNX on computer vision models from AutoML](how-to-inference-onnx-automl-image-models.md)
Copy file name to clipboardExpand all lines: articles/machine-learning/reference-automl-images-hyperparameters.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,9 @@ This table summarizes hyperparameters specific to the `yolov5` algorithm.
36
36
|`multi_scale`| Enable multi-scale image by varying image size by +/- 50% <br> Must be 0 or 1. <br> <br> *Note: training run may get into CUDA OOM if no sufficient GPU memory*. | 0 |
37
37
|`box_score_threshold`| During inference, only return proposals with a score greater than `box_score_threshold`. The score is the multiplication of the objectness score and classification probability. <br> Must be a float in the range [0, 1]. | 0.1 |
38
38
|`nms_iou_threshold`| IOU threshold used during inference in non-maximum suppression post processing. <br> Must be a float in the range [0, 1]. | 0.5 |
39
+
|`tile_grid_size`| The grid size to use for tiling each image. <br>*Note: tile_grid_size must not be None to enable [small object detection](how-to-use-automl-small-object-detect.md) logic*<br> Should be passed as a string in '3x2' format. Example: --tile_grid_size '3x2' | No Default |
40
+
|`tile_overlap_ratio`| Overlap ratio between adjacent tiles in each dimension. <br> Must be float in the range of [0, 1) | 0.25 |
41
+
|`tile_predictions_nms_threshold`| The IOU threshold to use to perform NMS while merging predictions from tiles and image. Used in validation/ inference. <br> Must be float in the range of [0, 1]| 0.25 |
39
42
40
43
This table summarizes hyperparameters specific to the `maskrcnn_*` for instance segmentation during inference.
41
44
@@ -80,13 +83,13 @@ The following table describes the hyperparameters that are model agnostic.
80
83
## Image classification (multi-class and multi-label) specific hyperparameters
81
84
82
85
The following table summarizes hyperparmeters for image classification (multi-class and multi-label) tasks.
83
-
86
+
84
87
| Parameter name | Description | Default |
85
88
| ------------- |-------------|-----|
86
89
|`weighted_loss`| <li> 0 for no weighted loss. <li> 1 for weighted loss with sqrt.(class_weights) <li> 2 for weighted loss with class_weights. <li> Must be 0 or 1 or 2. | 0 |
87
90
|`validation_resize_size`| <li> Image size to which to resize before cropping for validation dataset. <li> Must be a positive integer. <br> <br> *Notes: <li> `seresnext` doesn't take an arbitrary size. <li> Training run may get into CUDA OOM if the size is too big*. | 256 |
88
91
|`validation_crop_size`| <li> Image crop size that's input to your neural network for validation dataset. <li> Must be a positive integer. <br> <br> *Notes: <li> `seresnext` doesn't take an arbitrary size. <li> *ViT-variants* should have the same `validation_crop_size` and `training_crop_size`. <li> Training run may get into CUDA OOM if the size is too big*. | 224 |
89
-
|`training_crop_size`| <li> Image crop size that's input to your neural network for train dataset. <li> Must be a positive integer. <br> <br> *Notes: <li> `seresnext` doesn't take an arbitrary size. <li> *ViT-variants* should have the same `validation_crop_size` and `training_crop_size`. <li> Training run may get into CUDA OOM if the size is too big*. | 224 |
92
+
|`training_crop_size`| <li> Image crop size that's input to your neural network for train dataset. <li> Must be a positive integer. <br> <br> *Notes: <li> `seresnext` doesn't take an arbitrary size. <li> *ViT-variants* should have the same `validation_crop_size` and `training_crop_size`. <li> Training run may get into CUDA OOM if the size is too big*. | 224 |
90
93
91
94
## Object detection and instance segmentation task specific hyperparameters
92
95
@@ -104,7 +107,7 @@ The following hyperparameters are for object detection and instance segmentation
104
107
|`box_score_threshold`| During inference, only return proposals with a classification score greater than `box_score_threshold`. <br> Must be a float in the range [0, 1].| 0.3 |
105
108
|`nms_iou_threshold`| IOU (intersection over union) threshold used in non-maximum suppression (NMS) for the prediction head. Used during inference. <br>Must be a float in the range [0, 1]. | 0.5 |
106
109
|`box_detections_per_image`| Maximum number of detections per image, for all classes. <br> Must be a positive integer.| 100 |
107
-
|`tile_grid_size`| The grid size to use for tiling each image. <br>*Note: tile_grid_size must not be None to enable [small object detection](how-to-use-automl-small-object-detect.md) logic*<br> A tuple of two integers passed as a string. Example: --tile_grid_size "(3, 2)"| No Default |
110
+
|`tile_grid_size`| The grid size to use for tiling each image. <br>*Note: tile_grid_size must not be None to enable [small object detection](how-to-use-automl-small-object-detect.md) logic*<br> Should be passed as a string in '3x2' format. Example: --tile_grid_size '3x2'| No Default |
108
111
|`tile_overlap_ratio`| Overlap ratio between adjacent tiles in each dimension. <br> Must be float in the range of [0, 1) | 0.25 |
109
112
|`tile_predictions_nms_threshold`| The IOU threshold to use to perform NMS while merging predictions from tiles and image. Used in validation/ inference. <br> Must be float in the range of [0, 1]| 0.25 |
0 commit comments