Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
instant-ngp-tomography
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Thomas Pickles
instant-ngp-tomography
Commits
d3c533fd
Commit
d3c533fd
authored
2 years ago
by
Thomas Pickles
Browse files
Options
Downloads
Patches
Plain Diff
Output slices from command line
Fixed bug in testbed code
parent
6a157e4f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/run.py
+10
-8
10 additions, 8 deletions
scripts/run.py
src/python_api.cu
+4
-4
4 additions, 4 deletions
src/python_api.cu
with
14 additions
and
12 deletions
scripts/run.py
+
10
−
8
View file @
d3c533fd
...
...
@@ -57,6 +57,9 @@ def parse_args():
parser
.
add_argument
(
"
--save_mesh
"
,
default
=
""
,
help
=
"
Output a marching-cubes based mesh from the NeRF or SDF model. Supports OBJ and PLY format.
"
)
parser
.
add_argument
(
"
--marching_cubes_res
"
,
default
=
256
,
type
=
int
,
help
=
"
Sets the resolution for the marching cubes grid.
"
)
parser
.
add_argument
(
"
--save_slices
"
,
action
=
"
store_true
"
,
help
=
"
Output slices after training.
"
)
parser
.
add_argument
(
"
--slices_res
"
,
default
=
256
,
type
=
int
,
help
=
"
Sets the resolution for the slices png.
"
)
parser
.
add_argument
(
"
--width
"
,
"
--screenshot_w
"
,
type
=
int
,
default
=
0
,
help
=
"
Resolution width of GUI and screenshots.
"
)
parser
.
add_argument
(
"
--height
"
,
"
--screenshot_h
"
,
type
=
int
,
default
=
0
,
help
=
"
Resolution height of GUI and screenshots.
"
)
...
...
@@ -69,7 +72,7 @@ def parse_args():
parser
.
add_argument
(
"
--sharpen
"
,
default
=
0
,
help
=
"
Set amount of sharpening applied to NeRF training images. Range 0.0 to 1.0.
"
)
# parser.add_argument("--tomonerf", action="store_true", help="Apply tomography specific parameters to optimise NeRF output.")
parser
.
add_argument
(
"
--tomonerf
"
,
type
=
str
,
help
=
"
Which transforms to apply [single_channel, exponentiate img data, crop].
"
)
parser
.
add_argument
(
"
--tomonerf
"
,
type
=
int
,
default
=
0
,
help
=
"
Which transforms to apply [single_channel, exponentiate img data, crop].
"
)
parser
.
add_argument
(
"
--crop
"
,
nargs
=
3
,
type
=
float
,
help
=
"
Percentage to crop unit cube to.
"
)
return
parser
.
parse_args
()
...
...
@@ -128,13 +131,6 @@ if __name__ == "__main__":
if
args
.
tomonerf
:
print
(
"
***Entering NERF for Tomography mode***
"
)
print
(
f
"
Saving density slices (no crop)
"
)
# vertical slices
fname
=
"
string
"
# FIXME - doesn't work from command line yet
# testbed.compute_and_save_png_slices()
# testbed.compute_and_save_png_slices_vert()
# testbed.compute_and_save_png_slices('horiz', flip_y_and_z_axes=True)
if
(
format
(
args
.
tomonerf
,
'
b
'
)[
-
1
]
==
'
1
'
):
print
(
"
TODO: Single channel mode
"
)
...
...
@@ -259,6 +255,12 @@ if __name__ == "__main__":
if
args
.
save_snapshot
:
testbed
.
save_snapshot
(
args
.
save_snapshot
,
False
)
if
args
.
save_slices
:
res
=
args
.
slices_res
or
256
# does this work here?
testbed
.
compute_and_save_png_slices
(
"
slices_h
"
,
res
)
testbed
.
compute_and_save_png_slices_vert
(
"
slices_v
"
,
res
)
if
args
.
test_transforms
:
print
(
"
Evaluating test transforms from
"
,
args
.
test_transforms
)
with
open
(
args
.
test_transforms
)
as
f
:
...
...
This diff is collapsed.
Click to expand it.
src/python_api.cu
+
4
−
4
View file @
d3c533fd
...
...
@@ -421,8 +421,8 @@ PYBIND11_MODULE(pyngp, m) {
.
def
(
"load_file"
,
&
Testbed
::
load_file
,
py
::
arg
(
"path"
),
"Load a file and automatically determine how to handle it. Can be a snapshot, dataset, network config, or camera path."
)
.
def_property
(
"loop_animation"
,
&
Testbed
::
loop_animation
,
&
Testbed
::
set_loop_animation
)
.
def
(
"compute_and_save_png_slices"
,
&
Testbed
::
compute_and_save_png_slices
,
py
::
arg
(
"filename"
)
=
"horiz"
,
py
::
arg
(
"resolution"
)
=
Eigen
::
Vector3i
::
Constant
(
256
)
,
py
::
arg
(
"filename"
),
py
::
arg
(
"resolution"
)
=
256
,
py
::
arg
(
"aabb"
)
=
BoundingBox
{},
py
::
arg
(
"thresh"
)
=
std
::
numeric_limits
<
float
>::
max
(),
py
::
arg
(
"density_range"
)
=
4.
f
,
...
...
@@ -430,8 +430,8 @@ PYBIND11_MODULE(pyngp, m) {
"Compute & save a PNG file representing the 3D density or distance field from the current SDF or NeRF model. "
)
.
def
(
"compute_and_save_png_slices_vert"
,
&
Testbed
::
compute_and_save_png_slices
,
py
::
arg
(
"filename"
)
=
"vert"
,
py
::
arg
(
"resolution"
)
=
Eigen
::
Vector3i
::
Constant
(
256
)
,
py
::
arg
(
"filename"
),
py
::
arg
(
"resolution"
)
=
256
,
py
::
arg
(
"aabb"
)
=
BoundingBox
{},
py
::
arg
(
"thresh"
)
=
std
::
numeric_limits
<
float
>::
max
(),
py
::
arg
(
"density_range"
)
=
4.
f
,
...
...
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