Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VOB
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
Container Registry
Model registry
Operate
Environments
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
Petra Gospodnetic
VOB
Commits
c33643d5
Commit
c33643d5
authored
4 years ago
by
gospodnetic
Browse files
Options
Downloads
Patches
Plain Diff
Add average discarded per approach computation
parent
ea283caa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Benchmark.py
+36
-0
36 additions, 0 deletions
Benchmark.py
Log.py
+4
-0
4 additions, 0 deletions
Log.py
LogContainer.py
+45
-0
45 additions, 0 deletions
LogContainer.py
vob.py
+2
-0
2 additions, 0 deletions
vob.py
with
87 additions
and
0 deletions
Benchmark.py
+
36
−
0
View file @
c33643d5
import
utilities
as
util
from
LogContainer
import
LogContainer
import
numpy
as
np
class
Benchmark
:
def
__init__
(
self
):
...
...
@@ -73,3 +76,36 @@ class Benchmark:
tex_file
.
write
(
"
\n\\
end{tabular}
"
)
tex_file
.
write
(
"
\n\\
end{table*}
\n
"
)
tex_file
.
close
()
# Average ray tracing duration.
def
get_average_RT_duration_per_model
(
self
):
avgs
=
{}
for
model
in
self
.
log_container_per_model
:
avgs
.
update
(
{
model
:
self
.
log_container_per_model
[
model
].
get_avg_RT_duration
()
})
return
avgs
def
get_average_discarded_per_approach
(
self
):
discarded_per_approach_list
=
{}
for
approach
in
self
.
methods_per_approach
:
for
model
in
self
.
log_container_per_model
:
log_container
=
LogContainer
(
self
.
log_container_per_model
[
model
].
get_methods_per_approach
())
log_container
.
add_logs
(
self
.
log_container_per_model
[
model
].
get_logs_by_approach
(
approach
))
if
log_container
.
size
()
==
0
:
continue
container_avg
=
log_container
.
get_avg_discarded
()
if
approach
in
discarded_per_approach_list
:
discarded_per_approach_list
[
approach
].
append
(
container_avg
)
else
:
discarded_per_approach_list
[
approach
]
=
[
container_avg
]
discarded_per_approach
=
{}
for
approach
in
discarded_per_approach_list
:
discarded_per_approach
[
approach
]
=
np
.
sum
(
discarded_per_approach_list
[
approach
])
/
len
(
discarded_per_approach_list
[
approach
])
print
(
"
discarded_per_approach: {}
"
.
format
(
discarded_per_approach
))
return
discarded_per_approach
This diff is collapsed.
Click to expand it.
Log.py
+
4
−
0
View file @
c33643d5
...
...
@@ -240,6 +240,10 @@ class Log:
def
get_cumulative_triangle_per_vp
(
self
):
return
self
.
convert_cumulative
(
self
.
optimization
[
"
triangle_per_vp
"
])
def
get_discarded_quotient
(
self
):
total_VPC
=
self
.
VPC
[
"
count
"
]
+
self
.
VPC
[
"
discarded_count
"
]
return
self
.
VPC
[
"
discarded_count
"
]
/
total_VPC
# Utilities
def
convert_cumulative
(
self
,
value_array
):
cumulative_array
=
[]
...
...
This diff is collapsed.
Click to expand it.
LogContainer.py
+
45
−
0
View file @
c33643d5
...
...
@@ -14,6 +14,9 @@ class LogContainer:
self
.
__parse_methods_per_approach
()
def
size
(
self
):
return
len
(
self
.
logs
)
def
add_log
(
self
,
log
):
method
=
log
.
VPC
[
"
method
"
]
if
method
in
self
.
approaches_per_method
:
...
...
@@ -21,11 +24,28 @@ class LogContainer:
else
:
raise
Exception
(
"
Error: method
'
{}
'
has not been specified and is not known which approach does it belong to.
"
.
format
(
method
))
self
.
logs
.
append
(
log
)
if
approach
in
self
.
logs_per_approach
:
self
.
logs_per_approach
[
approach
].
append
(
log
)
else
:
self
.
logs_per_approach
[
approach
]
=
[
log
]
def
add_logs
(
self
,
input_logs
):
for
log
in
input_logs
:
method
=
log
.
VPC
[
"
method
"
]
if
method
in
self
.
approaches_per_method
:
approach
=
self
.
approaches_per_method
[
method
]
else
:
raise
Exception
(
"
Error: method
'
{}
'
has not been specified and is not known which approach does it belong to.
"
.
format
(
method
))
self
.
logs
.
append
(
log
)
if
approach
in
self
.
logs_per_approach
:
self
.
logs_per_approach
[
approach
].
append
(
log
)
else
:
self
.
logs_per_approach
[
approach
]
=
[
log
]
def
print_status
(
self
):
for
approach
in
self
.
logs_per_approach
:
print
(
"
Approach
'
{}
'
has {} logs
"
.
format
(
approach
,
len
(
self
.
logs_per_approach
[
approach
])))
...
...
@@ -35,6 +55,9 @@ class LogContainer:
print
(
"
Methods per approach:
"
)
pp
.
pprint
(
self
.
methods_per_approach
)
def
get_methods_per_approach
(
self
):
return
self
.
methods_per_approach
def
get_logs_by_method
(
self
,
method
):
approach
=
self
.
approaches_per_method
[
method
]
if
approach
not
in
self
.
logs_per_approach
:
...
...
@@ -47,6 +70,11 @@ class LogContainer:
return
method_logs
def
get_logs_by_approach
(
self
,
approach
):
if
approach
in
self
.
logs_per_approach
:
return
self
.
logs_per_approach
[
approach
]
return
[]
# Log which obtains coverage over 99% with minimal number of viewpoint candidates
# If no log obrains coverage over 99%, the log with the greatest coverage is considered.
def
get_best_log
(
self
,
method
):
...
...
@@ -62,6 +90,23 @@ class LogContainer:
else
:
return
self
.
max_coverage_log
(
method_logs
)
def
get_avg_RT_duration
(
self
):
if
len
(
self
.
logs
)
==
0
:
return
0
summed_per_vp_duration
=
0
for
log
in
self
.
logs
:
if
log
.
VPC
[
"
count
"
]
==
0
:
continue
summed_per_vp_duration
+=
log
.
timing
[
"
visibility_matrix_sec
"
]
/
log
.
VPC
[
"
count
"
]
return
summed_per_vp_duration
/
len
(
self
.
logs
)
def
get_avg_discarded
(
self
):
discarded_sum
=
0
for
log
in
self
.
logs
:
discarded_sum
+=
log
.
get_discarded_quotient
()
return
discarded_sum
/
len
(
self
.
logs
)
def
max_coverage_log
(
self
,
input_logs
=
None
):
if
not
input_logs
:
input_logs
=
self
.
logs
...
...
This diff is collapsed.
Click to expand it.
vob.py
+
2
−
0
View file @
c33643d5
...
...
@@ -59,6 +59,8 @@ def main():
benchmark
=
Benchmark
()
benchmark
.
set_log_containers
(
log_container_per_model
)
benchmark
.
generate_tex_table
()
benchmark
.
get_average_RT_duration_per_model
()
benchmark
.
get_average_discarded_per_approach
()
if
__name__
==
"
__main__
"
:
...
...
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