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

Function get_preproc_data_dir

training/dataset.py:282–316  ·  view source on GitHub ↗
(cfg, name)

Source from the content-addressed store, hash-verified

280
281# Returns the directory path of the best matching preprocessed dataset
282def get_preproc_data_dir(cfg, name):
283 # Get all preprocessed versions of the requested dataset
284 data_dirs = sorted([f for f in glob(os.path.join(cfg.preproc_dir, name + '.*')) if os.path.isdir(f)])
285
286 # Iterate over all dataset versions
287 best_dir = None
288 best_num_channels = None
289
290 for data_dir in data_dirs:
291 # Load the dataset config if it exists (ignore corrupted datasets)
292 if os.path.isfile(get_config_filename(data_dir)):
293 data_cfg = load_config(data_dir)
294
295 # Backward compatibility
296 if not hasattr(data_cfg, 'clean_aux'):
297 data_cfg.clean_aux = False
298 if not hasattr(data_cfg, 'aux_results'):
299 data_cfg.aux_results = []
300
301 # Check whether the dataset matches the requirements
302 if get_main_feature(data_cfg.features) == get_main_feature(cfg.features) and \
303 all(f in data_cfg.features for f in cfg.features) and \
304 data_cfg.clean_aux == cfg.clean_aux and \
305 (not data_cfg.aux_results if not cfg.aux_results else \
306 all(r in data_cfg.aux_results for r in cfg.aux_results)) and \
307 data_cfg.transfer == cfg.transfer:
308 # Select the most recent version with the minimal amount of channels stored
309 num_channels = len(get_dataset_channels(data_cfg.features))
310 if best_dir is None or num_channels <= best_num_channels:
311 best_dir = data_dir
312 best_num_channels = num_channels
313
314 if best_dir is None:
315 error('no matching preproccessed dataset found')
316 return best_dir
317
318class PreprocessedDataset(Dataset):
319 def __init__(self, cfg, name):

Callers 1

__init__Method · 0.85

Calls 5

get_config_filenameFunction · 0.85
load_configFunction · 0.85
get_main_featureFunction · 0.85
get_dataset_channelsFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected