MCPcopy Create free account
hub / github.com/RenderKit/oidn / preprocess_sample_group

Function preprocess_sample_group

training/preprocess.py:76–112  ·  view source on GitHub ↗
(input_dir, output_tza, input_names, target_name)

Source from the content-addressed store, hash-verified

74
75 # Preprocesses a group of input and target images at different SPPs
76 def preprocess_sample_group(input_dir, output_tza, input_names, target_name):
77 samples = []
78
79 # Load the target image
80 target_id = target_name % ''
81 print(target_id)
82 target_image, _ = load_image_features(os.path.join(input_dir, target_name), target_features)
83
84 # Compute the autoexposure value
85 exposure = autoexposure(target_image) if main_feature == 'hdr' else 1.
86
87 # Preprocess the target image
88 target_image = preprocess_image(target_image, exposure)
89
90 # Save the target image
91 output_tza.write(target_id, target_image, 'hwc')
92
93 # Process the input images
94 for input_name in input_names:
95 # Load the image
96 input_id = input_name % ''
97 print(input_id)
98 input_image, _ = load_image_features(os.path.join(input_dir, input_name), input_features)
99
100 if input_image.shape[0:2] != target_image.shape[0:2]:
101 error('the input and target images have different sizes')
102
103 # Preprocess the image
104 input_image = preprocess_image(input_image, exposure, prefilter=True)
105
106 # Save the image
107 output_tza.write(input_id, input_image, 'hwc')
108
109 # Add sample
110 samples.append((input_id, target_id))
111
112 return samples
113
114 # Preprocesses a dataset
115 def preprocess_dataset(data_name):

Callers 1

preprocess_datasetFunction · 0.85

Calls 6

printFunction · 0.85
load_image_featuresFunction · 0.85
autoexposureFunction · 0.85
preprocess_imageFunction · 0.85
errorFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected