MCPcopy Create free account
hub / github.com/NVIDIA/DALI / resize_PIL

Function resize_PIL

dali/test/python/operator_2/test_resize_seq.py:78–95  ·  view source on GitHub ↗
(channel_first, interp, w, h)

Source from the content-addressed store, hash-verified

76
77
78def resize_PIL(channel_first, interp, w, h):
79 pil_resample = resample_dali2pil[interp]
80
81 def resize(input):
82 num_frames = input.shape[0]
83 out_seq = []
84 for i in range(num_frames):
85 frame = input[i]
86 if channel_first:
87 frame = frame.transpose([1, 2, 0])
88 out_frame = PIL.Image.fromarray(frame).resize([w, h], resample=pil_resample)
89 out_frame = np.array(out_frame)
90 if channel_first:
91 out_frame = out_frame.transpose([2, 0, 1])
92 out_seq.append(out_frame)
93 return np.array(out_seq)
94
95 return resize
96
97
98def create_ref_pipe(channel_first, seq_len, interp, dtype, w, h, batch_size=2):

Callers 1

create_ref_pipeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected