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
Copy file name to clipboardExpand all lines: articles/cognitive-services/Computer-vision/how-to/model-customization.md
+25-26Lines changed: 25 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,16 +30,24 @@ This guide shows you how to create and train a custom image classification model
30
30
31
31
#### [Python](#tab/python)
32
32
33
-
You can run through all of the model customization steps using a configured Jupyter Notebook.
33
+
Train your own image classifier (IC) or object detector (OD) with your own data using Image Analysis model customization and Python.
34
+
35
+
You can run through all of the model customization steps using a Python sample package. You can run the code in this section using a Python script, or you can download and run the Notebook on a compatible platform.
> Contents of _cognitive_service_vision_model_customization.ipynb_. **[Open in GitHub](https://github.com/Azure-Samples/cognitive-service-vision-model-customization-python-samples/blob/main/docs/cognitive_service_vision_model_customization.ipynb)**.
39
41
40
-
Train your own image classifier (IC) or object detector (OD) with your own data using Image Analysis model customization and Python.
42
+
## Install the python samples package
43
+
44
+
Install the [sample code](https://pypi.org/project/cognitive-service-vision-model-customization-python-samples/) to train/predict custom models with Python:
Enter your Computer Vision endpoint URL and key, as well as the name of the resource, in the code below.
45
53
@@ -64,31 +72,20 @@ else:
64
72
resource_key ='{specify_your_resource_key}'
65
73
```
66
74
67
-
## Install the python samples package
68
-
69
-
Install the [sample code](https://pypi.org/project/cognitive-service-vision-model-customization-python-samples/) to train/predict custom models with Python:
To train a model with your own dataset, the dataset should be prepared conformed with the COCO format described below, hosted on Azure blob storage, and accessible from your Computer Vision resource.
79
-
80
-
> [!TIP]
81
-
> Quota limit information, including the maximum number of images and categories supported, maximum image size, and so on, can be found on the [concept page](../concept-model-customization.md).
77
+
To train a model with your own dataset, the dataset should be arranged in the COCO format described below, hosted on Azure blob storage, and accessible from your Computer Vision resource.
82
78
83
79
### Dataset annotation format
84
80
85
-
We use COCO format for indexing/organizing the training images and their annotations. Below are examples and explanations of what specific format is needed for multiclass classification and object detection.
81
+
Image Analysis uses the COCO file format for indexing/organizing the training images and their annotations. Below are examples and explanations of what specific format is needed for multiclass classification and object detection.
82
+
83
+
Image Analysis model customization for classification is different from other kinds of vision training, as we utilize your class names, as well as image data, in training. So, be sure provide meaningful category names in the annotations.
86
84
87
-
Note that
85
+
> [!NOTE]
86
+
> In the example dataset, there are few images for the sake of simplicity. Although [Florence models](https://www.microsoft.com/research/publication/florence-a-new-foundation-model-for-computer-vision/) achieve great few-shot performance (high model quality even with little data available), it's good to have more data for the model to learn. Our recommendation is to have at least five images per class, and the more the better.
88
87
89
-
- Image Analysis model customization for classification is different from other kinds of vision training, as we utilize your class names, as well as image data, in training. So, be sure provide meaningful category names in the annotations.
90
-
- Note that in the example dataset, there are few images for the sake of simplicity. Although [Florence models](https://www.microsoft.com/en-us/research/publication/florence-a-new-foundation-model-for-computer-vision/) achieve great few-shot performance (high model quality even with little data available), it's good to have more data for the model to learn. Our recommendation is to have at least five images per class, and the more the better.
91
-
- Once your COCO annotation file is prepared, you can use the [COCO file verification script](coco-verification.md) to check the format.
88
+
Once your COCO annotation file is prepared, you can use the [COCO file verification script](coco-verification.md) to check the format.
92
89
93
90
#### Multiclass classification example
94
91
@@ -121,7 +118,7 @@ Besides `absolute_url`, you can also use `coco_url` (the system accepts either f
121
118
}
122
119
```
123
120
124
-
The values in `bbox: [left, top, width, height]` are relative the image width and height.
121
+
The values in `bbox: [left, top, width, height]` are relative to the image width and height.
125
122
126
123
### Blob storage directory structure
127
124
@@ -135,7 +132,10 @@ cat_dog/
135
132
train_coco.json
136
133
```
137
134
138
-
### Grant your Computer Vision resource access to your Azure data blob
135
+
> [!TIP]
136
+
> Quota limit information, including the maximum number of images and categories supported, maximum image size, and so on, can be found on the [concept page](../concept-model-customization.md).
137
+
138
+
### Grant Computer Vision access to your Azure data blob
139
139
140
140
You need to take an extra step to give your Computer Vision resource access to read the contents of your Azure blog storage container. There are two ways to do this.
141
141
@@ -158,12 +158,11 @@ Below is a series of steps for allowing the system-assigned Managed Identity of
158
158
159
159
### Register the dataset
160
160
161
-
Once your dataset has been prepared and hosted on your azure blob storage container, with access granted to your Computer Vision resource, you can register it with the service.
161
+
Once your dataset has been prepared and hosted on your Azure blob storage container, with access granted to your Computer Vision resource, you can register it with the service.
162
162
163
163
> [!NOTE]
164
164
> The service only accesses your storage data during training. It doesn't keep copies of your data beyond the training cycle.
165
165
166
-
167
166
```python
168
167
from cognitive_service_vision_model_customization_python_samples import DatasetClient, Dataset, AnnotationKind, AuthenticationKind, Authentication
169
168
@@ -197,7 +196,7 @@ if eval_dataset:
197
196
198
197
## Train a model
199
198
200
-
After you registering the dataset, use it to train a custom model:
199
+
After you register the dataset, use it to train a custom model:
201
200
202
201
```python
203
202
from cognitive_service_vision_model_customization_python_samples import TrainingClient, Model, ModelKind, TrainingParameters, EvaluationParameters
0 commit comments