(flow, H, W)
| 74 | return colors # (1, P, 3) |
| 75 | |
| 76 | def get_colormap(flow, H, W): |
| 77 | points = flow.permute(0, 2, 3, 1) |
| 78 | points = points.reshape(points.size(0), points.size(1) * points.size(2), 2) # (N, K*P, 2) |
| 79 | num_points = points.size(1) |
| 80 | colorscale = ['plasma'] |
| 81 | colors = torch.cat([get_plotly_colors(num_points, c) for c in colorscale], 1) # (1, K*P, 3) |
| 82 | colors = colors.reshape(H, W, 3).cpu().numpy() * 255 |
| 83 | return colors |
no test coverage detected