Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pinard Clement
drone-depth-validation-set
Commits
4368bfa3
Commit
4368bfa3
authored
Oct 17, 2020
by
Clément Pinard
Browse files
handle indoor case
* To do : use flight data to deduce model scale
parent
181d8fe7
Changes
5
Hide whitespace changes
Inline
Side-by-side
cli_utils.py
View file @
4368bfa3
...
@@ -54,6 +54,7 @@ def set_argparser():
...
@@ -54,6 +54,7 @@ def set_argparser():
exec_parser
.
add_argument
(
"--pcl_util"
,
default
=
"pcl_util/build"
,
type
=
Path
)
exec_parser
.
add_argument
(
"--pcl_util"
,
default
=
"pcl_util/build"
,
type
=
Path
)
pm_parser
=
parser
.
add_argument_group
(
"Photogrammetry"
)
pm_parser
=
parser
.
add_argument_group
(
"Photogrammetry"
)
pm_parser
.
add_argument
(
'--max_num_matches'
,
default
=
32768
,
type
=
int
,
help
=
"max number of matches, lower it if you get GPU memory error"
)
pm_parser
.
add_argument
(
'--vocab_tree'
,
type
=
Path
,
default
=
"vocab_tree_flickr100K_words256K.bin"
)
pm_parser
.
add_argument
(
'--vocab_tree'
,
type
=
Path
,
default
=
"vocab_tree_flickr100K_words256K.bin"
)
pm_parser
.
add_argument
(
'--triangulate'
,
action
=
"store_true"
)
pm_parser
.
add_argument
(
'--triangulate'
,
action
=
"store_true"
)
pm_parser
.
add_argument
(
'--multiple_models'
,
action
=
'store_true'
,
help
=
'If selected, will let colmap mapper do multiple models.'
pm_parser
.
add_argument
(
'--multiple_models'
,
action
=
'store_true'
,
help
=
'If selected, will let colmap mapper do multiple models.'
...
...
main_pipeline.py
View file @
4368bfa3
...
@@ -73,6 +73,8 @@ def main():
...
@@ -73,6 +73,8 @@ def main():
no_gt_folder
=
args
.
input_folder
/
"Videos"
/
"no_groundtruth"
no_gt_folder
=
args
.
input_folder
/
"Videos"
/
"no_groundtruth"
if
no_gt_folder
.
isdir
():
if
no_gt_folder
.
isdir
():
env
[
"videos_to_localize"
]
=
[
v
for
v
in
env
[
"videos_list"
]
if
not
str
(
v
).
startswith
(
no_gt_folder
)]
env
[
"videos_to_localize"
]
=
[
v
for
v
in
env
[
"videos_list"
]
if
not
str
(
v
).
startswith
(
no_gt_folder
)]
else
:
env
[
"videos_to_localize"
]
=
env
[
"videos_list"
]
i
=
1
i
=
1
if
i
not
in
args
.
skip_step
:
if
i
not
in
args
.
skip_step
:
...
@@ -114,7 +116,7 @@ def main():
...
@@ -114,7 +116,7 @@ def main():
env
[
"thorough_recon"
].
makedirs_p
()
env
[
"thorough_recon"
].
makedirs_p
()
colmap
.
extract_features
(
image_list
=
env
[
"video_frame_list_thorough"
],
more
=
args
.
more_sift_features
)
colmap
.
extract_features
(
image_list
=
env
[
"video_frame_list_thorough"
],
more
=
args
.
more_sift_features
)
colmap
.
index_images
(
vocab_tree_output
=
env
[
"indexed_vocab_tree"
],
vocab_tree_input
=
args
.
vocab_tree
)
colmap
.
index_images
(
vocab_tree_output
=
env
[
"indexed_vocab_tree"
],
vocab_tree_input
=
args
.
vocab_tree
)
colmap
.
match
(
method
=
"vocab_tree"
,
vocab_tree
=
env
[
"indexed_vocab_tree"
])
colmap
.
match
(
method
=
"vocab_tree"
,
vocab_tree
=
env
[
"indexed_vocab_tree"
]
,
max_num_matches
=
env
[
"max_num_matches"
]
)
colmap
.
map
(
output
=
env
[
"thorough_recon"
],
multiple_models
=
env
[
"multiple_models"
])
colmap
.
map
(
output
=
env
[
"thorough_recon"
],
multiple_models
=
env
[
"multiple_models"
])
thorough_model
=
pi
.
choose_biggest_model
(
env
[
"thorough_recon"
])
thorough_model
=
pi
.
choose_biggest_model
(
env
[
"thorough_recon"
])
colmap
.
adjust_bundle
(
thorough_model
,
thorough_model
,
colmap
.
adjust_bundle
(
thorough_model
,
thorough_model
,
...
@@ -132,7 +134,7 @@ def main():
...
@@ -132,7 +134,7 @@ def main():
if
not
(
env
[
"georef_frames_list"
]
/
"images.bin"
).
isfile
():
if
not
(
env
[
"georef_frames_list"
]
/
"images.bin"
).
isfile
():
# GPS alignment failed, possibly because not enough GPS referenced images
# GPS alignment failed, possibly because not enough GPS referenced images
# Copy the original model without alignment
# Copy the original model without alignment
(
env
[
"thorough_recon"
]
/
"0"
).
merge_tree
(
env
[
"georef_
full_
recon"
])
(
env
[
"thorough_recon"
]
/
"0"
).
merge_tree
(
env
[
"georef_recon"
])
env
[
"georef_recon"
].
merge_tree
(
env
[
"georef_full_recon"
])
env
[
"georef_recon"
].
merge_tree
(
env
[
"georef_full_recon"
])
if
args
.
inspect_dataset
:
if
args
.
inspect_dataset
:
colmap
.
export_model
(
output
=
env
[
"georef_recon"
]
/
"georef_sparse.ply"
,
colmap
.
export_model
(
output
=
env
[
"georef_recon"
]
/
"georef_sparse.ply"
,
...
...
main_pipeline_no_lidar.py
View file @
4368bfa3
...
@@ -72,7 +72,7 @@ def main():
...
@@ -72,7 +72,7 @@ def main():
env
[
"thorough_recon"
].
makedirs_p
()
env
[
"thorough_recon"
].
makedirs_p
()
colmap
.
extract_features
(
image_list
=
env
[
"video_frame_list_thorough"
],
more
=
args
.
more_sift_features
)
colmap
.
extract_features
(
image_list
=
env
[
"video_frame_list_thorough"
],
more
=
args
.
more_sift_features
)
colmap
.
index_images
(
vocab_tree_output
=
env
[
"indexed_vocab_tree"
],
vocab_tree_input
=
args
.
vocab_tree
)
colmap
.
index_images
(
vocab_tree_output
=
env
[
"indexed_vocab_tree"
],
vocab_tree_input
=
args
.
vocab_tree
)
colmap
.
match
(
method
=
"vocab_tree"
,
vocab_tree
=
env
[
"indexed_vocab_tree"
])
colmap
.
match
(
method
=
"vocab_tree"
,
vocab_tree
=
env
[
"indexed_vocab_tree"
]
,
max_num_matches
=
env
[
"max_num_matches"
]
)
colmap
.
map
(
output
=
env
[
"thorough_recon"
],
multiple_models
=
env
[
"multiple_models"
])
colmap
.
map
(
output
=
env
[
"thorough_recon"
],
multiple_models
=
env
[
"multiple_models"
])
thorough_model
=
pi
.
choose_biggest_model
(
env
[
"thorough_recon"
])
thorough_model
=
pi
.
choose_biggest_model
(
env
[
"thorough_recon"
])
colmap
.
adjust_bundle
(
thorough_model
,
thorough_model
,
colmap
.
adjust_bundle
(
thorough_model
,
thorough_model
,
...
@@ -90,7 +90,7 @@ def main():
...
@@ -90,7 +90,7 @@ def main():
if
not
(
env
[
"georef_frames_list"
]
/
"images.bin"
).
isfile
():
if
not
(
env
[
"georef_frames_list"
]
/
"images.bin"
).
isfile
():
# GPS alignment failed, possibly because not enough GPS referenced images
# GPS alignment failed, possibly because not enough GPS referenced images
# Copy the original model without alignment
# Copy the original model without alignment
(
env
[
"thorough_recon"
]
/
"0"
).
merge_tree
(
env
[
"georef_
full_
recon"
])
(
env
[
"thorough_recon"
]
/
"0"
).
merge_tree
(
env
[
"georef_recon"
])
env
[
"georef_recon"
].
merge_tree
(
env
[
"georef_full_recon"
])
env
[
"georef_recon"
].
merge_tree
(
env
[
"georef_full_recon"
])
if
args
.
inspect_dataset
:
if
args
.
inspect_dataset
:
colmap
.
export_model
(
output
=
env
[
"georef_recon"
]
/
"georef_sparse.ply"
,
colmap
.
export_model
(
output
=
env
[
"georef_recon"
]
/
"georef_sparse.ply"
,
...
...
video_localization.py
View file @
4368bfa3
...
@@ -19,12 +19,12 @@ def is_video_in_model(video_name, colmap_model, metadata):
...
@@ -19,12 +19,12 @@ def is_video_in_model(video_name, colmap_model, metadata):
return
sum
(
video_image_ids
.
isin
(
mapped_images_ids
))
>
0
return
sum
(
video_image_ids
.
isin
(
mapped_images_ids
))
>
0
def
sift_and_match
(
colmap
,
more_sift_features
,
indexed_vocab_tree
,
image_list
,
**
env
):
def
sift_and_match
(
colmap
,
more_sift_features
,
indexed_vocab_tree
,
image_list
,
max_num_matches
,
**
env
):
tries
=
0
tries
=
0
while
tries
<
10
:
while
tries
<
10
:
try
:
try
:
colmap
.
extract_features
(
image_list
=
image_list
,
more
=
more_sift_features
)
colmap
.
extract_features
(
image_list
=
image_list
,
more
=
more_sift_features
)
colmap
.
match
(
method
=
"sequential"
,
vocab_tree
=
indexed_vocab_tree
)
colmap
.
match
(
method
=
"sequential"
,
vocab_tree
=
indexed_vocab_tree
,
max_num_matches
=
max_num_matches
)
except
Exception
:
except
Exception
:
# If it failed, that's because sift gpu has failed.
# If it failed, that's because sift gpu has failed.
print
(
"Error With colmap, will retry"
)
print
(
"Error With colmap, will retry"
)
...
...
wrappers/colmap.py
View file @
4368bfa3
...
@@ -29,10 +29,11 @@ class Colmap(Wrapper):
...
@@ -29,10 +29,11 @@ class Colmap(Wrapper):
pass
pass
self
.
__call__
(
options
)
self
.
__call__
(
options
)
def
match
(
self
,
method
=
"exhaustive"
,
guided_matching
=
True
,
vocab_tree
=
None
):
def
match
(
self
,
method
=
"exhaustive"
,
guided_matching
=
True
,
vocab_tree
=
None
,
max_num_matches
=
32768
):
options
=
[
"{}_matcher"
.
format
(
method
),
options
=
[
"{}_matcher"
.
format
(
method
),
"--database_path"
,
self
.
db
,
"--database_path"
,
self
.
db
,
"--SiftMatching.guided_matching"
,
"1"
if
guided_matching
else
"0"
]
"--SiftMatching.guided_matching"
,
"1"
if
guided_matching
else
"0"
,
"--SiftMatching.max_num_matches"
,
str
(
max_num_matches
)]
if
method
==
"sequential"
:
if
method
==
"sequential"
:
assert
vocab_tree
is
not
None
assert
vocab_tree
is
not
None
options
+=
[
"--SequentialMatching.loop_detection"
,
"1"
,
options
+=
[
"--SequentialMatching.loop_detection"
,
"1"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment