diff --git a/ppcls/configs/StrategySearch/person.yaml b/ppcls/configs/StrategySearch/person.yaml index 996a8ac835ecd6ccd1402197583bf8c29f724b9a..6d105d7ecffcc10f40b7e0262616c2b4c8cbe740 100644 --- a/ppcls/configs/StrategySearch/person.yaml +++ b/ppcls/configs/StrategySearch/person.yaml @@ -4,24 +4,24 @@ distill_config_file: ppcls/configs/cls_demo/person/Distillation/PPLCNet_x1_0_dis gpus: 0,1,2,3 output_dir: output/search_person search_dict: - lrs: + - search_key: lrs replace_config: - Optimizer.lr.learning_rate search_values: [0.0075, 0.01, 0.0125] - resolutions: + - search_key: resolutions replace_config: - DataLoader.Train.dataset.transform_ops.1.RandCropImage.size - DataLoader.Train.dataset.transform_ops.3.TimmAutoAugment.img_size search_values: [176, 192, 224] - ra_probs: + - search_key: ra_probs replace_config: - DataLoader.Train.dataset.transform_ops.3.TimmAutoAugment.prob search_values: [0.0, 0.1, 0.5] - re_probs: + - search_key: re_probs replace_config: - DataLoader.Train.dataset.transform_ops.5.RandomErasing.EPSILON search_values: [0.0, 0.1, 0.5] - lr_mult_list: + - search_key: lr_mult_list replace_config: - Arch.lr_mult_list search_values: diff --git a/tools/search_strategy.py b/tools/search_strategy.py index e3b85b135c6b804870a9a20a29e226ec87632b45..58d8c171bd2760b9a7df3f910d834f53daa118cb 100644 --- a/tools/search_strategy.py +++ b/tools/search_strategy.py @@ -54,9 +54,10 @@ def search_strategy(): base_output_dir = configs["output_dir"] search_dict = configs.get("search_dict") all_results = {} - for search_key in search_dict: - search_values = search_dict[search_key]["search_values"] - replace_config = search_dict[search_key]["replace_config"] + for search_i in search_dict: + search_key = search_i["search_key"] + search_values = search_i["search_values"] + replace_config = search_i["replace_config"] res = search_train(search_values, base_program, base_output_dir, search_key, replace_config, model_name) all_results[search_key] = res best = res.get("best") @@ -73,7 +74,6 @@ def search_strategy(): for ind, ki in enumerate(base_program): if rm_k in ki: rm_indices.append(ind) - print(rm_indices) for rm_index in rm_indices[::-1]: teacher_program.pop(rm_index) teacher_program.pop(rm_index-1) @@ -94,9 +94,9 @@ def search_strategy(): v = final_replace[k] base_program[i] = base_program[i].replace(k, v) - print(all_results, base_program) process = subprocess.Popen(base_program) process.communicate() + print(all_results, base_program) if __name__ == '__main__':