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
f8d2701d
Commit
f8d2701d
authored
2 years ago
by
Dmytro Mishkin
Browse files
Options
Downloads
Patches
Plain Diff
remove Hessian
parent
080a2532
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/local_detector.ipynb
+42
-303
42 additions, 303 deletions
assignment_0_3_correspondences_template/local_detector.ipynb
assignment_0_3_correspondences_template/local_detector.py
+0
-85
0 additions, 85 deletions
assignment_0_3_correspondences_template/local_detector.py
with
42 additions
and
388 deletions
assignment_0_3_correspondences_template/local_detector.ipynb
+
42
−
303
View file @
f8d2701d
This diff is collapsed.
Click to expand it.
assignment_0_3_correspondences_template/local_detector.py
+
0
−
85
View file @
f8d2701d
...
...
@@ -5,37 +5,6 @@ import torch.nn.functional as F
import
typing
from
imagefiltering
import
*
def
hessian_response
(
x
:
torch
.
Tensor
,
sigma
:
float
)
->
torch
.
Tensor
:
"""
Computes the determinant of the Hessian matrix.
The response map is computed according the following formulation:
.. math::
R = det(H)
where:
.. math::
M = \sum_{(x,y) \in W}
\b
egin{bmatrix}
I_{xx} & I_{xy}
\\
I_{xy} & I_{yy}
\\
\end{bmatrix}
Args:
x: torch.Tensor: 4d tensor
sigma (float): sigma of Gaussian derivative
Return:
torch.Tensor: Hessian response
Shape:
- Input: :math:`(B, C, H, W)`
- Output: :math:`(B, C, H, W)`
"""
out
=
torch
.
zeros_like
(
x
)
return
out
def
harris_response
(
x
:
torch
.
Tensor
,
sigma_d
:
float
,
sigma_i
:
float
,
...
...
@@ -89,24 +58,6 @@ def nms2d(x: torch.Tensor, th: float = 0):
out
=
torch
.
zeros_like
(
x
)
return
out
def
hessian
(
x
:
torch
.
Tensor
,
sigma
:
float
,
th
:
float
=
0
):
r
"""
Returns the coordinates of maximum of the Hessian function.
Args:
x: torch.Tensor: 4d tensor
sigma (float): scale
th (float): threshold
Return:
torch.Tensor: coordinates of local maxima in format (b,c,h,w)
Shape:
- Input: :math:`(B, C, H, W)`
- Output: :math:`(N, 4)`, where N - total number of maxima and 4 is (b,c,h,w) coordinates
"""
# To get coordinates of the responces, you can use torch.nonzero function
out
=
torch
.
zeros
(
0
,
2
)
return
out
def
harris
(
x
:
torch
.
Tensor
,
sigma_d
:
float
,
sigma_i
:
float
,
th
:
float
=
0
):
r
"""
Returns the coordinates of maximum of the Harris function.
...
...
@@ -160,22 +111,6 @@ def nms3d(x: torch.Tensor, th: float = 0):
return
out
def
scalespace_hessian_response
(
x
:
torch
.
Tensor
,
n_levels
:
int
=
40
,
sigma_step
:
float
=
1.1
):
r
"""
First computes scale space and then computes the determinant of Hessian matrix on
Args:
x: torch.Tensor: 4d tensor
n_levels (int): number of the levels, (default 40)
sigma_step (float): blur step, (default 1.1)
Shape:
- Input: :math:`(B, C, H, W)`
- Output: :math:`(B, C, N_LEVELS, H, W)`, List(floats)
"""
out
=
torch
.
zeros
(
b
,
ch
,
n_levels
,
h
,
w
),
[
1.0
for
x
in
range
(
n_levels
)]
return
out
def
scalespace_harris_response
(
x
:
torch
.
Tensor
,
n_levels
:
int
=
40
,
...
...
@@ -194,26 +129,6 @@ def scalespace_harris_response(x: torch.Tensor,
return
out
def
scalespace_hessian
(
x
:
torch
.
Tensor
,
th
:
float
=
0
,
n_levels
:
int
=
40
,
sigma_step
:
float
=
1.1
):
r
"""
Returns the coordinates of maximum of the Hessian function.
Args:
x: torch.Tensor: 4d tensor
th (float): threshold
n_levels (int): number of scale space levels (default 40)
sigma_step (float): blur step, (default 1.1)
Shape:
- Input: :math:`(B, C, H, W)`
- Output: :math:`(N, 5)`, where N - total number of maxima and 5 is (b,c,d,h,w) coordinates
"""
# To get coordinates of the responces, you can use torch.nonzero function
# Don't forget to convert scale index to scale value with use of sigma
out
=
torch
.
zeros
(
0
,
3
)
return
out
def
scalespace_harris
(
x
:
torch
.
Tensor
,
th
:
float
=
0
,
...
...
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