Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions docarray/document/mixins/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,13 @@ def set_image_tensor_normalization(
) -> 'T':
"""Normalize a uint8 image :attr:`.tensor` into a float32 image :attr:`.tensor` inplace.

Following Pytorch standard, the image must be in the shape of shape (3 x H x W) and
will be normalized in to a range of [0, 1] and then
normalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225]. These two arrays are computed
based on millions of images. If you want to train from scratch on your own dataset, you can calculate the new
mean and std. Otherwise, using the Imagenet pretrianed model with its own mean and std is recommended.
Applies normalization to the color channels of the images.
By default, the normalization uses mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225], which are standard values computed on millions of images. If you want to train from scratch on your own dataset, you can calculate the new
mean and std. Otherwise, using the Imagenet pretrained model with its own mean and std is recommended.

:param channel_axis: the axis id of the color channel, ``-1`` indicates the color channel info at the last axis
:param img_mean: the mean of all images
:param img_std: the standard deviation of all images
:param img_mean: the means of all images: [mean_r, mean_g, mean_b]
:param img_std: the standard deviations of all images: [std_r, std_g, std_b]
:return: itself after processed

.. warning::
Expand Down