MCPcopy Create free account
hub / github.com/drinkingcoder/NeuralMarker / get_colormap

Function get_colormap

colormap.py:76–83  ·  view source on GitHub ↗
(flow, H, W)

Source from the content-addressed store, hash-verified

74 return colors # (1, P, 3)
75
76def 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

Callers 2

blend_pdcFunction · 0.90
blend_lifeFunction · 0.90

Calls 1

get_plotly_colorsFunction · 0.85

Tested by

no test coverage detected