Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
instance_segmentation_classic
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
Maciej Wielgosz
instance_segmentation_classic
Commits
3c7a478f
Commit
3c7a478f
authored
2 years ago
by
Maciej Wielgosz
Browse files
Options
Downloads
Patches
Plain Diff
instance segmentation metrics updated to be gt oriented
parent
9925c0b5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
metrics/instance_segmentation_metrics.py
+18
-8
18 additions, 8 deletions
metrics/instance_segmentation_metrics.py
with
18 additions
and
8 deletions
metrics/instance_segmentation_metrics.py
+
18
−
8
View file @
3c7a478f
...
...
@@ -76,8 +76,18 @@ class InstanceSegmentationMetrics:
# reshape to 1D
ind_labels_Y
=
ind_labels_Y
.
reshape
(
-
1
)
# labels from X matched to Y
# get all the indices in X which were matched to Y
residual_ind
=
np
.
delete
(
np
.
arange
(
X
.
shape
[
0
]),
ind
.
reshape
(
-
1
))
# indices of X which were not matched to Y
# create a dictionary which contains Y, Y_labels and ind_labels_Y
dict_Y
=
{
'
Y
'
:
Y
,
'
Y_labels
'
:
Y_labels
,
'
ind_labels_Y
'
:
ind_labels_Y
}
dict_Y
=
{
'
X
'
:
X
,
# X is the input las file
'
Y
'
:
Y
,
# Y is the instance segmented las file
'
Y_labels
'
:
Y_labels
,
# Y_labels is the instance segmented las file
'
ind_labels_Y
'
:
ind_labels_Y
,
# ind_labels_Y is the labels from X matched to Y (new gt labels)
'
ind
'
:
ind
,
# ind is the indices of X which were matched to Y
'
residual_ind
'
:
residual_ind
# residual_ind is the indices of X which were not matched to Y
}
return
dict_Y
...
...
@@ -250,17 +260,17 @@ class InstanceSegmentationMetrics:
# get the indices of ind_labels_Y == dominant_label
ind_dominant_label
=
np
.
where
(
ind_labels_Y
==
dominant_label
)[
0
]
# true positive is the number of points for dominant_label
#
#
true positive is the number of points for dominant_label
true_positive
=
ind_dominant_label
.
shape
[
0
]
#
false positive is the number of all the points of this dominant_label label minus the true positive
false_positive
=
np
.
where
(
self
.
dict_Y
[
'
ind_labels_Y
'
]
==
dominant
_label
)[
0
]
.
shape
[
0
]
-
true_positive
#
# points which are within the relabelled pred but are not dominant_label
false_positive
=
ind_Y_labels
_label
.
shape
[
0
]
-
true_positive
# false negative is the number of
all the points in Y_labels minus the number of points of true_positive
false_negative
=
np
.
where
(
ind
_labels
_Y
!
=
dominant_label
)[
0
].
shape
[
0
]
#
#
false negative is the number of
points which are not in Y but are in X
false_negative
=
np
.
where
(
self
.
X
_labels
[
self
.
dict_Y
[
'
residual_ind
'
]]
=
=
dominant_label
)[
0
].
shape
[
0
]
# true negative
is the number of all the points minus the number of points of true_positive and false_positive
true_negative
=
self
.
dict_Y
[
'
ind_labels_Y
'
].
shape
[
0
]
-
false_negative
-
true_positive
-
false_positive
#
#
true negative
true_negative
=
self
.
dict_Y
[
'
X
'
].
shape
[
0
]
-
false_negative
-
true_positive
-
false_positive
# sum all the true_positive, false_positive, false_negative, true_negative
sum_all
=
true_positive
+
false_positive
+
false_negative
+
true_negative
...
...
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