Lab 2: Neural Networks for Image Classification Duration : 2 hoursTools:
- Jupyter Notebook
- IDE: PyCharm==2024.2.3 (or any IDE of your choice)
- Python: 3.12
- Libraries:
o PyTorch==2.4.0
o TorchVision==0.19.0
o Matplotlib==3.9.2
Learning Objectives:
- Understand the basic architecture of a neural network.
- Load and explore the CIFAR-10 dataset.
- Implement and train a neural network, individualized by your QMUL ID.
- Verify machine learning concepts such as accuracy, loss, and evaluation metrics
by running predefined code.Lab Outline:
In this lab, you will implement a simple neural network model to classify images fromthe CIFAR-10 dataset. The task will be individualized based on your QMUL ID to ensureunique configurations for each student.
- Task 1: Understanding the CIFAR-10 Dataset
- The CIFAR-10 dataset consists of 60,000 32x32 color images categorized into 10classes (airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships, and trucks).
- The dataset is divided into 50,000 training images and 10,000 testing images.
- You will load the CIFAR-10 dataset using PyTorch’s built-in torchvision library.
Step-by-step Instructions:
- Open the provided Jupyter Notebook.
- Load and explore the CIFAR-10 dataset using the following code:import torchvision.transforms as transformsimport torchvision.datasets as datasets
# Basic transformations for the CIFAR-10 datasettransform = transforms.Compose([transforms.ToTensor(),transforms.Normalize((0.5,), (0.5,))])
# Load the CIFAR-10 datasetdataset = 代写Neural Networks for Image Classification Duration datasets.CIFAR10(root='./data', train=True,download=True, transform=transform)
- Task 2: Individualized Neural Network Implementation, Training, and TestYou will implement a neural network model to classify images from the CIFAR-10dataset. However, certain parts of the task will be individualized based on your QMUL
- Follow the instructions carefully to ensure your model’s configuration is unique.
Step 1: Dataset Split Based on Your QMUL ID You will use the last digit of your QMUL ID to define the training-validation split:
- If your ID ends in 0-4: use a 70-30 split (70% training, 30% validation).
- If your ID ends in 5-9: use an 80-20 split (80% training, 20% validation).
Code:
plt.show()Lab Report Submission and Marking CriteriaAfter completing the lab, you need to submit a report that includes:
- Individualized Setup (20/100):
o Clearly state the unique configurations used based on your QMUL ID,including dataset split, number of epochs, learning rate, and batch size.
- Neural Network Architecture and Training (30/100):
o Provide an explanation of the model architecture (i.e., the number of inputlayer, hidden layer, and output layer, activation function) and trainingprocedure (i.e., the used optimizer).o Include the plots of training loss, training and validation accuracy.
- Results Analysis (30/100):o Provide analysis of the training and validation performance.o Reflect on whether the model is overfitting or underfitting based on theprovided results.
- Concept Verification (20/100):
o Answer the provided questions below regarding machine learningconcepts.(1) What is overfitting issue? List TWO methods for addressing the overfittingissue.
(2) What is the role of loss function? List TWO representative loss functions.
标签:10,training,Image,CIFAR,your,Duration,ID,dataset,Networks From: https://www.cnblogs.com/comp9321/p/18534004