Documenting viewer and faster image sending (#86)

* updated three.js version. only send camera information when it moves

* changing code back to updating camera constantly because packets seem to be lost

* name change

* starting viewer docs

* new workflow

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* ga

* homepage

* homepage

* / to ?

* more documentation

* fixed none error

* instant ngp fix

* faster image sending over tcp. instant ngp bin fix. lowest res when moving

* black

* requirements
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-07-07 00:03:45 -07:00
1 parent d0f0f8da2d
commit 44c5e3264c
28 files changed
+28943 -609

No files matched your search

+19 -37
View File
@@ -52,7 +52,7 @@
"from pyrad.utils.config import Config, setup_config\n",
"\n",
"# the new import\n",
"from pyrad.viewer.backend import vis_utils\n",
"from pyrad.viewer.server import vis_utils\n",
"\n",
"\n",
"from hydra import compose, initialize\n",
@@ -61,8 +61,12 @@
"from tqdm import tqdm\n",
"import random\n",
"\n",
"import numpy as np\n",
"\n",
"import umsgpack\n",
"from pyrad.viewer.backend.utils import get_chunks, get_intrinsics_matrix_and_camera_to_world_h"
"from pyrad.viewer.server.utils import get_chunks, get_intrinsics_matrix_and_camera_to_world_h\n",
"\n",
"from pyrad.viewer.server.visualizer import Viewer"
]
},
{
@@ -78,7 +82,7 @@
" overrides=[\n",
" \"trainer.resume_train.load_dir=/shared/ethanweber/pyrad/outputs/blender_lego/instant_ngp/2022-07-05_200513/checkpoints\",\n",
" \"trainer.resume_train.load_step=5000\",\n",
" \"viewer.render_image_height=50\",\n",
" # \"viewer.render_image_height=50\"\n",
" ],\n",
" )\n",
" config = setup_config(config)"
@@ -87,21 +91,11 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "5d231e36-dd38-489b-a3a3-860cdf49e551",
"id": "26d6da3c-e28a-4c55-9592-d90dccb86051",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-07-05 23:33:06.262342: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n"
]
}
],
"outputs": [],
"source": [
"trainer = Trainer(config, local_rank=0, world_size=1)\n",
"trainer.setup()\n",
"trainer.draw_scene_in_viewer()"
"vis = Viewer(zmq_url=\"tcp://127.0.0.1:6000\")"
]
},
{
@@ -127,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 9,
"id": "fd04703a-aa50-45e4-95fd-4d881ff18d61",
"metadata": {},
"outputs": [
@@ -136,7 +130,7 @@
"output_type": "stream",
"text": [
"estimated_time: 3.3333333333333335\n",
"time_elapsed: 14.046947002410889\n"
"time_elapsed: 3.510408878326416\n"
]
}
],
@@ -159,10 +153,10 @@
"\n",
"start = time.time()\n",
"for camera in cameras:\n",
" vis_utils.set_camera(trainer.vis, camera)\n",
" vis_utils.set_camera(vis, camera)\n",
"\n",
" # render an image\n",
" outputs = trainer.render_image_in_viewer()\n",
" # outputs = trainer.render_image_in_viewer()\n",
"\n",
" time.sleep(1 / fps)\n",
" # break\n",
@@ -170,28 +164,21 @@
"print(\"time_elapsed:\", time_elapsed)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "fbb89f42-bf37-4786-a865-64c4ef018005",
"metadata": {},
"outputs": [],
"source": [
"outputs = trainer.render_image_in_viewer()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d91dfa73-ba0c-4412-a908-74ea51c37c58",
"id": "0d937035-563c-412e-95ff-750ae54a42be",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "4a749acc7d255f078aee52e0584cc77b3cb5aaed1b3a7407ec4262c1bf6cb526"
},
"kernelspec": {
"display_name": "Python 3.8.13 ('mattport')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -206,11 +193,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
},
"vscode": {
"interpreter": {
"hash": "f0938bb18d5c7de3ca7c6a73cb6be5f9b7603b44d115fc3e0726e01396d4d2be"
}
}
},
"nbformat": 4,