Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YeaZ-GUI
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
chadhat
YeaZ-GUI
Commits
3462dff2
Commit
3462dff2
authored
4 years ago
by
mattminder
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix for error when running tracking on a frame with no preceding frame
parent
eda69c31
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unet/hungarian.py
+12
-7
12 additions, 7 deletions
unet/hungarian.py
with
12 additions
and
7 deletions
unet/hungarian.py
+
12
−
7
View file @
3462dff2
...
...
@@ -40,6 +40,12 @@ def hungarian_align(m1, m2):
value is -1.
"""
dist
,
ix1
,
ix2
=
cell_distance
(
m1
,
m2
)
# If dist couldn't be calculated, return dictionary from cells to themselves
if
dist
is
None
:
unique_m2
=
np
.
unique
(
m2
)
return
dict
(
zip
(
unique_m2
,
unique_m2
))
solver
=
Munkres
()
indexes
=
solver
.
compute
(
make_square
(
dist
))
...
...
@@ -62,18 +68,12 @@ def cell_to_features(im, c, nsamples=None, time=None):
com
=
sampled
.
mean
(
axis
=
0
)
# roundness, principal direction
dev
=
sampled
-
com
cov
=
dev
.
T
@
dev
evals
,
evecs
=
np
.
linalg
.
eig
(
cov
)
roundness
=
min
(
evals
)
/
max
(
evals
)
return
{
'
cell
'
:
c
,
'
time
'
:
time
,
'
sqrtarea
'
:
np
.
sqrt
(
area
),
'
area
'
:
area
,
'
com_x
'
:
com
[
0
],
'
com_y
'
:
com
[
1
],
'
roundness
'
:
roundness
}
'
com_y
'
:
com
[
1
]}
def
cell_distance
(
m1
,
m2
,
weight_com
=
3
):
...
...
@@ -97,6 +97,11 @@ def cell_distance(m1, m2, weight_com=3):
# Create df, rescale
feat1
,
ix_to_cell1
=
get_features
(
m1
,
1
)
feat2
,
ix_to_cell2
=
get_features
(
m2
,
2
)
# Check if one of matrices doesn't contain cells
if
len
(
feat1
)
==
0
or
len
(
feat2
)
==
0
:
return
None
,
None
,
None
df
=
pd
.
concat
((
feat1
,
feat2
))
df
[
cols
]
=
scale
(
df
[
cols
])
...
...
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