This commit is contained in:
Justin Kerr committed 2022-10-29 05:20:55 -07:00
1 parent 5fef5b3be4
commit bea4f08d0a
6 files changed
+1160 -24

No files matched your search

+1109
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -114,7 +114,7 @@ class TCNNNerfactoField(Field):
self.use_semantics = use_semantics self.use_semantics = use_semantics
num_levels = 16 num_levels = 16
max_res = 1024 max_res = 2048
base_res = 16 base_res = 16
log2_hashmap_size = 19 log2_hashmap_size = 19
features_per_level = 2 features_per_level = 2
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
{"keyframes": [], "render_height": 720, "render_width": 1280, "camera_path": [{"camera_to_world": [0.42693599492361145, -0.2335212475600636, 0.8736094568951149, 0.5591163096709275, 0.904281845576138, 0.11025171703998835, -0.4124547280019327, -0.2639739801425407, -8.326672684688674e-17, 0.9660809416543348, 0.2582394512313604, 0.16527509843710225, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4306065513226966, -0.23294649819329583, 0.871903754394207, 0.5577727660870201, 0.9025397486634902, 0.1111332174416496, -0.41599177394183684, -0.2661175402119892, 6.357491869934731e-06, 0.9661186971384768, 0.2583305771410153, 0.16525879129504714, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4342651552812074, -0.23237672383565414, 0.870188474929794, 0.5564445314973131, 0.9007850879897202, 0.11201422495277268, -0.4195183145354924, -0.26826219688220787, 1.2803940081116035e-05, 0.9661541655593261, 0.25841130367818427, 0.1652418538643804, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4379118399174736, -0.2318116543593254, 0.8684635822907535, 0.5551308001652699, 0.8990179197808735, 0.11289475612487512, -0.4230343675327209, -0.2704078924373667, 1.9312266814243155e-05, 0.9661874201948074, 0.25848197252594285, 0.1652243193181868, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4415466577667737, -0.23125101914738344, 0.8667290295829195, 0.5538307663543535, 0.8972382896123233, 0.11377482774901562, -0.42653996778270226, -0.2725545691616357, 2.5856220259226068e-05, 0.9662185336216536, 0.2585429271169145, 0.16520622082955116, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4451696804684854, -0.2306945471098336, 0.8649847590236047, 0.552543624328027, 0.8954462320771439, 0.11465445685303727, -0.43003516697543703, -0.2747021693391849, 3.241037134252942e-05, 0.9662475777240137, 0.2585945123572509, 0.16518759157155832, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4487809984411119, -0.23014196669892098, 0.8632307017429565, 0.5512685683497535, 0.8936417704657094, 0.11553366069881739, -0.4335200333729665, -0.27685063525418413, 3.8950110190198706e-05, 0.9662746237015041, 0.25863707435838534, 0.16516846471729316, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4523807205462972, -0.2295930059237089, 0.8614667775917729, 0.5500047926829962, 0.8918249164562299, 0.11641245677951856, -0.43699465153120537, -0.27899990919080353, 4.545164237003649e-05, 0.9662997420766875, 0.25867096017676083, 0.1651488734398404, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4559689737429142, -0.22904739236393662, 0.8596928949553938, 0.5487514915912182, 0.8899956698159017, 0.11729086281683661, -0.4404591220132242, -0.2811499334332131, 5.1891984956417725e-05, 0.966323002701976, 0.258696517561706, 0.16512885091228488, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.459545902732282, -0.2285048531831648, 0.8579089505732519, 0.5475078593378828, 0.8881540181123037, 0.11816889675824047, -0.44391356109479174, -0.2833006502655827, 5.824896246176176e-05, 0.9663444747659505, 0.2587140947115989, 0.16510843030771147, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4631116695955316, -0.22796511514121617, 0.856114829363656, 0.5462730901864528, 0.8862999364346328, 0.11904657677419915, -0.44735810046296104, -0.2854520019720825, 6.45012026773278e-05, 0.9663642267990867, 0.25872404003843485, 0.165087644799205, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.466666453424106, -0.22742790460591955, 0.8543104042533575, 0.5450463784003916, 0.8844333871243405, 0.11992392125539084, -0.4507928869084566, -0.28760393083688235, 7.062813246692041e-05, 0.9663823266788832, 0.25872670194087927, 0.16506652755985032, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4702104499443422, -0.22689294756416556, 0.8524955360114402, 0.5438269182431622, 0.8825543195146978, 0.12080094880988929, -0.45421808201259267, -0.28975637914415225, 7.660997355650708e-05, 0.9663988416343819, 0.2587224285858668, 0.16504511176273218, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.47374387113704103, -0.22635996963228144, 0.8506700730870551, 0.5426139039782278, 0.8806626696787817, 0.12167767826032294, -0.45763386182941634, -0.29190928917806225, 8.242773836150982e-05, 0.966413838250079, 0.25871156769877707, 0.16502343058093544, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.47726694485289145, -0.22582869606573358, 0.848833851450512, 0.5414065298690515, 0.8787583601853555, 0.12255412864100139, -0.46104041656374295, -0.2940626032227824, 8.806322589485542e-05, 0.9664273824692134, 0.2586944663621943, 0.16500151718754494, 0, 0, 0, 1], "fov": 75, "aspect": 1}, {"camera_to_world": [0.4807799144245693, -0.22529885176816475, 0.8469866944372305, 0.5402039901790964, 0.8768412998620887, 0.1234303191950044, -0.4644379502457123, -0.29621626356248243, 9.349901779633234e-05, 0.9664395395964334, 0.25867147082323294, 0.16497940475564546, 0, 0, 0, 1], "fov": 75Line truncated
+46 -23
View File
@@ -676,6 +676,10 @@ class ProcessImages:
"""Path to the output directory.""" """Path to the output directory."""
camera_type: Literal["perspective", "fisheye"] = "perspective" camera_type: Literal["perspective", "fisheye"] = "perspective"
"""Camera model to use.""" """Camera model to use."""
sfm_method: Literal["colmap", "OpenSfM"] = "OpenSfM"
"""Which sfm solver to use"""
opensfm_dir: Optional[Path] = None
"""If sfm_method is OpenSfM, specify the executable to use here"""
matching_method: Literal["exhaustive", "sequential", "vocab_tree"] = "vocab_tree" matching_method: Literal["exhaustive", "sequential", "vocab_tree"] = "vocab_tree"
"""Feature matching method to use. Vocab tree is recommended for a balance of speed and """Feature matching method to use. Vocab tree is recommended for a balance of speed and
accuracy. Exhaustive is slower but more accurate. Sequential is faster but should only be used for videos.""" accuracy. Exhaustive is slower but more accurate. Sequential is faster but should only be used for videos."""
@@ -707,32 +711,51 @@ class ProcessImages:
# Downscale images # Downscale images
summary_log.append(downscale_images(image_dir, self.num_downscales, verbose=self.verbose)) summary_log.append(downscale_images(image_dir, self.num_downscales, verbose=self.verbose))
# Run COLMAP if self.sfm_method == "colmap":
colmap_dir = self.output_dir / "colmap" # Run COLMAP
if not self.skip_colmap: colmap_dir = self.output_dir / "colmap"
colmap_dir.mkdir(parents=True, exist_ok=True) if not self.skip_colmap:
colmap_dir.mkdir(parents=True, exist_ok=True)
run_colmap( run_colmap(
image_dir=image_dir, image_dir=image_dir,
colmap_dir=colmap_dir, colmap_dir=colmap_dir,
camera_model=CAMERA_MODELS[self.camera_type],
gpu=self.gpu,
verbose=self.verbose,
matching_method=self.matching_method,
)
# Save transforms.json
if (colmap_dir / "sparse" / "0" / "cameras.bin").exists():
with CONSOLE.status("[bold yellow]Saving results to transforms.json", spinner="balloon"):
num_matched_frames = colmap_to_json(
cameras_path=colmap_dir / "sparse" / "0" / "cameras.bin",
images_path=colmap_dir / "sparse" / "0" / "images.bin",
output_dir=self.output_dir,
camera_model=CAMERA_MODELS[self.camera_type], camera_model=CAMERA_MODELS[self.camera_type],
gpu=self.gpu,
verbose=self.verbose,
matching_method=self.matching_method,
)
# Save transforms.json
if (colmap_dir / "sparse" / "0" / "cameras.bin").exists():
with CONSOLE.status("[bold yellow]Saving results to transforms.json", spinner="balloon"):
num_matched_frames = colmap_to_json(
cameras_path=colmap_dir / "sparse" / "0" / "cameras.bin",
images_path=colmap_dir / "sparse" / "0" / "images.bin",
output_dir=self.output_dir,
camera_model=CAMERA_MODELS[self.camera_type],
)
summary_log.append(f"Colmap matched {num_matched_frames} images")
else:
CONSOLE.log(
"[bold yellow]Warning: could not find existing COLMAP results. Not generating transforms.json"
)
elif self.sfm_method == "OpenSfM":
assert self.opensfm_dir is not None, "Please provide the path to the OpenSfM directory <...>/bin/opensfm"
# Run the OpenSfM solver
opensfm_dir = self.output_dir / "opensfm"
opensfm_dir.mkdir(parents=True, exist_ok=True)
run_opensfm(image_dir, opensfm_dir, CAMERA_MODELS[self.camera_type], self.opensfm_dir)
# Save transforms.json
if (opensfm_dir / "reconstruction.json").exists():
with CONSOLE.status("[bold yellow]Saving results to transforms.json", spinner="balloon"):
opensfm_to_json(
opensfm_dir / "reconstruction.json", self.output_dir, CAMERA_MODELS[self.camera_type]
)
else:
CONSOLE.log(
"[bold yellow]Warning: could not find existing OpenSfM results. Not generating transforms.json"
) )
summary_log.append(f"Colmap matched {num_matched_frames} images")
else:
CONSOLE.log("[bold yellow]Warning: could not find existing COLMAP results. Not generating transforms.json")
CONSOLE.rule("[bold green]:tada: :tada: :tada: All DONE :tada: :tada: :tada:") CONSOLE.rule("[bold green]:tada: :tada: :tada: All DONE :tada: :tada: :tada:")
+3
View File
@@ -0,0 +1,3 @@
[default]
entity = luv