Lap Project – Deep Learning
- ObjectiveThis experiment aims to help students understand Convolutional Neural Networks (CNNs) and theirapplications in deep learning by implementing an image recognition model. Students will use theCombined COCO dataset, download link also provided on course Moodle page, for object detection,and complete the entire process of data preprocessing, model training, evaluation, and performanceanalysis.Note:The project provides a complete project package, according to the following steps to openthe script file in VScode or Jupyter Notebook, complete the experiment.ipynb file in the package(download the ML-Project_Autlab.zip from course Moodle page) .
- Integrateddevelopment
Environment VScode: Follow the following steps if you want to use the Visual Studio Code (VScode) integrated
development environment (IDE).
Step1:Step2:Step3:
Jupyter Notebook: Follow the following steps if you want to use the Jupyter notebook integrated development
MetricScalingFigure 1: A complete framework diagram of the final project of machine learning.
(1) Dataset Preparation and Processing
- Load and use the COCO dataset for object detection, extracting images and labels for eachinstance.
- Use the MyCOCODataset class to load the data into PyTorch’s DataLoader and performnecessary image processing steps (such as cropping, resizing, and normalization).
(2) Model Implementation
- Complete the implementation of the deep learning network, adjusting the input and outputlayers to match the number of classes in the COCO dataset (7 object categories).
- Ensure that convolutional layers, fully connected layers, and activation functions (ReLU)are correctly implemented. Make sure the network performs forward propagation properly.
(3) Model Training
- Train the model using the Cross-Entropy loss function (CrossEntropyLoss) and the Adamoptimizer (optim.Adam).
- Complete the training process and save the model weights to best_model.pth.
(4) Evaluation and Performance Analysis
- Load the trained model and evaluate it on the test set.
- Compute and output the accuracy of the model on the test set.
- Calculate and display the confusion matrix for further analysis of the model's performanceon each category.
(5) Visualization
- Use matplotlib to plot the confusion matrix and analyze the model's prediction performanceacross different categories.
- Observe and discuss the model’s classification results, identifying potential weaknesses andareas for improvement.4. TasksYou are required to complete the following tasks and write a report, which you need to upload tothe Moodle.
- Data Loading and Processing:
o Correctly implement the image cropping, resizing, and other preprocessing steps in theMyCOCODataset class.
o Load the COCO dataset and ensure it returns images and corresponding category labelscorrectly.
- Network Implementation:
o Complete the implementation of the deep learning model, ensuring it is adapted for the7-class classification task.
o Understand and implement the construction of convolutional layers, pooling layers,and fully connected layers.
- Model Training:
o Implement the training process for the model correctly, using the Cross-Entropy lossfunction and Adam optimizer.
o Ensure the model can be saved and loaded correctly.
- Performance Evaluation:
o Evaluate the model on the test set, compute the accuracy, and display the confusionmatrix.
o Analyze the results and identify how well the model performs on different categories.
o Discuss about the comparison between your deep model mechanism and machinelearning results (lab4 task).
- Marks Distribution and CriteriaThe submitted report and code will be marks against the following marking criteria.Task Weight Description Data Loading and
Processing 20%Correctly load the COCO dataset and complete imagepreprocessing (e.g., cropping, resizing, tensor conversion).Ensure that images and labels match the dataset.Network Implementation 25%Complete 代写Deep Learning Convolutional Neural Networks the implementation of the deep learning model.Ensure correct configuration of convolutional, pooling, andfully connected layers to fit the 7-class classification task.Model Training 20%Correctly implement the training process using Cross-Entropyloss and Adam optimizer. Ensure the model can save and loadweights properly.
Performance Evaluation and Comparison 25%Evaluate the model on the test set, calculate the accuracy, andplot the confusion matrix. Analyze model performance acrossdifferent categories including decision tree and deep learningmodel.Code Clarity and Reproducibility 10%The code should be well-structured, with clear variable namesand proper documentation. The experiment should bereproducible.Note that you should include a detailed description of the implementation, results and discussion inof the following parts in your report.
- Introduction:
- Data Loading and Processing (report and code): This includes correctly implementingimage preprocessing steps (cropping, resizing, normalization), ensuring the dataset loadscorrectly, and the integrity and consistency of data. You should explain the loading andprocessing parts including some sample outputs in your report.
- Network Implementation (report and code): You must complete the model architecture,ensuring each layer is properly defined and matches the task requirements (7-classclassification). You are expected to include network diagram and discussion on theproposed model architecture in your report.
- Model Training (report and code): Ensure the training process runs smoothly, with thecorrect use of the loss function and optimizer. The model should be correctly optimized andable to save and load weights. Discuss the model training process including the lossfunction and optimizer in tour report.
- Performance Evaluation and Comparison (report and code): Evaluate the proposedmodel's accuracy on the test set, plot and analyze the confusion matrix, and discuss thmodel's performance on different categories including decision tree (from Lab 4) and deepmodel. Also include heatmap confusion matrix plots and the evaluation metricsresults of both models on the test set. You are expected to compare the performance of thesetwo models and include a critical analysis of their performance comparison in your report.
- Code Clarity and Reproducibility (Code): Ensure that the code is well-structured, easyto understand, and the experiment is reproducible.
- Supplementary MaterialThe following supplementary material is provided in the zip fila on course Moodle page.
- Dataset: Combined COCO dataset with images and annotations.
- Code: Provided experiment code, including dataset loading, model definition, training, andevaluation.
- Environment: Python 3.x, PyTorch as a backend library, and the required deep learningframeworks.
Report and Code Submission You are required to submit the following items on Moodle before the due date.
- A complete PDF report, including all the details listed in section 5, using the followingnaming format: “GUID_FullName_ML-Report.
- A zip folder containing all the code necessary to reproduce the experiment, using thefollowing naming format: “GUID_FullName_ML-Code.