Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MPV
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Macalík
MPV
Commits
684cd700
Commit
684cd700
authored
2 years ago
by
Dmytro Mishkin
Browse files
Options
Downloads
Patches
Plain Diff
update the example
parent
a1b7d7e1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
assignment_0_3_correspondences_template/imagefiltering.ipynb
+214
-356
214 additions, 356 deletions
assignment_0_3_correspondences_template/imagefiltering.ipynb
assignment_0_3_correspondences_template/imagefiltering.py
+5
-18
5 additions, 18 deletions
assignment_0_3_correspondences_template/imagefiltering.py
with
219 additions
and
374 deletions
assignment_0_3_correspondences_template/imagefiltering.ipynb
+
214
−
356
View file @
684cd700
This diff is collapsed.
Click to expand it.
assignment_0_3_correspondences_template/imagefiltering.py
+
5
−
18
View file @
684cd700
...
...
@@ -41,7 +41,9 @@ def filter2d(x: torch.Tensor, kernel: torch.Tensor) -> torch.Tensor:
as the input.
"""
out
=
x
out
=
x
## Do not forget about flipping the kernel!
## See in details here https://towardsdatascience.com/convolution-vs-correlation-af868b6b4fb5
return
out
def
gaussian_filter2d
(
x
:
torch
.
Tensor
,
sigma
:
float
)
->
torch
.
Tensor
:
...
...
@@ -59,7 +61,7 @@ def gaussian_filter2d(x: torch.Tensor, sigma: float) -> torch.Tensor:
"""
ksize
=
get_gausskernel_size
(
sigma
)
out
=
x
out
=
x
return
out
...
...
@@ -80,22 +82,6 @@ def spatial_gradient_first_order(x: torch.Tensor, sigma: float) -> torch.Tensor:
return
out
def
spatial_gradient_second_order
(
x
:
torch
.
Tensor
,
sigma
:
float
)
->
torch
.
Tensor
:
r
"""
Computes the second order image derivative in xx, xy, yy directions using Gaussian derivative
Return:
torch.Tensor: spatial gradients
Shape:
- Input: :math:`(B, C, H, W)`
- Output: :math:`(B, C, 3, H, W)`
"""
b
,
c
,
h
,
w
=
x
.
shape
ksize
=
get_gausskernel_size
(
sigma
)
out
=
torch
.
zeros
(
b
,
c
,
3
,
h
,
w
)
return
out
def
affine
(
center
:
torch
.
Tensor
,
unitx
:
torch
.
Tensor
,
unity
:
torch
.
Tensor
)
->
torch
.
Tensor
:
r
"""
Computes transformation matrix A which transforms point in homogeneous coordinates from canonical coordinate system into image
...
...
@@ -147,6 +133,7 @@ def extract_antializased_affine_patches(input: torch.Tensor,
ext
:
float
=
6.0
):
"""
Extract patches defined by affine transformations A from scale pyramid created image tensor X.
It runs your implementation of the `extract_affine_patches` function, so it would not work w/o it.
You do not need to ever modify this finction, implement `extract_affine_patches` instead.
Args:
input: (torch.Tensor) images, :math:`(B, CH, H, W)`
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment