关于metric learning中的reader.py
Created by: linshufei
版本、环境信息: 1)PaddlePaddle版本:1.6 2)CPU:CPU 3)GPU:无 4)系统环境:Linux python2.7 metric learning中的reader.py源码如下:createreader中的keep_order ` def createreader(settings, mode): def metric_reader(): if mode == 'train': train_data, train_image_list = init_sop('train') loss_name = settings.loss_name if loss_name in ["softmax", "arcmargin"]: return arcmargin_iterator(train_image_list, settings)() elif loss_name == 'triplet': return triplet_iterator(train_data, settings)() else: return common_iterator(train_data, settings)() elif mode == 'val': val_data, val_image_list = init_sop('val') return image_iterator(val_image_list, 'val')() else: test_image_list = init_sop('test') return image_iterator(test_image_list, 'test')()
image_shape = settings.image_shape.split(',')
assert(image_shape[1] == image_shape[2])
image_size = int(image_shape[2])
keep_order = False if mode != 'train' or settings.loss_name in ['softmax', 'arcmargin'] else True
image_mapper = functools.partial(process_image,
mode=mode, color_jitter=False, rotate=False, crop_size=image_size)
reader = paddle.reader.xmap_readers(
image_mapper, metric_reader, 8, 1000, order=keep_order)
return reader
` 问题描述: keep_order = False if mode != 'train' or settings.loss_name in ['softmax', 'arcmargin'] else True中当非训练模式置keep_order为False的作用是什么?