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

Function mixUp

easycv/utils/preprocess_function.py:180–194  ·  view source on GitHub ↗
(image, alpha=0.2)

Source from the content-addressed store, hash-verified

178
179
180def mixUp(image, alpha=0.2):
181 if alpha > 0:
182 lam = np.random.beta(alpha, alpha)
183 else:
184 lam = 1
185
186 batch_size = image.size()[0]
187
188 assert batch_size > 2
189 assert batch_size % 2 == 0
190
191 mixed_x = lam * image[0:int(batch_size / 2),
192 ...] + (1 - lam) * image[int(batch_size / 2):, ...]
193
194 return mixed_x, lam
195
196
197def mixUpCls(data, alpha=0.2):

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected