diff --git a/deploy/auto_compression/configs/rtdetr_hgnetv2_x_qat_dis.yaml b/deploy/auto_compression/configs/rtdetr_hgnetv2_x_qat_dis.yaml index c4e2889bbd3c69e758199f99b6fd517d227799d0..a8a4ac970a58b71e5da79805e36e67c7d5e40234 100644 --- a/deploy/auto_compression/configs/rtdetr_hgnetv2_x_qat_dis.yaml +++ b/deploy/auto_compression/configs/rtdetr_hgnetv2_x_qat_dis.yaml @@ -3,7 +3,7 @@ Global: reader_config: configs/rtdetr_reader.yml include_nms: True Evaluation: True - model_dir: ./rtdetr_r50vd_6x_coco/ + model_dir: ./rtdetr_hgnetv2_x_6x_coco/ model_filename: model.pdmodel params_filename: model.pdiparams diff --git a/deploy/auto_compression/configs/rtdetr_r101vd_qat_dis.yaml b/deploy/auto_compression/configs/rtdetr_r101vd_qat_dis.yaml index bd96d085e8a01cabba890f2602e9619855bf9d5a..45162b7189d68f81a73b9b83c16eaf89d70d5925 100644 --- a/deploy/auto_compression/configs/rtdetr_r101vd_qat_dis.yaml +++ b/deploy/auto_compression/configs/rtdetr_r101vd_qat_dis.yaml @@ -3,7 +3,7 @@ Global: reader_config: configs/rtdetr_reader.yml include_nms: True Evaluation: True - model_dir: ./rtdetr_hgnetv2_x_6x_coco/ + model_dir: ./rtdetr_r101vd_6x_coco/ model_filename: model.pdmodel params_filename: model.pdiparams diff --git a/deploy/auto_compression/configs/rtdetr_reader.yml b/deploy/auto_compression/configs/rtdetr_reader.yml index 7b213ffa202f8812f337f223c721a829fd8a55df..04b0db6a7fd29f5a66a25f5d1b426953a4f7748c 100644 --- a/deploy/auto_compression/configs/rtdetr_reader.yml +++ b/deploy/auto_compression/configs/rtdetr_reader.yml @@ -12,6 +12,18 @@ TrainDataset: anno_path: annotations/instances_val2017.json dataset_dir: dataset/coco/ +EvalDataset: + !COCODataSet + image_dir: val2017 + anno_path: annotations/instances_val2017.json + dataset_dir: dataset/coco/ + +TestDataset: + !COCODataSet + image_dir: val2017 + anno_path: annotations/instances_val2017.json + dataset_dir: dataset/coco/ + worker_num: 0 # preprocess reader in test diff --git a/deploy/auto_compression/paddle_inference_eval.py b/deploy/auto_compression/paddle_inference_eval.py index 053ee35e752c17fdb0069c6953b5e8f43f6aded1..b128d5249873bd8b25d7e52b44571a5ea7ae7ab4 100644 --- a/deploy/auto_compression/paddle_inference_eval.py +++ b/deploy/auto_compression/paddle_inference_eval.py @@ -284,48 +284,6 @@ def load_predictor( return predictor, rerun_flag -def get_current_memory_mb(): - """ - It is used to Obtain the memory usage of the CPU and GPU during the running of the program. - And this function Current program is time-consuming. - """ - try: - pkg.require('pynvml') - except: - from pip._internal import main - main(['install', 'pynvml']) - try: - pkg.require('psutil') - except: - from pip._internal import main - main(['install', 'psutil']) - try: - pkg.require('GPUtil') - except: - from pip._internal import main - main(['install', 'GPUtil']) - import pynvml - import psutil - import GPUtil - - gpu_id = int(os.environ.get("CUDA_VISIBLE_DEVICES", 0)) - - pid = os.getpid() - p = psutil.Process(pid) - info = p.memory_full_info() - cpu_mem = info.uss / 1024.0 / 1024.0 - gpu_mem = 0 - gpu_percent = 0 - gpus = GPUtil.getGPUs() - if gpu_id is not None and len(gpus) > 0: - gpu_percent = gpus[gpu_id].load - pynvml.nvmlInit() - handle = pynvml.nvmlDeviceGetHandleByIndex(0) - meminfo = pynvml.nvmlDeviceGetMemoryInfo(handle) - gpu_mem = meminfo.used / 1024.0 / 1024.0 - return round(cpu_mem, 4), round(gpu_mem, 4) - - def predict_image(predictor, image_file, image_shape=[640, 640], @@ -367,13 +325,7 @@ def predict_image(predictor, time_min = min(time_min, timed) time_max = max(time_max, timed) predict_time += timed - cpu_mem, gpu_mem = get_current_memory_mb() - cpu_mems += cpu_mem - gpu_mems += gpu_mem - time_avg = predict_time / repeats - print("[Benchmark]Avg cpu_mem:{} MB, avg gpu_mem: {} MB".format( - cpu_mems / repeats, gpu_mems / repeats)) print("[Benchmark]Inference time(ms): min={}, max={}, avg={}".format( round(time_min * 1000, 2), round(time_max * 1000, 1), round(time_avg * 1000, 1))) @@ -418,9 +370,6 @@ def eval(predictor, val_loader, metric, rerun_flag=False): time_min = min(time_min, timed) time_max = max(time_max, timed) predict_time += timed - cpu_mem, gpu_mem = get_current_memory_mb() - cpu_mems += cpu_mem - gpu_mems += gpu_mem if not FLAGS.include_nms: postprocess = PPYOLOEPostProcess( score_threshold=0.3, nms_threshold=0.6) @@ -436,8 +385,6 @@ def eval(predictor, val_loader, metric, rerun_flag=False): map_res = metric.get_results() metric.reset() time_avg = predict_time / sample_nums - print("[Benchmark]Avg cpu_mem:{} MB, avg gpu_mem: {} MB".format( - cpu_mems / sample_nums, gpu_mems / sample_nums)) print("[Benchmark]Inference time(ms): min={}, max={}, avg={}".format( round(time_min * 1000, 2), round(time_max * 1000, 1), round(time_avg * 1000, 1)))