MCPcopy Create free account
hub / github.com/dcharatan/flowmap / render_flows

Function render_flows

paper/render_point_cloud.py:454–468  ·  view source on GitHub ↗
(device: torch.device, birds: LoadedScene)

Source from the content-addressed store, hash-verified

452
453
454def render_flows(device: torch.device, birds: LoadedScene) -> None:
455 # We just want the flow between images 0 and 4.
456 raft = FlowPredictorRaft(FlowPredictorRaftCfg("raft", 32, 8)).to(device)
457 flow = raft.forward(
458 birds.exports.colors[0, :1],
459 birds.exports.colors[0, SECOND_FRAME : SECOND_FRAME + 1],
460 )
461 images = flow_to_color(rearrange(flow, "b h w xy -> b xy h w")) / 255
462 save_image(images[0], "figures/flow_0_to_4.png")
463
464 # Render a little legend thing
465 x = torch.linspace(-1, 1, 256, device=flow.device)
466 y = torch.linspace(-1, 1, 256, device=flow.device)
467 key = torch.stack(torch.meshgrid((x, y), indexing="xy"), dim=0)
468 save_image(flow_to_color(key) / 255, "figures/flow_key.png")
469
470
471def render_joint_point_cloud(

Callers

nothing calls this directly

Calls 5

FlowPredictorRaftClass · 0.90
save_imageFunction · 0.90
toMethod · 0.45
forwardMethod · 0.45

Tested by

no test coverage detected