(channel_first, seq_len, interp, dtype, w, h, batch_size=2)
| 96 | |
| 97 | |
| 98 | def create_ref_pipe(channel_first, seq_len, interp, dtype, w, h, batch_size=2): |
| 99 | pipe = dali.pipeline.Pipeline(batch_size, 1, 0, 0, exec_async=False, exec_pipelined=False) |
| 100 | with pipe: |
| 101 | layout = "FCHW" if channel_first else "FHWC" |
| 102 | ext = fn.external_source(GetSequences(channel_first, seq_len, batch_size), layout=layout) |
| 103 | pil_resized = fn.python_function( |
| 104 | ext, function=resize_PIL(channel_first, interp, w, h), batch_processing=False |
| 105 | ) |
| 106 | if dtype is not None: # unfortunately, PIL can't quite handle that |
| 107 | pil_resized = fn.cast(pil_resized, dtype=dtype) |
| 108 | pil_resized = fn.reshape(pil_resized, layout=layout) |
| 109 | pipe.set_outputs(pil_resized) |
| 110 | return pipe |
| 111 | |
| 112 | |
| 113 | def create_dali_pipe(channel_first, seq_len, interp, dtype, w, h, batch_size=2): |
no test coverage detected