aburzio-nv commited on
Commit
bc5a7ef
·
verified ·
1 Parent(s): 6b8eaf4

Display network-forward throughput FPS and allow up to 300 frames

Browse files
Files changed (2) hide show
  1. README.md +2 -1
  2. src/dvlt/scripts/gradio_demo.py +5 -3
README.md CHANGED
@@ -20,6 +20,7 @@ The **Filter sky** control is enabled by default and available under Advanced.
20
  Reconstruction displays and logs **Network forward pass** time with CUDA
21
  synchronized before and after the network call. Loading, preprocessing,
22
  prediction postprocessing, sky filtering and file export are excluded.
 
23
  Visualization-only changes retain the last timing; cached examples do not
24
  run the network or display a newly measured time.
25
 
@@ -30,7 +31,7 @@ private. Visibility is a Space setting, not controlled by this README.
30
  ## Uploads and temporary results
31
 
32
  Live inference accepts JPEG, PNG or WebP images and supported video files,
33
- up to 128 images or sampled video frames, at most
34
  16 megapixels per frame. Uploads are limited to 100 MB per file at the
35
  HTTP upload boundary and 256 MiB total per submitted collection. Videos
36
  are limited to 900 decoded frames and sampled at 0.5–10 FPS.
 
20
  Reconstruction displays and logs **Network forward pass** time with CUDA
21
  synchronized before and after the network call. Loading, preprocessing,
22
  prediction postprocessing, sky filtering and file export are excluded.
23
+ Displayed throughput FPS is input frame count divided by network forward seconds.
24
  Visualization-only changes retain the last timing; cached examples do not
25
  run the network or display a newly measured time.
26
 
 
31
  ## Uploads and temporary results
32
 
33
  Live inference accepts JPEG, PNG or WebP images and supported video files,
34
+ up to 300 images or sampled video frames, at most
35
  16 megapixels per frame. Uploads are limited to 100 MB per file at the
36
  HTTP upload boundary and 256 MiB total per submitted collection. Videos
37
  are limited to 900 decoded frames and sampled at 0.5–10 FPS.
src/dvlt/scripts/gradio_demo.py CHANGED
@@ -79,7 +79,7 @@ from dvlt.viz.scene_rerun import visualize_scene
79
 
80
 
81
  logger = get_logger(__name__)
82
- HOSTED_MAX_FRAMES = 128
83
 
84
 
85
  EXTRA_CLI_ARGS = [
@@ -418,14 +418,15 @@ def build_app(
418
  return path
419
 
420
  def _invalidate_inference(state):
421
- for key in ("predictions", "batch", "pts", "rgb", "forward_seconds", "inference_model"):
422
  state.pop(key, None)
423
 
424
  def _timing_notice(state):
425
  seconds = state.get("forward_seconds")
426
  if seconds is None:
427
  return ""
428
- return f"**Network forward pass: {seconds:.3f} s** · {state['inference_model']}"
 
429
 
430
  def _model_status(label):
431
  entry = registry[label]
@@ -541,6 +542,7 @@ def build_app(
541
  with torch.no_grad(), accelerator.autocast():
542
  predictions, forward_seconds = entry.predict_timed(batch, accelerator)
543
  state["forward_seconds"] = forward_seconds
 
544
  state["inference_model"] = entry.label
545
  if os.getenv("SPACES_ZERO_GPU"):
546
  from dvlt.scripts.cache_full_examples import cpu_predictions
 
79
 
80
 
81
  logger = get_logger(__name__)
82
+ HOSTED_MAX_FRAMES = 300
83
 
84
 
85
  EXTRA_CLI_ARGS = [
 
418
  return path
419
 
420
  def _invalidate_inference(state):
421
+ for key in ("predictions", "batch", "pts", "rgb", "forward_seconds", "forward_frame_count", "inference_model"):
422
  state.pop(key, None)
423
 
424
  def _timing_notice(state):
425
  seconds = state.get("forward_seconds")
426
  if seconds is None:
427
  return ""
428
+ fps = f"{state['forward_frame_count'] / seconds:.2f} FPS" if seconds > 0 else "FPS unavailable"
429
+ return f"**Network forward pass: {seconds:.3f} s · {fps}** · {state['inference_model']}"
430
 
431
  def _model_status(label):
432
  entry = registry[label]
 
542
  with torch.no_grad(), accelerator.autocast():
543
  predictions, forward_seconds = entry.predict_timed(batch, accelerator)
544
  state["forward_seconds"] = forward_seconds
545
+ state["forward_frame_count"] = len(frames)
546
  state["inference_model"] = entry.label
547
  if os.getenv("SPACES_ZERO_GPU"):
548
  from dvlt.scripts.cache_full_examples import cpu_predictions