April 2020
Intermediate to advanced
438 pages
12h 2m
English
Run the following steps to implement the RBM with PyTorch and run inference with the Numta images dataset:
n = 28df = pd.read_csv('images/Numta/training-e.csv')X_train = np.zeros((df.shape[0], n*n))for i in range(df.shape[0]): img = rgb2gray(imread('images/Numta/training-e/' + \ df.iloc[i]['filename'])) img = resize(img, (n,n)) X_train[i,:] = np.array([np.ravel(img)])test_images = glob('images/Numta/testing-e/*.png')X_test = np.zeros((len(test_images), n*n))for i in range(len(test_images)): img = rgb2gray(imread(test_images[i])) img = resize(img, (n,n)) X_test[i,:] = np.array([np.ravel(img)])
If you display a few randomly selected images from the training dataset, ...
Read now
Unlock full access