CSCE 5218 Deep Learning Assignment

Assignment Help Other Subject
Reference no: EM133134321

CSCE 5218 Deep Learning - University of North Texas

You will write your code and any requested responses or descriptions of your results, in a Colab Jupyter notebook.

1. Implement AlexNet

869_Deep Learning.jpg

 

Figure 1. Architecture of AlexNet (Krizhevsky et al., NIPS, 2012).

AlexNet is a milestone in the resurgence of deep learning, and it astonished the computer vision community by winning the ILSVRC 2012 by a large margin. In this assignment, you need to implement the original AlexNet using PyTorch. The model architecture is shown in the Figure1, which is from their originalpaper. You should have a good understanding about the paper because we discussed it in class and you reviewed it.

More specifically, your AlexNet should have the following architecture (e.g. for domain prediction task) in Figure2:

371_Deep Learning1.jpg

 

Figure 2. Detailed architecture of AlexNet.

Before you get started, we have several hints hopefully to make your life easier:

ˆ In the figure the image size is 224 x 224 x 3, but unfortunately that is a mistake. The real input should be RGB image of shape 227 x 227 x 3.
ˆ Thanks to the improved hardware (i.e. GPU with larger memory), you don't need to split the convolutions into two cards any more (as shown in the figure).
ˆ There are many implementations online regarding the AlexNet, for example, torchvision library has an official implementation:here. We strongly recommend you to check it out, but please be aware that this implementation is incorrect as it is a modified version of AlexNet (not the one we described above). Therefore, if you simply copy/paste this code, you won't get any points.

Instead, we expect you to read and understand this implementation, and make modifications based on it (which is much easier than you thought).

Your model should use torch.nn.Conv2d, torch.nn.Linear, torch.nn.ReLU, torch.nn.Dropout etc. modules that are built-in to PyTorch. You don't need to (and are not supposed to) implement any of these modules on your own.

ˆ Lastly but probably most importantly, for your convenience, the data loader and the train- ing/evaluation scripts are provided in thestarter code. Please download and read the code carefully. More specifically, there is a PACSDataset class for this assignment. You can download the images of the dataset fromhere.

Briefly speaking, the dataset contains 9991 images (train + val), including images from 4 domains (art painting, cartoon, photo and sketch) and 7 different classes (dog, elephant, giraffe, guitar, horse, house and person) It is a good benchmark to study the domain shift problem, as you can tell an image of the same class can have very different appearances according to domain. More details about the dataset can be foundhereif you are interested.

Therefore, each image has two different labels, one for class and one for domain.

The provided dataset can handle both labels, and you could specify the label type by flag label type. In next part you need to train models for domain prediction and class prediction.
ˆ Please be aware that the signature of the function is fixed, so please DO NOT change the function signature.
ˆ You need the following packages in your Python environment:
matplotlib seaborn torch absl-py scikit-image tensorboard torchvision tqdm.

Instructions

1. Download the starter code, which includes data, from Canvas, and put the starter code in a Colab notebook.
2. Complete the implementation of class AlexNet, and training the model for domain prediction task.
A sample usage for the provided training/evaluation script (from the shell) is python cnn trainer.py --task type=training --label type=domain --learning rate=0.001
--batch size=128 --experiment name=demo
3. You may need to tune the hyperparamters to achieve better performance.

4. Report the model architecture (i.e. call print(model) and copy/paste the output in your notebook), as well as the accuracy on the validation set.

2. Enhancing AlexNet

In this part, you need to modify the AlexNet in previous part, and train different models with the following changes.
Just a friendly reminder, if you implement AlexNet following our recommendation, it should be very easy (e.g. just changing a few lines) to perform the following modifications.
Instructions
Larger kernel size
Initial AlexNet has 5 convolutional kernels as defined in the table in Section 1.

We observe that for the 1st, 2nd and 5th convolutional layers, a MaxPool2d layer is followed to down- sample the inputs.
An alternative strategy is to use larger convolutional kernel (thus larger receptive field) and larger stride, which gives smaller output directly.
Please copy your AlexNet to a new class named AlexNetLargeKernel, and implement the model fol- lowing the architectures given in Figure3.

1117_Deep Learning2.jpg

 

Figure 3. AlexNet with larger kernel.

Note that, please use the same optimal hyperparameter with Section 1 to train the new model, and report architecture and accuracy in your report.

1748_Deep Learning3.jpg

Figure 4. AlexNet with different pooling.

Pooling strategies

Another tweak to the AlexNet is the pooling layer. Instead of MaxPool2d another common pooling strategy is AvgPool2d, i.e. to average all the neurons in the receptive field.

Please copy your AlexNet to a new class named AlexNetAvgPooling, and implement the model following the architectures given Figure4.
Note that, please use the same optimal hyperparameter with Section 1 to train the new model, and report architecture and accuracy in your report.

Visualizing Learned Filter

Different from hand-crafted features, the convolutional neural network extracted features from input images automatically thus are difficult for human to interpret. A useful strategy is to visualize the kernels learned from data. In this part, you are asked to check the kernels learned in AlexNet for two different tasks, i.e. classifying domains or classes.

You need to compare the kernels in different layers for two models (trained for two different tasks), and see if the kernels have different patterns.

For your convenience, we provided a visualization function in thestarter code( visualize kernels).

Instruction

ˆ Train two AlexNet on the PACS dataset for two different tasks (predicting domain and predicting class, respectively) using the same, optimal hyperparameters from Section 1.
ˆ Complete a function named analyze model kernels, which: (1) load the well-trained checkpoint,
(2) get the model kernels from the checkpoint, (3) using the provided visualization helper function visualize kernels to inspect the learned filters.
ˆ Report the kernel visualization for two models, and 5 convolution kernels for each model, in your notebook. Compare the learned kernels and summarize your findings.

Attachment:- Deep Learning.rar

Reference no: EM133134321

Questions Cloud

Concept of economic development : Examine critically why and how the concept of economic development has undergone change several times since 1950s with examples that you know.
Same local content rules applicable to renewables : Are the same local content rules applicable to renewables as it is to fossil fuels (oil and gas).
Determine the labor market outcomes : Market forces, Institutional forces, Sociological forces are the three broad forces that together determine the labor market outcomes (wages and the number of j
General pessimism about the future economic growth : Suppose the economy moves into recession and there is general pessimism about the future economic growth, how will this sentiment affect the equilibrium rate of
CSCE 5218 Deep Learning Assignment : CSCE 5218 Deep Learning Assignment Help and Solution, University of North Texas - Assessment Writing Service
Economic recession affect management bargaining power : How does an economic recession affect management's bargaining power? How is a union's power affected?
Creating venture capital firm : We are creating a venture capital firm For a FINTECH company, The goal is to Reduce the wealth gap for women, people of color and lower income communities .
Find rep best response function : There is a community of 300 people who live in a village at site X and work at a pulp mill at site Y . Currently they travel between X and Y on Route 1, a route
Who bears the cost of legislation : Under us law, employee are required to grant new mothers ir fathers six. weeks of unpaid leave upon the birth of a child. the employee can come back to work wit

Reviews

len3134321

4/28/2022 12:56:22 AM

I need the code seperately for both the tasks Code and document separately There are tasks in the code, do seperate python notebooks for them I want the project to be done in PyTorch The Alexnet needs to be done in PyTorch

Write a Review

Other Subject Questions & Answers

  Ability to invest regulated in different ways

Should "at-risk" investors have their ability to invest regulated in different ways than expert investors? Argue that all investors should have the same rights and protections. Then make the contrary argument using Frederick and Hoffman

  What teaching would the rn incorporate into a plan of care

What teaching would the RN incorporate into a plan of care that focuses on coping and adaptation? What cues would nurse use to determine the patient is ready?

  What are the legal implications of freedom of the press

What are the legal implications of "freedom of the press" as it relates to terrorism? Is media coverage of these situations important for society's understanding of the events? Why or why not? Is it possible to balance these needs?

  What effect do the nursing research priorities have

Explore the National Institute of Nursing Research (NINR) website. Review their publication Bringing science to life: NINR strategic plan (2011, p. 7).

  Identify a minimum of three scenes in the film

A reflection on the positive and negative messages that the film or story portray regarding the particular disorder or psychological dynamics.

  Explain the type of behavior that represents a problem

Explain the type of behavior that represents a problem for coexistence in society and for both state and federal government structures.

  How strategic thinking could lead to the identification

Select an organization in the health care arena you would like to work for. With this organization in mind, describe how strategic thinking could lead to the identification of opportunities for this organization to gain a competitive edge in the ..

  Discuss the five periods of juvenile justice history

Identify and discuss the five periods of juvenile justice history and which period you think was the most influential to the evolution of the juvenile justice system

  Trade of goods and people

The trade of goods, people, and such between Europe and the Americas is commonly termed the:

  Provide an analytical review of the paper outlining themes

310 HRM Innovation and Change - Provide an analytical review of the paper outlining the main themes and issues discussed and implications of these for managing

  Explain the absorption approach and monetary approach

In a critical essay, evaluate the three major approaches to analyzing the economic impact of currency depreciation: the elasticities approach.

  Liver leading to bile pigments circulating through the body

Buildup of bile within the liver leading to bile pigments circulating through  the body could cause tissues to turn yellow and a condition called:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd