DanielGeschka
11/27/2017 - 1:25 PM

reshape numpy array

#!/usr/bin/env python
# -*- coding: utf-8 -*-

#import autoencoder
import numpy as np
import h5py
import cv2 as cv
import loadlabels as ll


############################################################################################
# Load traindata
############################################################################################
X, Y, testX, testY = None, None, None, None
DATASET_FILE = "_no_install/full_data_2.h5"
try:
	X, Y, testX, testY = ll.loadData(DATASET_FILE)

	print("Shape X: {}".format(X.shape))
	print("Dim X: {}, {}, {}".format(X.shape[0], X.shape[1], X.shape[2]))
	X_R = np.reshape(X, (X.shape[0], X.shape[1], X.shape[2], 1))
	print("Shape X_R: {}".format(X_R.shape))
	print("Dim X_R: {}, {}, {}, {}".format(X_R.shape[0], X_R.shape[1], X_R.shape[2], X_R.shape[3]))




except BaseException as excep:
	print(
		"Loading of the dataset faild. For trainig and evaluation you need the weights file "
		"{}. Exception-Message: {}".format(DATASET_FILE, str(excep)))
	exit(1)