A tutorial to implement a data transform class can be found in the [Data Transform](../advanced_tutorials/data_element.md).
In addition, we move some common data transform classes from every repositories to MMCV, and in this document,
we will compare the functionalities, usages and implementations between the original data transform classes (in [MMClassification v0.23.2](https://github.com/open-mmlab/mmclassification/tree/v0.23.2), [MMDetection v2.25.1](https://github.com/open-mmlab/mmdetection/tree/v2.25.1)) and the new data transform classes (in [MMCV v2.0.0rc1](https://github.com/open-mmlab/mmcv/tree/2.x))
<td>Load bbox, label, mask (not include polygon masks), semantic segmentation.</td>
</tr>
<tr>
<td><code>Pad</code></td>
<td>Pad all images in the "img_fields" field.</td>
<td>Pad all images in the "img_fields" field. Support padding to integer multiple size.</td>
<td>Pad the image in the "img" field. Support padding to integer multiple size.</td>
</tr>
<tr>
<td><code>CenterCrop</code></td>
<td>Crop all images in the "img_fields" field. Support cropping as EfficientNet style.</td>
<td>Not available.</td>
<td>Crop the image in the "img" field, the bbox in the "gt_bboxes" field, the semantic segmentation in the "gt_seg_map" field, the keypoints in the "gt_keypoints" field. Support padding the margin of the cropped image.</td>
</tr>
<tr>
<td><code>Normalize</code></td>
<td>Normalize the image.</td>
<td>No differences.</td>
<td>No differences, but we recommend to use <ahref="../tutorials/model.html#datapreprocessor">data preprocessor</a> to normalize the image.</td>
</tr>
<tr>
<td><code>Resize</code></td>
<td>Resize all images in the "img_fields" field. Support resizing proportionally according to the specified edge.</td>
<td>Use <code>Resize</code> with <code>ratio_range=None</code>, the <code>img_scale</code> have a single scale, and <code>multiscale_mode="value"</code>.</td>
<td>Resize the image in the "img" field, the bbox in the "gt_bboxes" field, the semantic segmentation in the "gt_seg_map" field, the keypoints in the "gt_keypoints" field. Support specifying the ratio of new scale to original scale and support resizing proportionally.</td>
</tr>
<tr>
<td><code>RandomResize</code></td>
<td>Not available</td>
<td>Use <code>Resize</code> with <code>ratio_range=None</code>, <code>img_scale</code> have two scales and <code>multiscale_mode="range"</code>, or <code>ratio_range</code> is not None.
<pre>Resize(
img_sacle=[(640, 480), (960, 720)],
mode="range",
)</pre>
</td>
<td>Have the same resize function as <code>Resize</code>. Support sampling the scale from a scale range or scale ratio range.
<td>Randomly grayscale all images in the "img_fields" field. Support keeping channels after grayscale.</td>
<td>Not available</td>
<td>Randomly grayscale the image in the "img" field. Support specifying the weight of each channel, and support keeping channels after grayscale.</td>
</tr>
<tr>
<td><code>RandomFlip</code></td>
<td>Randomly flip all images in the "img_fields" field. Support flipping horizontally and vertically.</td>
<td>Randomly flip all values in the "img_fields", "bbox_fields", "mask_fields" and "seg_fields". Support flipping horizontally, vertically and diagonally, and support specifying the probability of every kind of flipping.</td>
<td>Randomly flip the values in the "img", "gt_bboxes", "gt_seg_map", "gt_keypoints" field. Support flipping horizontally, vertically and diagonally, and support specifying the probability of every kind of flipping.</td>