Exemplo n.º 1
0
def Reflect(X):
    Xt = []
    for x in X:
        if py_rng.random() > 0.5:
            x = np.flipud(x)
        if py_rng.random() > 0.5:
            x = np.fliplr(x)
        Xt.append(x)
    return Xt
Exemplo n.º 2
0
def Reflect(X):
	Xt = []
	for x in X:
		if py_rng.random() > 0.5:
			x = np.flipud(x)
		if py_rng.random() > 0.5:
			x = np.fliplr(x)
		Xt.append(x)
	return Xt
Exemplo n.º 3
0
def ColorShift(X, p=1 / 3., scale=20):
    Xt = []
    for x in X:
        x = x.astype(np.int16)
        x[:, :, 0] += (py_rng.random() < p) * py_rng.randint(-scale, scale)
        x[:, :, 1] += (py_rng.random() < p) * py_rng.randint(-scale, scale)
        x[:, :, 2] += (py_rng.random() < p) * py_rng.randint(-scale, scale)
        x = np.clip(x, 0, 255).astype(np.uint8)
        Xt.append(x)
    return Xt
Exemplo n.º 4
0
def ColorShift(X, p=1/3., scale=20):
    Xt = []
    for x in X:
        x = x.astype(np.int16)
        x[:, :, 0] += (py_rng.random() < p)*py_rng.randint(-scale, scale)
        x[:, :, 1] += (py_rng.random() < p)*py_rng.randint(-scale, scale)
        x[:, :, 2] += (py_rng.random() < p)*py_rng.randint(-scale, scale)
        x = np.clip(x, 0, 255).astype(np.uint8)
        Xt.append(x)
    return Xt
Exemplo n.º 5
0
def FlipHorizontal(X):
    Xt = []
    for x in X:
        if py_rng.random() > 0.5:
            x = np.fliplr(x)
        Xt.append(x)
    return Xt
Exemplo n.º 6
0
def FlipVertical(X):
    Xt = []
    for x in X:
        if py_rng.random() > 0.5:
            x = np.flipud(x)
        Xt.append(x)
    return Xt
Exemplo n.º 7
0
def FlipHorizontal(X):
	Xt = []
	for x in X:
		if py_rng.random() > 0.5:
			x = np.fliplr(x)
		Xt.append(x)
	return Xt
Exemplo n.º 8
0
def FlipVertical(X):
	Xt = []
	for x in X:
		if py_rng.random() > 0.5:
			x = np.flipud(x)
		Xt.append(x)
	return Xt
Exemplo n.º 9
0
def SeqDelete(X, p_delete):
    Xt = []
    for x in X:
        Xt.append([w for w in x if py_rng.random() > p_delete])
    return Xt
Exemplo n.º 10
0
def SeqDelete(X, p_delete):
    Xt = []
    for x in X:
        Xt.append([w for w in x if py_rng.random() > p_delete])
    return Xt