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

Function remap_pipe

dali/test/python/operator_2/test_remap.py:69–97  ·  view source on GitHub ↗

Returns either a reference pipeline or a pipeline under test. If the remap_op argument is 'dali', this function returns a DALI pipeline under test. If the remap_op argument is 'cv', this function returns a reference DALI pipeline. :param remap_op: 'dali' or 'cv'. :param maps_d

(remap_op, maps_data, img_size)

Source from the content-addressed store, hash-verified

67
68@pipeline_def
69def remap_pipe(remap_op, maps_data, img_size):
70 """
71 Returns either a reference pipeline or a pipeline under test.
72
73 If the remap_op argument is 'dali', this function returns a DALI pipeline under test.
74 If the remap_op argument is 'cv', this function returns a reference DALI pipeline.
75
76 :param remap_op: 'dali' or 'cv'.
77 :param maps_data: List of ndarrays, which contains data for the remap parameters (maps).
78 :param img_size: Shape of the remap parameters, but without the channels value (only spatial).
79 :return: DALI Pipeline
80 """
81 img, _ = fn.readers.file(file_root=data_dir)
82 img = fn.decoders.image(img)
83 img = fn.resize(img, size=img_size)
84 mapx, mapy = fn.external_source(source=maps_data, batch=True, cycle=True, num_outputs=2)
85 if remap_op == "dali":
86 return fn.experimental.remap(
87 img.gpu(),
88 mapx.gpu(),
89 mapy.gpu(),
90 interp=DALIInterpType.INTERP_NN,
91 device="gpu",
92 pixel_origin="center",
93 )
94 elif remap_op == "cv":
95 return fn.python_function(img, mapx, mapy, function=_cv_remap)
96 else:
97 raise ValueError("Unknown remap operator.")
98
99
100class RemapTest(unittest.TestCase):

Callers 3

test_remapMethod · 0.85

Calls 3

fileMethod · 0.80
resizeMethod · 0.45
gpuMethod · 0.45

Tested by

no test coverage detected