From 23db5d939c35edcf0c9891c6e96d47035cff72b4 Mon Sep 17 00:00:00 2001 From: Brilliant-B <1289805957@qq.com> Date: Mon, 7 Aug 2023 07:02:00 +0000 Subject: [PATCH] experiments_finetune --- configs/fpn_neck.py | 2 +- configs/linear_neck.py | 2 +- configs/sfp_neck.py | 2 +- test.py | 5 ++--- test.sh | 9 ++++----- train.py | 9 +++++---- train.sh | 5 ++--- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/configs/fpn_neck.py b/configs/fpn_neck.py index 0618355..afc3aa7 100644 --- a/configs/fpn_neck.py +++ b/configs/fpn_neck.py @@ -12,7 +12,7 @@ samples_per_gpu=3, workers_per_gpu=2, val=dict(split='ImageSets/SegmentationContext/tiny_val.txt',), - test=dict(split='ImageSets/SegmentationContext/val.txt',), + test=dict(split='ImageSets/SegmentationContext/tiny_val.txt',), ) checkpoint_config = dict(interval=2000,) diff --git a/configs/linear_neck.py b/configs/linear_neck.py index 4708299..2b0df47 100644 --- a/configs/linear_neck.py +++ b/configs/linear_neck.py @@ -8,7 +8,7 @@ samples_per_gpu=32, workers_per_gpu=2, val=dict(split='ImageSets/SegmentationContext/tiny_val.txt',), - test=dict(split='ImageSets/SegmentationContext/val.txt',), + test=dict(split='ImageSets/SegmentationContext/tiny_val.txt',), ) checkpoint_config = dict(interval=2000,) diff --git a/configs/sfp_neck.py b/configs/sfp_neck.py index c572fb0..26a64a0 100644 --- a/configs/sfp_neck.py +++ b/configs/sfp_neck.py @@ -13,7 +13,7 @@ samples_per_gpu=3, workers_per_gpu=2, val=dict(split='ImageSets/SegmentationContext/tiny_val.txt',), - test=dict(split='ImageSets/SegmentationContext/val.txt',), + test=dict(split='ImageSets/SegmentationContext/tiny_val.txt',), ) checkpoint_config = dict(interval=2000,) diff --git a/test.py b/test.py index 0075ab8..c4af26e 100644 --- a/test.py +++ b/test.py @@ -146,7 +146,6 @@ def main(): cfg.data.test.test_mode = True if args.gpu_id is not None: cfg.gpu_ids = [args.gpu_id] - # init distributed env first, since logger depends on the dist info. if args.launcher == 'none': cfg.gpu_ids = [args.gpu_id] @@ -166,10 +165,10 @@ def main(): mmcv.mkdir_or_exist(osp.abspath(args.work_dir)) timestamp = time.strftime('%Y%m%d_%H%M%S', time.localtime()) if args.aug_test: - json_file = osp.join(args.work_dir, + json_file = osp.join(args.work_dir.replace("/hy-tmp/", ""), f'eval_multi_scale_{timestamp}.json') else: - json_file = osp.join(args.work_dir, + json_file = osp.join(args.work_dir.replace("/hy-tmp/", ""), f'eval_single_scale_{timestamp}.json') elif rank == 0: work_dir = osp.join('./work_dirs', diff --git a/test.sh b/test.sh index 5bcf6e4..9abc5fb 100644 --- a/test.sh +++ b/test.sh @@ -2,10 +2,10 @@ GPU=0 NAME="eva2_segmenter" -CONFIGS="configs/Hyper_Control.py" -CKPT="workbench/eva2_segmenter/train/finetune_1/iter_14000.pth" -WORK_DIR="workbench/${NAME}/eval/" -SHOW_DIR="workbench/${NAME}/eval/inference/" +CONFIGS="configs/linear_neck.py" +CKPT="/hy-tmp/workbench/eva2_segmenter/train/neck_linear_finetune_0/iter_22000.pth" +WORK_DIR="/hy-tmp/workbench/${NAME}/eval/" +SHOW_DIR="/hy-tmp/workbench/${NAME}/eval/inference/" python test.py --eval mIoU --gpu-id ${GPU} \ --config ${CONFIGS} \ @@ -14,4 +14,3 @@ python test.py --eval mIoU --gpu-id ${GPU} \ --show-dir ${SHOW_DIR} \ # --no-validate # --load-from ${LOAD} - diff --git a/train.py b/train.py index 0623af3..323b5fb 100644 --- a/train.py +++ b/train.py @@ -212,11 +212,12 @@ def main(args, info, verbose=False): # create work_dir mmcv.mkdir_or_exist(osp.abspath(cfg.work_dir)) + mmcv.mkdir_or_exist(osp.abspath(cfg.work_dir.replace("/hy-tmp/", ""))) # dump config - cfg.dump(osp.join(cfg.work_dir, osp.basename(config))) + cfg.dump(osp.join(cfg.work_dir.replace("/hy-tmp/", ""), osp.basename(config))) # init the logger before other steps timestamp = time.strftime('%Y%m%d_%H%M%S', time.localtime()) - log_file = osp.join(cfg.work_dir, f'{timestamp}.log') + log_file = osp.join(cfg.work_dir.replace("/hy-tmp/", ""), f'{timestamp}.log') logger = get_root_logger(log_file=log_file, log_level=cfg.log_level) # init the meta dict to record some important information such as @@ -280,10 +281,10 @@ def main(args, info, verbose=False): if __name__ == '__main__': args = parse_args() - neck_choices = ["linear", "fpn", "sfp"][:1] + neck_choices = ["linear", "fpn", "sfp"] for n in neck_choices: hyper_info = { - "finetune_code": 0, + "finetune_code": 1, "config_neck": n, } main(args, hyper_info) \ No newline at end of file diff --git a/train.sh b/train.sh index d1f5f62..de55bb9 100644 --- a/train.sh +++ b/train.sh @@ -2,8 +2,8 @@ GPU=0 NAME="eva2_segmenter" -WORK_DIR="workbench/${NAME}/train/" -RESUME="workbench/${NAME}/train/finetune_1/iter_14000.pth" +WORK_DIR="/hy-tmp/workbench/${NAME}/train/" +RESUME="/hy-tmp/neck_linear_finetune_0/iter_6000.pth" LOAD="" python train.py --seed 0 --deterministic --gpu-ids ${GPU} \ @@ -11,4 +11,3 @@ python train.py --seed 0 --deterministic --gpu-ids ${GPU} \ # --resume-from ${RESUME} \ # --no-validate # --load-from ${LOAD} -