MCPcopy
hub / github.com/alibaba/EasyCV / bninceptionPre

Function bninceptionPre

easycv/utils/preprocess_function.py:11–28  ·  view source on GitHub ↗

Args: image: pytorch Image tensor from PIL (range 0~1), bgr format mean : norm mean std : norm val Returns: A image norm in 0~255, rgb format

(image, mean=[104, 117, 128], std=[1, 1, 1])

Source from the content-addressed store, hash-verified

9
10
11def bninceptionPre(image, mean=[104, 117, 128], std=[1, 1, 1]):
12 """
13 Args:
14 image: pytorch Image tensor from PIL (range 0~1), bgr format
15 mean : norm mean
16 std : norm val
17 Returns:
18 A image norm in 0~255, rgb format
19 """
20 expand_batch_dim = len(image.size()) == 3
21 if expand_batch_dim:
22 image = image.unsqueeze(0)
23 image = image * 255
24 image = image[:, [2, 1, 0]]
25 for i in range(2):
26 image[:, i, ...] -= mean[i]
27 image[:, i, ...] /= std[i]
28 return image
29
30
31def randomErasing(image,

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected