Search
Python, numpy and PyTorch will be used for the MPV labs. In case you are not familiar with them, study the following parts of the "Intro to numpy", "A Beginner-Friendly Guide to PyTorch and How it Works from Scratch", Pytorch for numpy users, |numpy for matlab users
Introduction into PyTorch Image Processing.
To fulfil this assignment, you need to submit these files (all packed in one .zip file) into the upload system:
.zip
imagefiltering.ipynb
imagefiltering.py
gaussian1d
gaussian_deriv1d
filter2d
gaussian_filter2d
spatial_gradient_first_order
spatial_gradient_second_order
affine
extract_affine_patches
Use template of the assignment. When preparing a zip file for the upload system, do not include any directories, the files have to be in the zip file root.
Python and PyTorch Development
import torch.nn.functional as F with torch.no_grad(): out = F.conv2d(in, weight)
gaussian1d(x,sigma)
x
gaussian_deriv1d(x,sigma)
torch.nn.functional.conv2d
filter2d(in,kernel)
gaussian_filter2d(in,sigma)
2*ceil(sigma*3.0)+1
from lab0_reference.imagefiltering import gaussian_filter2d inp = torch.zeros((1,1,32,32)) inp[...,15,15] = 1. imshow_torch(inp) sigma = 3.0 out = gaussian_filter2d(inp, sigma) imshow_torch(out)
spatial_gradient_first_order(in,sigma)
spatial_gradient_second_order(in,sigma)
Gaussian derivatives
affine(x1_y1,x2_y2,x3_y3)
extract_affine_patches(in,A,ps,ext)
extract_affine_patches(in,A,41,3.0)
Geometric transformations - review of course Digital image processing Geometric transformations - hierarchy of transformations, homogeneous coordinates
You can check results of the functions required in this lab using the Jupyter notebook imagefiltering.ipynb.