Ejemplo n.º 1
0
def ImgToConv(X):
    """
    DOCSTRING
    """
    if not utils.numpy_array(X):
        X = numpy.asarray(X)
    return X.transpose(0, 3, 1, 2)
Ejemplo n.º 2
0
def ZeroOneScale(X):
    """
    DOCSTRING
    """
    if not utils.numpy_array(X):
        X = numpy.asarray(X)
    return X / 255.0
Ejemplo n.º 3
0
def FlatToImg(X, w, h, c):
    """
    DOCSTRING
    """
    if not utils.numpy_array(X):
        X = numpy.asarray(X)
    return X.reshape(-1, w, h, c)
Ejemplo n.º 4
0
def Standardize(X):
    """
    DOCSTRING
    """
    if not utils.numpy_array(X):
        X = numpy.asarray(X)
    return X / 127.5 - 1.0
Ejemplo n.º 5
0
def standardize_X(shape, X):
	if not numpy_array(X):
		X = np.asarray(X)

	if len(shape) == 4 and len(X.shape) == 2:
		return X.reshape(-1, shape[2], shape[3], shape[1]).transpose(0, 3, 1, 2)
	else:
		return X
Ejemplo n.º 6
0
def standardize_X(shape, X):
	if not numpy_array(X):
		X = np.asarray(X)

	if len(shape) == 4 and len(X.shape) == 2:
		return X.reshape(-1, shape[2], shape[3], shape[1]).transpose(0, 3, 1, 2)
	else:
		return X
Ejemplo n.º 7
0
def standardize_X(shape, X):
    """
    DOCSTRING
    """
    if not utils.numpy_array(X):
        X = numpy.asarray(X)
    if len(shape) == 4 and len(X.shape) == 2:
        return X.reshape(-1, shape[2], shape[3], shape[1]).transpose(0, 3, 1, 2)
    else:
        return X
Ejemplo n.º 8
0
def standardize_Y(shape, Y):
	if not numpy_array(Y):
		Y = np.asarray(Y)
	if len(Y.shape) == 1:
		Y = Y.reshape(-1, 1)
	if len(Y.shape) == 2 and len(shape) == 2:
		if shape[-1] != Y.shape[-1]:
			return one_hot(Y, n=shape[-1])
		else:
			return Y
	else:
		return Y
Ejemplo n.º 9
0
def standardize_Y(shape, Y):
	if not numpy_array(Y):
		Y = np.asarray(Y)
	if len(Y.shape) == 1:
		Y = Y.reshape(-1, 1)
	if len(Y.shape) == 2 and len(shape) == 2:
		if shape[-1] != Y.shape[-1]:
			return one_hot(Y, n=shape[-1])
		else:
			return Y
	else:
		return Y
Ejemplo n.º 10
0
def standardize_Y(shape, Y):
    """
    DOCSTRING
    """
    if not utils.numpy_array(Y):
        Y = numpy.asarray(Y)
    if len(Y.shape) == 1:
        Y = Y.reshape(-1, 1)
    if len(Y.shape) == 2 and len(shape) == 2:
        if shape[-1] != Y.shape[-1]:
            return one_hot(Y, n=shape[-1])
        else:
            return Y
    else:
        return Y
Ejemplo n.º 11
0
def ZeroOneScale(X):
    if not numpy_array(X):
        X = np.asarray(X)
    return X / 255.
Ejemplo n.º 12
0
def Standardize(X):
    if not numpy_array(X):
        X = np.asarray(X)
    return X / 127.5 - 1.
Ejemplo n.º 13
0
def ImgToConv(X):
    if not numpy_array(X):
        X = np.asarray(X)
    return X.transpose(0, 3, 1, 2)
Ejemplo n.º 14
0
def FlatToImg(X, w, h, c):
	if not numpy_array(X):
		X = np.asarray(X)	
	return X.reshape(-1, w, h, c)