From 1b20028ea3632720e20e1df52950b2f0c72eacb7 Mon Sep 17 00:00:00 2001 From: Matt Tancik Date: Mon, 6 Jun 2022 16:36:41 -0700 Subject: [PATCH] Switch from point samples to frustum samples --- notebooks/visualize_cameras.ipynb | 55 ++++++++++++++++--- pyrad/nerf/fields/base.py | 17 ++++-- pyrad/nerf/fields/nerf_field.py | 4 +- pyrad/nerf/fields/nerfw_field.py | 2 +- pyrad/nerf/graph/instant_ngp.py | 6 +-- pyrad/nerf/graph/nerfw.py | 6 +-- pyrad/nerf/graph/semantic_nerf.py | 4 +- pyrad/nerf/graph/vanilla_nerf.py | 4 +- pyrad/nerf/ray_sampler.py | 29 +++++----- pyrad/nerf/renderers.py | 9 ++-- pyrad/structures/cameras.py | 77 +++++++++++++++++++------- pyrad/structures/rays.py | 89 ++++++++++++++++++++----------- tests/nerf/test_fields.py | 11 +++- tests/nerf/test_renderers.py | 6 +-- tests/nerf/test_sampler.py | 8 +-- tests/structures/test_cameras.py | 29 +++++++++- tests/test_run_train.py | 1 + 17 files changed, 255 insertions(+), 102 deletions(-) diff --git a/notebooks/visualize_cameras.ipynb b/notebooks/visualize_cameras.ipynb index 07f09c1e8..d04cce46a 100644 --- a/notebooks/visualize_cameras.ipynb +++ b/notebooks/visualize_cameras.ipynb @@ -36,6 +36,9 @@ "\n", " ray_bundle = camera.generate_camera_rays()\n", "\n", + " print(\"Pixel Area\")\n", + " media.show_image(ray_bundle.pixel_area, width=400, cmap=\"hot\")\n", + "\n", " origins = ray_bundle.origins.view(-1, 3)\n", " directions = ray_bundle.directions.view(-1, 3)\n", " coords = coords.view(-1, 3)\n", @@ -95,6 +98,25 @@ "metadata": {}, "output_type": "display_data" }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Pixel Area\n" + ] + }, + { + "data": { + "text/html": [ + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "data": { "text/html": [ @@ -13827,9 +13849,9 @@ } }, "text/html": [ - "