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
a71a5ef3
Commit
a71a5ef3
authored
2 years ago
by
Maciej Wielgosz
Browse files
Options
Downloads
Patches
Plain Diff
inst seg metrics updated to contain more params and saving global results
parent
fe50c994
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
metrics/instance_segmentation_metrics.py
+11
-6
11 additions, 6 deletions
metrics/instance_segmentation_metrics.py
metrics/instance_segmentation_metrics_in_folder.py
+8
-6
8 additions, 6 deletions
metrics/instance_segmentation_metrics_in_folder.py
with
19 additions
and
12 deletions
metrics/instance_segmentation_metrics.py
+
11
−
6
View file @
a71a5ef3
...
...
@@ -276,8 +276,8 @@ class InstanceSegmentationMetrics:
# find hight of the tree in the prediction
hight_of_tree_pred
=
(
self
.
instance_segmented_las
[
self
.
Y_labels
==
label
].
z
).
max
()
-
(
self
.
instance_segmented_las
[
self
.
Y_labels
==
label
].
z
).
min
()
# get resiudal of the hight of the tree in the prediction
residual_hight_of_tree_pred
=
hight_of_tree_gt
-
hight_of_tree_pred
# get
abs
resiudal of the hight of the tree in the prediction
residual_hight_of_tree_pred
=
abs
(
hight_of_tree_gt
-
hight_of_tree_pred
)
# create tmp dict
tmp_dict
=
{
...
...
@@ -299,7 +299,7 @@ class InstanceSegmentationMetrics:
metric_dict
[
str
(
label
)]
=
tmp_dict
# list of interesting metrics
interesting_parameters
=
[
'
true_positive
'
,
'
false_positive
'
,
'
false_negative
'
,
'
true_negative
'
,
'
precision
'
,
'
recall
'
,
'
f1_score
'
,
'
IoU
'
]
interesting_parameters
=
[
'
precision
'
,
'
recall
'
,
'
f1_score
'
,
'
IoU
'
,
'
residual_hight(gt_minus_pred)
'
]
# weight the metrics by tree hight
metric_dict_weighted_by_tree_hight
=
{}
...
...
@@ -350,11 +350,14 @@ class InstanceSegmentationMetrics:
trees_correctly_predicted_IoU
=
set
(
trees_correctly_predicted_IoU
)
tree_level_metric
=
{
'
true_positve (detection rate)
'
:
len
(
trees_correctly_predicted_IoU
),
'
false_positve (commission)
'
:
len
(
trees_predicted
-
trees_correctly_predicted_IoU
),
'
false_negative (omissions)
'
:
len
(
gt_trees
-
trees_predicted
-
trees_correctly_predicted_IoU
),
'
true_positve (detection rate)
'
:
len
(
trees_correctly_predicted_IoU
)
/
len
(
gt_trees
)
,
'
false_positve (commission)
'
:
len
(
trees_predicted
-
trees_correctly_predicted_IoU
)
/
len
(
gt_trees
)
,
'
false_negative (omissions)
'
:
len
(
gt_trees
-
trees_predicted
-
trees_correctly_predicted_IoU
)
/
len
(
gt_trees
)
,
'
gt
'
:
len
(
gt_trees
)}
# add tree level metrics to the metric_dict_mean
metric_dict_mean
.
update
(
tree_level_metric
)
if
self
.
verbose
:
print
(
'
Tree level metrics:
'
)
print
(
f
'
Trees in the ground truth:
{
gt_trees
}
'
)
...
...
@@ -363,6 +366,8 @@ class InstanceSegmentationMetrics:
print
(
tree_level_metric
)
return
metric_dict
,
metric_dict_weighted_by_tree_hight
,
metric_dict_mean
def
print_metrics
(
self
,
metric_dict
):
...
...
This diff is collapsed.
Click to expand it.
metrics/instance_segmentation_metrics_in_folder.py
+
8
−
6
View file @
a71a5ef3
import
csv
import
glob
import
os
import
argparse
...
...
@@ -125,12 +126,13 @@ class InstanceSegmentationMetricsInFolder():
if
self
.
output_folder_path
is
not
None
:
# create the output folder path
save_to_csv_path
=
os
.
path
.
join
(
self
.
output_folder_path
,
'
mean_f1_score.csv
'
)
# save the mean f1 score to a csv file
with
open
(
save_to_csv_path
,
'
w
'
)
as
f
:
f
.
write
(
'
mean_f1_score
\n
'
)
f
.
write
(
str
(
mean_f1_score
))
save_to_csv_path
=
os
.
path
.
join
(
self
.
output_folder_path
,
'
summary_metrics_all_plots.csv
'
)
# save the mean metrics to a csv file
with
open
(
save_to_csv_path
,
'
w
'
)
as
csv_file
:
writer
=
csv
.
writer
(
csv_file
)
for
key
,
value
in
mean_metrics
.
items
():
writer
.
writerow
([
key
,
value
])
if
self
.
verbose
:
print
(
'
Mean F1 Score: {}
'
.
format
(
mean_f1_score
))
# print the mean metrics
...
...
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