Question: Test CNN over the cifar10 data set, which contains 32x32 colour images from 10 classes: 1. Use the below code to load the data set.

 Test CNN over the cifar10 data set, which contains 32x32 colour

Test CNN over the cifar10 data set, which contains 32x32 colour images from 10 classes: 1. Use the below code to load the data set. from keras.datasets import cifar10 (x_train, y_train), (x_test, y_test) = cifar10.load_data() print("Train samples:", x_train. shape, y_train.shape) print("Test samples:", x_test. shape, y_test. shape) 2. Show the 10 classes NUM_CLASSES = 10 cifar10_classes = ["airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"] # show random images from train cols = 8 rows = 2 fig = plt. figure(figsize=(2 * cols - 1, 2.5 * rows - 1)) for i in range(cols): for j in range(rows): random_index = np.random.randint(0, len(y-train)) ax = fig.add_subplot(rows, cols, i * rows + j + 1) ax.grid('off') ax.axis('off') ax. imshow(x_train[random_index, :]) ax.set_title(cifar10_classes [y_train[random_index, 0]]) plt.show 3. Define a CNN architecture and train your own model by playing with the network setup: like, performs convolution, performs 2D max pooling, changing activation function from ReLU to LeakyReLU, adding dropout etc. # import necessary building blocks from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Activation, Dropout from keras.layers.advanced_activations import LeakyReLU Test CNN over the cifar10 data set, which contains 32x32 colour images from 10 classes: 1. Use the below code to load the data set. from keras.datasets import cifar10 (x_train, y_train), (x_test, y_test) = cifar10.load_data() print("Train samples:", x_train. shape, y_train.shape) print("Test samples:", x_test. shape, y_test. shape) 2. Show the 10 classes NUM_CLASSES = 10 cifar10_classes = ["airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"] # show random images from train cols = 8 rows = 2 fig = plt. figure(figsize=(2 * cols - 1, 2.5 * rows - 1)) for i in range(cols): for j in range(rows): random_index = np.random.randint(0, len(y-train)) ax = fig.add_subplot(rows, cols, i * rows + j + 1) ax.grid('off') ax.axis('off') ax. imshow(x_train[random_index, :]) ax.set_title(cifar10_classes [y_train[random_index, 0]]) plt.show 3. Define a CNN architecture and train your own model by playing with the network setup: like, performs convolution, performs 2D max pooling, changing activation function from ReLU to LeakyReLU, adding dropout etc. # import necessary building blocks from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Activation, Dropout from keras.layers.advanced_activations import LeakyReLU

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!