def init_params(params, data_dir):
    ds = dataset.ILSVRC12(data_dir, 'val', shuffle=False, dir_structure='train')
    ds = AugmentImageComponent(ds, get_inference_augmentor())
    ds = BatchData(ds, 128, remainder=True)
    pred_config = PredictConfig(model=Model(), session_init=ParamRestore(params), input_names=['input', 'label'], output_names=['wrong-top1', 'wrong-top5'])
    pred = SimpleDatasetPredictor(pred_config, ds)
    (acc1, acc5) = (RatioCounter(), RatioCounter())
    for o in pred.get_result():
        batch_size = o[0].shape[0]
        acc1.feed(o[0].sum(), batch_size)
        acc5.feed(o[1].sum(), batch_size)
    print('Top1 Error: {}'.format(acc1.ratio))
    print('Top5 Error: {}'.format(acc5.ratio))
def init_params(params, data_dir):
    ds = dataset.ILSVRC12(data_dir, 'val', shuffle=False, dir_structure='train')
    ds = AugmentImageComponent(ds, get_inference_augmentor())
    ds = BatchData(ds, 128, remainder=True)
    pred_config = PredictConfig(model=Model(), session_init=ParamRestore(params), input_names=['input', 'label'], output_names=['wrong-top1', 'wrong-top5'])
    pred = SimpleDatasetPredictor(pred_config, ds)
    (acc1, acc5) = (RatioCounter(), RatioCounter())
    for o in pred.get_result():
        batch_size = o[0].shape[0]
        acc1.feed(o[0].sum(), batch_size)
        acc5.feed(o[1].sum(), batch_size)
    print('Top1 Error: {}'.format(acc1.ratio))
    print('Top5 Error: {}'.format(acc5.ratio))