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
84dfcf9c
Commit
84dfcf9c
authored
4 years ago
by
gospodnetic
Browse files
Options
Downloads
Patches
Plain Diff
Handle directories in ovp file list, output complete tex table
parent
11a3dd27
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
+29
-1
29 additions, 1 deletion
Benchmark.py
Log.py
+7
-2
7 additions, 2 deletions
Log.py
ovp_paths.json
+4
-9
4 additions, 9 deletions
ovp_paths.json
vob.py
+26
-6
26 additions, 6 deletions
vob.py
with
66 additions
and
18 deletions
Benchmark.py
+
29
−
1
View file @
84dfcf9c
...
...
@@ -23,7 +23,7 @@ class Benchmark:
else
:
self
.
methods_per_approach
[
approach
]
=
[
method
]
def
generate_tex_table
(
self
):
def
generate_
performance_
tex_table
(
self
):
tex_file
=
open
(
"
performance_table.tex
"
,
"
w
"
)
tex_file
.
write
(
"
\n\\
begin{table*}
\n
"
)
...
...
@@ -77,6 +77,34 @@ class Benchmark:
tex_file
.
write
(
"
\n\\
end{table*}
\n
"
)
tex_file
.
close
()
# \usepackage{longtable} needed.
def
generate_complete_tex_table
(
self
):
tex_file
=
open
(
"
complete_table.tex
"
,
"
w
"
)
for
model
in
self
.
log_container_per_model
:
tex_file
.
write
(
"
\n\\
begin{longtable}{|c c c c c c c c|}
\n
"
)
tex_file
.
write
(
"
\\
hline
\n
"
)
first_log
=
self
.
log_container_per_model
[
model
].
logs
[
0
]
tex_file
.
write
(
"
\\
multicolumn{{8}}{{|c|}}{{{} ({})}}
\\\\\n
"
.
format
(
model
,
first_log
.
model
[
"
face_count
"
]))
tex_file
.
write
(
"
Method & Parameter &
\\
#VPC &
\\
#Discarded &
\\
#OVP & RT[S] & NBV[s] & coverage
\\\\\n
"
)
for
approach
in
self
.
methods_per_approach
:
logs_per_approach
=
self
.
log_container_per_model
[
model
].
get_logs_by_approach
(
approach
)
if
len
(
logs_per_approach
)
==
0
:
continue
for
log
in
logs_per_approach
:
tex_file
.
write
(
"
{} & {} & {} & {} & {} & {} & {} & {}
\\\\\n
"
.
format
(
log
.
VPC
[
"
method
"
],
log
.
VPC
[
"
generation_parameter
"
],
log
.
VPC
[
"
count
"
]
+
log
.
VPC
[
"
discarded_count
"
],
log
.
VPC
[
"
discarded_count
"
],
len
(
log
.
optimization
[
"
OVP
"
]),
util
.
set_precision
(
log
.
timing
[
"
visibility_matrix_sec
"
],
2
),
util
.
set_precision
(
log
.
timing
[
"
optimization_sec
"
],
2
),
util
.
set_precision
(
log
.
coverage
[
"
percent_fraction
"
],
2
)))
tex_file
.
write
(
"
\\
hline
\n
"
)
tex_file
.
write
(
"
\\
end{longtable}
\n
"
)
# Average ray tracing duration.
def
get_average_RT_duration_per_model
(
self
):
avgs
=
{}
...
...
This diff is collapsed.
Click to expand it.
Log.py
+
7
−
2
View file @
84dfcf9c
...
...
@@ -5,6 +5,7 @@ import sys
class
Log
:
def
__init__
(
self
,
log_filename
):
self
.
filename
=
""
self
.
camera_parameters
=
{
"
focusing_distance_mm
"
:
0
,
"
focal_length
"
:
0
,
...
...
@@ -108,9 +109,10 @@ class Log:
try
:
self
.
__check_file_structure
(
log_data
)
except
Exception
as
e
:
print
(
"
Error: {}
"
.
format
(
e
))
#
print("Error: {}".format(e))
raise
Exception
(
"
File {} invalid OVP file
"
.
format
(
log_filename
))
self
.
filename
=
log_filename
self
.
camera_parameters
[
"
focusing_distance_mm
"
]
=
log_data
[
"
Log
"
][
"
Camera
"
][
"
DistanceMM
"
]
self
.
camera_parameters
[
"
focal_length
"
]
=
log_data
[
"
Log
"
][
"
Camera
"
][
"
FocalLength
"
]
self
.
camera_parameters
[
"
model
"
]
=
log_data
[
"
Log
"
][
"
Camera
"
][
"
Model
"
]
...
...
@@ -242,7 +244,10 @@ class Log:
def
get_discarded_quotient
(
self
):
total_VPC
=
self
.
VPC
[
"
count
"
]
+
self
.
VPC
[
"
discarded_count
"
]
return
self
.
VPC
[
"
discarded_count
"
]
/
total_VPC
if
total_VPC
==
0
:
return
1
else
:
return
self
.
VPC
[
"
discarded_count
"
]
/
total_VPC
# Utilities
def
convert_cumulative
(
self
,
value_array
):
...
...
This diff is collapsed.
Click to expand it.
ovp_paths.json
+
4
−
9
View file @
84dfcf9c
[
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/Dennis_VPCs-OVP_no_filtering/2020-04-30_Dennis_VPC_optimization/MissingHirthAndTimeShaft_OVPs/gear--0.5f--OVP--ThinPlate--0.994921_coverage_2020-05-16_03-17-40_VPC_dist10_ThinPlate_th0.5f_log.json"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/Dennis_VPCs-OVP_no_filtering/2020-04-30_Dennis_VPC_optimization/MissingHirthAndTimeShaft_OVPs/gear--0.25f--OVP--ThinPlate--0.992063_coverage_2020-05-16_04-31-59_VPC_dist10_ThinPlate_th0.25f_log.json"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/Dennis_VPCs-OVP_no_filtering/2020-04-30_Dennis_VPC_optimization/MissingHirthAndTimeShaft_OVPs/gear--0.75f--OVP--ThinPlate--0.990636_coverage_2020-05-16_06-52-30_VPC_dist10_ThinPlate_th0.75f_log.json"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/Dennis_VPCs-OVP_no_filtering/2020-04-30_Dennis_VPC_optimization/MissingHirthAndTimeShaft_OVPs/gear--1f--OVP--ThinPlate--0.988589_coverage_2020-05-16_07-43-20_VPC_dist10_ThinPlate_th1f_log.json"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/Dennis_VPCs-OVP_no_filtering/2020-04-30_Dennis_VPC_optimization/MissingHirthAndTimeShaft_OVPs/gear--30a--OVP--NormalDev--0.995471_coverage_2020-05-15_13-35-19_VPC_dist10_NormalDev_th30a_log.json"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/Dennis_VPCs-OVP_no_filtering/2020-04-30_Dennis_VPC_optimization/MissingHirthAndTimeShaft_OVPs/gear--45a--OVP--NormalDev--0.990657_coverage_2020-05-15_21-14-54_VPC_dist10_NormalDev_th45a_log.json"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/Dennis_VPCs-OVP_no_filtering/2020-04-30_Dennis_VPC_optimization/MissingHirthAndTimeShaft_OVPs/gear--60a--OVP--NormalDev--0.994068_coverage_2020-05-16_01-00-40_VPC_dist10_NormalDev_th60a_log.json"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/Dennis_VPCs-OVP_no_filtering/2020-04-30_Dennis_VPC_optimization/MissingHirthAndTimeShaft_OVPs/gear--90a--OVP--NormalDev--0.982161_coverage_2020-05-16_02-51-49_VPC_dist10_NormalDev_th90a_log.json"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/Dennis_VPCs-OVP_no_filtering/2020-04-30_Dennis_VPC_optimization/MissingHirthAndTimeShaft_OVPs/gear--10000f--OVP--ThinPlate--0.951490_coverage_2020-05-16_08-18-28_VPC_dist10_ThinPlate_th10000f_log.json"
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/WithFiltering/face_shield"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/WithFiltering/cumulative_opt_results2.txt"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/WithFiltering/gear--10--OVP--UniformSphere--0.000000_coverage_2020-04-25_01-27-59_gear--sphere-centroid--VPC--10_generated_positions_2020-04-24_21-27-21_log.json"
,
"/home/pastrva/Projects/VirtualImageProcessing/Fileserver/Papers/2020_Generate_and_Test_Comparison/Results/WithFiltering/gear--10--OVP--UniformSphereAvgBbox--0.065327_coverage_2020-04-27_20-17-18_gear--sphere_avg_bbox-centroid--VPC--10_generated_positions_2020-04-27_17-15-45_log.json"
]
This diff is collapsed.
Click to expand it.
vob.py
+
26
−
6
View file @
84dfcf9c
...
...
@@ -4,9 +4,25 @@ from Log import Log
from
LogContainer
import
LogContainer
from
Vis
import
Vis
import
os
import
pathlib
import
sys
import
json
def
filter_json
(
filenames
):
return
list
(
filter
(
lambda
x
:
pathlib
.
Path
(
x
).
suffix
==
'
.json
'
,
filenames
))
def
extract_json_filenames
(
json_list
):
ovp_filenames
=
[]
for
path
in
json_list
:
if
os
.
path
.
isdir
(
path
):
for
(
dirpath
,
dirnames
,
filenames
)
in
os
.
walk
(
path
):
ovp_filenames
.
extend
(
list
(
map
(
lambda
x
:
dirpath
+
"
/
"
+
x
,
filenames
)))
break
else
:
ovp_filenames
.
append
(
path
)
return
filter_json
(
ovp_filenames
)
def
main
():
if
len
(
sys
.
argv
)
>
2
:
methods_per_approach_filename
=
sys
.
argv
[
1
]
...
...
@@ -23,26 +39,29 @@ def main():
with
open
(
methods_per_approach_filename
)
as
methods_per_approach_file
:
methods_per_approach
=
json
.
load
(
methods_per_approach_file
)
filenames
=
extract_json_filenames
(
ovp_paths
)
# Load log files and sort them per model.
log_container_per_model
=
{}
logs
=
[]
for
filename
in
ovp_paths
:
log
=
Log
(
filename
)
for
idx
,
filename
in
enumerate
(
filenames
)
:
print
(
"
Loading file {}/{}
"
.
format
(
idx
+
1
,
len
(
filenames
)),
end
=
"
\r
"
)
try
:
log
=
Log
(
filename
)
logs
.
append
(
log
)
except
Exception
as
e
:
print
(
"
Error: {}
\n
Skipping file
"
.
format
(
e
))
# TODO add verbose
# print("Error: {}\nSkipping file".format(e))
continue
model_name
=
log
.
model
[
"
name
"
]
if
model_name
not
in
log_container_per_model
:
print
(
model_name
)
log_container_per_model
[
model_name
]
=
LogContainer
(
methods_per_approach
)
try
:
log_container_per_model
[
model_name
].
add_log
(
log
)
except
Exception
as
e
:
print
(
"
Error: {}
\n
Skipping file
"
.
format
(
e
))
#
print("Error: {}\nSkipping file".format(e))
continue
print
(
"
Loaded {} log files.
"
.
format
(
len
(
logs
)))
...
...
@@ -58,7 +77,8 @@ def main():
benchmark
=
Benchmark
()
benchmark
.
set_log_containers
(
log_container_per_model
)
benchmark
.
generate_tex_table
()
benchmark
.
generate_performance_tex_table
()
benchmark
.
generate_complete_tex_table
()
benchmark
.
get_average_RT_duration_per_model
()
benchmark
.
get_average_discarded_per_approach
()
benchmark
.
get_average_discarded_per_model
()
...
...
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