def METHOD_NAME(self):
    train_dataset = ImageNetDataset("./ILSVRC2012_data_demo/ILSVRC2012/")
    image = paddle.static.data(
        name='inputs', shape=[None] + [3, 224, 224], dtype='float32')
    label = paddle.static.data(
        name='labels', shape=[None] + [1], dtype='float32')
    train_loader = paddle.io.DataLoader(
        train_dataset, feed_list=[image], batch_size=8, return_list=False)
    def reader_wrapper(reader, input_name):
        def gen():
            for i, (imgs, label) in enumerate(reader()):
                yield {input_name: imgs}
        return gen
    def eval_reader(data_dir,
                    batch_size,
                    crop_size,
                    resize_size,
                    place=None):
        val_dataset = ImageNetDataset(
            "./ILSVRC2012_data_demo/ILSVRC2012/", mode='val')
        val_loader = paddle.io.DataLoader(
            val_dataset,
            feed_list=[image, label],
            batch_size=batch_size,
            shuffle=False,
            drop_last=False,
            num_workers=0,
            return_list=False)
        return val_loader
    def eval_function(exe, compiled_test_program, test_feed_names,
                      test_fetch_list):
        val_loader = eval_reader(
            './ILSVRC2012_data_demo/ILSVRC2012/',
            batch_size=32,
            crop_size=224,
            resize_size=256)
        results = []
        print('Evaluating...')
        for batch_id, data in enumerate(val_loader):
            image = data[0]['inputs']
            label = data[0]['labels']
            # top1_acc, top5_acc
            if len(test_feed_names) == 1:
                image = np.array(image)
                label = np.array(label).astype('int64')
                pred = exe.run(
                    compiled_test_program,
                    feed={test_feed_names[0]: image},
                    fetch_list=test_fetch_list)
                pred = np.array(pred[0])
                label = np.array(label)
                sort_array = pred.argsort(axis=1)
                top_1_pred = sort_array[:, -1:][:, ::-1]
                top_1 = np.mean(label == top_1_pred)
                top_5_pred = sort_array[:, -5:][:, ::-1]
                acc_num = 0
                for i in range(len(label)):
                    if label[i][0] in top_5_pred[i]:
                        acc_num += 1
                top_5 = float(acc_num) / len(label)
                results.append([top_1, top_5])
            else:
                # eval "eval model", which inputs are image and label, output is top1 and top5 accuracy
                image = np.array(image)
                label = np.array(label).astype('int64')
                result = exe.run(
                    compiled_test_program,
                    feed={
                        test_feed_names[0]: image,
                        test_feed_names[1]: label
                    },
                    fetch_list=test_fetch_list)
                result = [np.mean(r) for r in result]
                results.append(result)
            if batch_id % 100 == 0:
                print('Eval iter: ', batch_id)
        result = np.mean(np.array(results), axis=0)
        return result[0]
    analyzer = Analysis(
        float_model_dir="./MobileNetV1_infer",
        model_filename="inference.pdmodel",
        params_filename="inference.pdiparams",
        save_dir="MobileNetV1_analysis",
        quant_config={
            'quantizable_op_type': ["conv2d", "depthwise_conv2d"],
            'weight_quantize_type': 'abs_max',
            'activation_quantize_type': 'moving_average_abs_max',
            'is_full_quantize': False,
            'batch_size': 8,
            'batch_nums': 10,
        },
        data_loader=train_loader,
        eval_function=eval_function)
    analyzer.metric_error_analyse()
    analyzer.get_target_quant_model(0.695)
    os.system('rm -rf MobileNetV1_analysis')