Skip to content

luciainnocenti/Domain-adaptation

 
 

Repository files navigation

Homework3-PACS

This project is about training a neural network by using a training set and a test belonging to different domains.
In order to provide a network, a datasetand the related methods, my project contains:
•The dataset: when the PACSDataset class is initialized, it provides all the methods to extract images and labels etc
•The network: inside the file ”gradientreversalexample.py” there are two main classes:
–RandomNetworkWithReverseGrad: it provides the main structure forthe network, that is a modified version of the AlexNet; the differenceis that my network has two types of classifiers: one for classes and theother one for domains. The forward definition distinguish between this two classifiers and, if classes, provide the ”standard backward” for CNN; else, it provide a modified version of the backward thatnegate the loss and multiply it by a factor alpha, that is an hyper-parameter
–alexNetDA: it is a wrap class for the network, and allow to load a pretrained model. If the pretrained flag is set to True, the class copy all weights and bias from the AlexNet trained with imageNet to the network defined before, both for class classifier and domain one. It also adapts last layers to the correct number of classes.
Starting from this structure, in the notebook I’ve trained a network by ap-plying first a traditional approach, but using as train and test set images from different domains. Then, I’ve follow the approach explained in the paper for the Domain Adaptation Neural Network

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 99.0%
  • Python 1.0%