MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / get_vis_data

Function get_vis_data

PATH/helper/vis_helper.py:20–34  ·  view source on GitHub ↗
(input, range_low=-1, range_high=1, vis_height=-1, vis_width=-1, to_rgb=True)

Source from the content-addressed store, hash-verified

18
19
20def get_vis_data(input, range_low=-1, range_high=1, vis_height=-1, vis_width=-1, to_rgb=True):
21 if input is None:
22 return None
23
24 data = ((input.permute(1, 2, 0) - range_low) / (
25 range_high - range_low) * 255.0).data.cpu().numpy()
26 if vis_height > 0 and vis_width > 0:
27 if data.shape[0] != vis_height or data.shape[1] != vis_width:
28 data = cv2.resize(data, (vis_width, vis_height))
29 if len(data.shape) == 2:
30 data = cv2.cvtColor(data, cv2.COLOR_GRAY2RGB)
31 else:
32 if to_rgb:
33 data = cv2.cvtColor(data, cv2.COLOR_BGR2RGB)
34 return data
35
36
37def vis_one_from_batch(vis_list, range_low=0, range_high=1,

Callers 1

vis_one_from_batchFunction · 0.85

Calls 2

permuteMethod · 0.80
resizeMethod · 0.80

Tested by

no test coverage detected