Demo_of_cnn________________________.pptx

parthmani 10 views 11 slides Aug 29, 2025
Slide 1
Slide 1 of 11
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11

About This Presentation

sdfsd


Slide Content

Implementation of Basic Convolutional Neural Network (CNN) Presenter Prof. Samim Aktar

Dataset Preparation: CIFAR-10 Example Effective CNN training begins with proper data preparation. The CIFAR-10 dataset is a standard benchmark. Dataset Characteristics 60,000 32x32 color images across 10 distinct classes (e.g., airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck). Data Split Normalization Visualization Divided into 50,000 images for training the model and 10,000 images for testing its performance. Pixel values, originally 0-255, are normalized to a [0,1] range by dividing by 255 to ensure consistent input scale. Visualize a sample of images from the dataset to verify data integrity and proper loading.

Basic CNN Implementation in Python (TensorFlow/Keras) # Import Libraries import tensorflow as tf from tensorflow.keras import layers, models import matplotlib.pyplot as plt # Load and Preprocess the Data # Load CIFAR-10 dataset ( x_train , y_train ), ( x_test , y_test ) = tf.keras.datasets.cifar10.load_data() # Normalize pixel values to between 0 and 1 x_train , x_test = x_train / 255.0, x_test / 255.0 # Build the CNN Model model = models.Sequential () model.add (layers.Conv2D(32, (3, 3), activation=' relu ', input_shape =(32, 32, 3))) model.add (layers.MaxPooling2D((2, 2))) model.add (layers.Conv2D(64, (3, 3), activation=' relu ')) model.add (layers.MaxPooling2D((2, 2))) model.add (layers.Conv2D(64, (3, 3), activation=' relu ')) model.add ( layers.Flatten ()) model.add ( layers.Dense (64, activation=' relu ')) model.add ( layers.Dense (10, activation=' softmax ’)) # Compile the Model model.compile ( optimizer=' adam ', loss=' sparse_categorical_crossentropy ', metrics=['accuracy'] ) # Train the Model history = model.fit ( x_train , y_train , epochs=10, validation_data =( x_test , y_test ) ) # Evaluate Model Performance test_loss , test_acc = model.evaluate ( x_test , y_test , verbose=2) print( f'Test accuracy: { test_acc }’) # Visualize Training Results plt.plot ( history.history ['accuracy'], label='Training Accuracy') plt.plot ( history.history [' val_accuracy '], label='Validation Accuracy') plt.xlabel ('Epoch') plt.ylabel ('Accuracy') plt.legend () plt.show ()

Thank You
Tags