# Neural Networks

---
title: Neural Networks
categories: session
---

+ [PyTorch Quickstart](https://pytorch.org/tutorials/beginner/basics/quickstart_tutorial.html)
+ the quickstart tutorial is part of [Learn the Basics](https://pytorch.org/tutorials/beginner/basics/intro.html)
+ Szeliski 2022 Chapter 5

[Briefing](ANN)

# Exercise
# Exercise 1. Basic tutorial.

I have added a couple of exercises to the official
[PyTorch Quickstart](https://pytorch.org/tutorials/beginner/basics/quickstart_tutorial.html).
Please reflect upon and discuss the questions.
and try to
I have added a couple of exercises to the official
[PyTorch Quickstart](https://pytorch.org/tutorials/beginner/basics/quickstart_tutorial.html).

+ Please reflect upon and discuss the questions.

# Exercise 3. Regression.

One in-house project is to classify images of remote galaxies,
which are often distorted due to the gravity of dark matter.
This effect is known as gravitational lensing.

A sample dataset can be found at
[github](https://github.com/CosmoAI-AES/datasets2022/Exercise2022).
This directory contains

+ A data file, sphere-pm.csv
+ 10000 images of distorted galaxies
+ A python file Dataset.py defining a subclass of Dataset
to manage these data

The CSV file has the form

index,filename,source,lens,chi,x,y,einsteinR,sigma,sigma2,theta,nterms
"00001",image-00001.png,s,p,50,30,40,19,31,0,0,16

The interesting columns are the filename which points to the
input image,  and
the four output variables $x$, $y$, einsteinR, and $\sigma$.
The other columns are associated with more advanced problem instances
and should be ignored.

1.  Study the Dataset class Dataset.py.  How is the dataset managed?
2.  Use this class to test if you can train a network to determine the
four outputs for an image.

# Exercise 4.  Managing Data.

Doing a tutorial is good, but it is little use if you
you can only use the sample data.
The goal of this exercise is to learn to manage other
datasets.

Please be aware that deep learning is usually extremely compute
intensive, and you can easily run into a problem which takes days
to compute.  The immediate solution to this is to