【代码调试】《Multi-scale Positive Sample Refinement for Few-shot Object Detection》

news2024/11/27 14:40:54

论文地址:https://arxiv.org/abs/2007.09384#:~:text=Multi-Scale%20Positive%20Sample%20Refinement%20for%20Few-Shot%20Object%20Detection.,previous%20attempts%20that%20exploit%20few-shot%20classification%20techniques%20
代码地址:https://github.com/jiaxi-wu/MPSR

我的配置:
Python :3.6.5(ubuntu20.04)
Pytorch :1.9.0
Cuda :11.1
GPU:RTX 3090 Ti(24GB)

1、依赖安装

conda install ipython pip

pip install ninja yacs cython matplotlib tqdm opencv-python

pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

2、安装pycocotools

创建文件夹 install_dir
在这里插入图片描述

cd install_dir

git clone https://github.com/cocodataset/cocoapi.git

cd cocoapi/PythonAPI

python setup.py build_ext install

pycocotools编译成功:
在这里插入图片描述

3、安装apex

cd install_dir

git clone https://github.com/NVIDIA/apex.git

cd apex

git checkout 96b017a

python setup.py install --cuda_ext --cpp_ext

apex编译成功:
在这里插入图片描述

4、build

python setup.py build develop

报错:

/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:303:30: note: declared here
  303 |   DeprecatedTypeProperties & type() const {
      |                              ^~~~
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1673, in _run_ninja_build
    env=env)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "setup.py", line 68, in <module>
    cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension},
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 708, in build_extensions
    build_ext.build_extensions(self)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
    _build_ext.build_extension(self, ext)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 538, in unix_wrap_ninja_compile
    with_cuda=with_cuda)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1359, in _write_ninja_file_and_compile_objects
    error_prefix='Error compiling objects for extension')
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1683, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

解决方案:

https://github.com/facebookresearch/maskrcnn-benchmark/issues/1274
https://github.com/amazon-science/siam-mot/blob/main/readme/INSTALL.md

cuda_dir="maskrcnn_benchmark/csrc/cuda"
perl -i -pe 's/AT_CHECK/TORCH_CHECK/' $cuda_dir/deform_pool_cuda.cu $cuda_dir/deform_conv_cuda.cu
# You can then run the regular setup command
python setup.py build develop

build成功:
在这里插入图片描述

4、准备数据集

4.1、VOC数据集

mkdir -p datasets/voc
wget https://pjreddie.com/media/files/VOCtrainval_11-May-2012.tar
wget https://pjreddie.com/media/files/VOCtrainval_06-Nov-2007.tar
wget https://pjreddie.com/media/files/VOCtest_06-Nov-2007.tar
tar xf VOCtrainval_11-May-2012.tar
tar xf VOCtrainval_06-Nov-2007.tar
tar xf VOCtest_06-Nov-2007.tar

将VOC2007和VOC2012放在 datasets/voc 文件夹下:
在这里插入图片描述

4.2、准备基数据集和小样本数据集

bash tools/fewshot_exp/datasets/init_fs_dataset_standard.sh

在这里我没有使用COCO数据集,所以把tools/fewshot_exp/datasets/init_fs_dataset_standard.sh文件中的第7、8行注释掉了
报错:

正克隆到 '../Fewshot_Detection'...
remote: Enumerating objects: 365, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 365 (delta 2), reused 1 (delta 0), pack-reused 358
接收对象中: 100% (365/365), 121.58 KiB | 496.00 KiB/s, 完成.
处理 delta 中: 100% (267/267), 完成.
Traceback (most recent call last):
  File "tools/fewshot_exp/datasets/voc_create_base.py", line 1, in <module>
    from maskrcnn_benchmark.data.datasets.voc import PascalVOCDataset
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/data/__init__.py", line 2, in <module>
    from .build import make_data_loader
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/data/build.py", line 8, in <module>
    from maskrcnn_benchmark.utils.imports import import_file
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/utils/imports.py", line 4, in <module>
    if torch._six.PY3:
AttributeError: module 'torch._six' has no attribute 'PY3'
Traceback (most recent call last):
  File "tools/fewshot_exp/datasets/voc_create_standard.py", line 2, in <module>
    from maskrcnn_benchmark.data.datasets.voc import PascalVOCDataset
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/data/__init__.py", line 2, in <module>
    from .build import make_data_loader
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/data/build.py", line 8, in <module>
    from maskrcnn_benchmark.utils.imports import import_file
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/utils/imports.py", line 4, in <module>
    if torch._six.PY3:
AttributeError: module 'torch._six' has no attribute 'PY3'
Traceback (most recent call last):
  File "tools/fewshot_exp/datasets/coco_create_base.py", line 1, in <module>
    from maskrcnn_benchmark.data.datasets.coco import COCODataset
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/data/__init__.py", line 2, in <module>
    from .build import make_data_loader
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/data/build.py", line 8, in <module>
    from maskrcnn_benchmark.utils.imports import import_file
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/utils/imports.py", line 4, in <module>
    if torch._six.PY3:
AttributeError: module 'torch._six' has no attribute 'PY3'
Traceback (most recent call last):
  File "tools/fewshot_exp/datasets/coco_create_standard.py", line 1, in <module>
    from maskrcnn_benchmark.data.datasets.coco import COCODataset
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/data/__init__.py", line 2, in <module>
    from .build import make_data_loader
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/data/build.py", line 8, in <module>
    from maskrcnn_benchmark.utils.imports import import_file
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/utils/imports.py", line 4, in <module>
    if torch._six.PY3:
AttributeError: module 'torch._six' has no attribute 'PY3'

解决方案:

https://blog.csdn.net/pangweijian/article/details/120371802

完成:
在这里插入图片描述

5、对 VOC 数据集进行小样本训练

5.1、对 3 个 VOC splits进行基础训练

下载Resnet-101权重文件,将 configs/fewshot/base 文件夹和configs/fewshot_baseline/base文件夹下的三个yaml配置文件中的WEIGHTS路径改为Resnet-101权重文件的路径:
在这里插入图片描述

根据自己的电脑配置修改tools/fewshot_exp/train_voc_base.sh文件中GPU的数量和GPU编号:

在这里插入图片描述

基础训练:

bash tools/fewshot_exp/train_voc_base.sh

1、报错:

Traceback (most recent call last):
  File "./tools/train_net.py", line 197, in <module>
    main()
  File "./tools/train_net.py", line 190, in main
    model = train(cfg, args.local_rank, args.distributed)
  File "./tools/train_net.py", line 65, in train
    extra_checkpoint_data = checkpointer.load(cfg.MODEL.WEIGHT)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/utils/checkpoint.py", line 61, in load
    checkpoint = self._load_file(f)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/utils/checkpoint.py", line 134, in _load_file
    return load_c2_format(self.cfg, f)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/utils/c2_model_loading.py", line 206, in load_c2_format
    return C2_FORMAT_LOADER[cfg.MODEL.BACKBONE.CONV_BODY](cfg, f)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/utils/c2_model_loading.py", line 192, in load_resnet_c2_format
    state_dict = _load_c2_pickled_weights(f)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/utils/c2_model_loading.py", line 135, in _load_c2_pickled_weights
    if torch._six.PY3:
AttributeError: module 'torch._six' has no attribute 'PY3'
Killing subprocess 58533

解决方案:
找到报错的文件,将PY3改为PY37:
在这里插入图片描述

2、报错:

2023-04-10 18:29:41,611 maskrcnn_benchmark.trainer INFO: Start training
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/multiprocessing/resource_sharer.py", line 139, in _serve
    signal.pthread_sigmask(signal.SIG_BLOCK, range(1, signal.NSIG))
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/signal.py", line 60, in pthread_sigmask
    sigs_set = _signal.pthread_sigmask(how, mask)
  ValueError: signal number 32 out of range

解决方案:
修改maskrcnn_benchmark/config/defaults.py文件中_C.DATALOADER.NUM_WORKERS = 0,然后重新运行build.py文件进行编译:
在这里插入图片描述

3、报错

Traceback (most recent call last):
  File "./tools/train_net.py", line 197, in <module>
    main()
  File "./tools/train_net.py", line 190, in main
    model = train(cfg, args.local_rank, args.distributed)
  File "./tools/train_net.py", line 96, in train
    data_loader_closeup
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/engine/trainer.py", line 78, in do_train
    loss_dict = model(images, targets, closeups, closeup_targets)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/apex-0.1-py3.6-linux-x86_64.egg/apex/amp/_initialize.py", line 197, in new_fwd
    **applier(kwargs, input_caster))
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 70, in forward
    proposals, proposal_losses = self.rpn(images, features, targets, closeup_rpn_features)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/modeling/rpn/rpn.py", line 189, in forward
    return self._forward_train(anchors, objectness, rpn_box_regression, targets, closeup_objectness)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/modeling/rpn/rpn.py", line 208, in _forward_train
    anchors, objectness, rpn_box_regression, targets, closeup_objectness
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/modeling/rpn/loss.py", line 114, in __call__
    sampled_pos_inds, sampled_neg_inds = self.fg_bg_sampler(labels)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/maskrcnn_benchmark-0.1-py3.6-linux-x86_64.egg/maskrcnn_benchmark/modeling/balanced_positive_negative_sampler.py", line 50, in __call__
    perm2 = torch.randperm(negative.numel(), device=negative.device)[:num_neg]
RuntimeError: radix_sort: failed on 1st step: cudaErrorInvalidDevice: invalid device ordinal
Killing subprocess 61318
Traceback (most recent call last):
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/launch.py", line 340, in <module>
    main()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/launch.py", line 326, in main
    sigkill_handler(signal.SIGTERM, None)  # not coming back
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/launch.py", line 301, in sigkill_handler
    raise subprocess.CalledProcessError(returncode=last_return_code, cmd=cmd)
subprocess.CalledProcessError: Command '['/home/test/anaconda3/envs/mpsr/bin/python', '-u', './tools/train_net.py', '--local_rank=0', '--config-file', 'configs/fewshot/base/e2e_voc_split1_base.yaml']' returned non-zero exit status 1.

解决方案:
将pytorch1.8.0换成1.9.0,然后重新编译apex以及MPSR整个项目

pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

4、报错

cannot import name ‘container_abcs‘ from ‘torch._six‘

找到报错的位置,把
from torch._six import container_abcs
改为:
import collections.abc as container_abcs
在这里插入图片描述

5、报错

    "__main__", mod_spec)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/launch.py", line 173, in <module>
    main()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/launch.py", line 169, in main
    run(args)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/run.py", line 624, in run
    )(*cmd_args)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/launcher/api.py", line 116, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 348, in wrapper
    return f(*args, **kwargs)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/launcher/api.py", line 238, in launch_agent
    result = agent.run()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/elastic/metrics/api.py", line 125, in wrapper
    result = f(*args, **kwargs)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/elastic/agent/server/api.py", line 700, in run
    result = self._invoke_run(role)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/elastic/agent/server/api.py", line 822, in _invoke_run
    self._initialize_workers(self._worker_group)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/elastic/metrics/api.py", line 125, in wrapper
    result = f(*args, **kwargs)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/elastic/agent/server/api.py", line 670, in _initialize_workers
    self._rendezvous(worker_group)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/elastic/metrics/api.py", line 125, in wrapper
    result = f(*args, **kwargs)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/elastic/agent/server/api.py", line 530, in _rendezvous
    store, group_rank, group_world_size = spec.rdzv_handler.next_rendezvous()
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/distributed/elastic/rendezvous/static_tcp_rendezvous.py", line 60, in next_rendezvous
    self.timeout,
RuntimeError: Address already in use

解决方案:
https://github.com/facebookresearch/maskrcnn-benchmark/issues/241

训练完成,得到三个权重文件:
在这里插入图片描述

5.2、微调

依旧是,根据自己的电脑配置修改tools/fewshot_exp/train_voc_standard.sh文件中GPU的数量和GPU编号
在这里插入图片描述
依旧是,参考这个修改train_voc_standard.sh文件:
https://github.com/facebookresearch/maskrcnn-benchmark/issues/241

微调:

bash tools/fewshot_exp/train_voc_standard.sh

1、报错

Traceback (most recent call last):
  File "tools/train_net.py", line 197, in <module>
    main()
  File "tools/train_net.py", line 190, in main
    model = train(cfg, args.local_rank, args.distributed)
  File "tools/train_net.py", line 65, in train
    extra_checkpoint_data = checkpointer.load(cfg.MODEL.WEIGHT)
  File "/home/test/code/MPSR/maskrcnn_benchmark/utils/checkpoint.py", line 62, in load
    self._load_model(checkpoint)
  File "/home/test/code/MPSR/maskrcnn_benchmark/utils/checkpoint.py", line 98, in _load_model
    load_state_dict(self.model, checkpoint.pop("model"))
  File "/home/test/code/MPSR/maskrcnn_benchmark/utils/model_serialization.py", line 80, in load_state_dict
    model.load_state_dict(model_state_dict)
  File "/home/test/anaconda3/envs/mpsr/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1407, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))

        size mismatch for roi_heads.box.predictor.cls_score.weight: copying a param with shape torch.Size([16, 1024]) from checkpoint, the shape in current model is torch.Size([21, 1024]).
        size mismatch for roi_heads.box.predictor.cls_score.bias: copying a param with shape torch.Size([16]) from checkpoint, the shape in current model is torch.Size([21]).

解决方案:
https://github.com/jiaxi-wu/MPSR/issues/9

修改完成之后运行以下命令重新生成’voc0712_split%dbase_pretrained.pth’就行了

python tools/fewshot_exp/trans_voc_pretrained.py 1
python tools/fewshot_exp/trans_voc_pretrained.py 2
python tools/fewshot_exp/trans_voc_pretrained.py 3

微调完成,得到这些:

5.3、评估

3 split的1/2/3/5/10 shot进行评估。
默认情况下,存储结果文件夹为 fs_exp/voc_standard_results,可以通过以下方式快速获得评估结果:

python tools/fewshot_exp/cal_novel_voc.py fs_exp/voc_standard_results

6、结论

官方代码使用2个GPU,而我只有1个GPU。按照作者提供的单卡训练方法修改了诸多参数之后跑出来的效果仍旧远远不及官方效果,放在这里给大家做一个参考,不过具体数值就不列出了:基础训练mAP在0.2~0.4之间,微调后的mAP在0.1~0.2之间。
如有错误,欢迎指正。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/533485.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

什么是低代码开发?低代码开发可以解决哪些问题?

一、什么是低代码开发&#xff1f; 低代码可以理解为是一种全新的应用开发理念。主要以可视化、参数化的系统配置方式来进行程序应用的开发&#xff0c;因此可以大幅度减少代码编写的工作&#xff0c;从而提高开发效率。 低代码平台则是通过对于业务场景进行高度抽象、提炼&a…

复习之Linux中的名词解释

1.什么是Linux? 严格来讲&#xff0c;Linux这个词本身只表示Linux内核&#xff0c;但实际上人们已经习惯了用Linux来形容整个基于Linux内核&#xff0c;并且使用GNU 工程各种工具和数据库的操作系统。因此LinuxLinux内核GNU软件 2.什么是Shell? Shell是系统的用户界面&…

Redis学习---01(Redis安装超详细)

一、Nosql非关系型数据库 (1)小tips: 数据库的发展&#xff1a; 单机时代memcached 缓存Mysql读写分离&#xff08;一部分数据库只写&#xff0c;一些数据库只用来读&#xff09;分库分表 水平拆分Mysql集群 (2) Nosql的特点&#xff1a; 对于数据量大&#xff0c;变化比较…

如何安装Tomcat并在IDEA中配置

下载 1.如果你使用的是Spring框架的6版本请下载Tomcat10版本 Apache Tomcat - Apache Tomcat 10 Software Downloads 2.如果你使用的是Spring框架的6以下请下载Tomcat9版本或以下都行&#xff0c;如果不知道你使用的是什么推荐下载Tomcat9版本使用 Apache Tomcat - Apache …

第三方直播云平台(保利威和阿里云)直播集成demo

第三方直播云平台&#xff08;保利威和阿里云&#xff09;直播集成文档整理。 保利威&#xff1a; 保利威帮助中心 js demo <div id"player"></div> <script src"//player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js">…

通俗易懂的入门正则表达式

背景 其实在使用正则表达式之前&#xff0c;我们在查找文件之类的&#xff0c;已经用过类似正则表达式的符号&#xff0c;例如&#xff1a; // 匹配多个任意字符 ls *.js // 只匹配一个任意字符 ls ?.js这种方法很有用但也是有限的&#xff0c;而正则表达式则更加的完整、强…

Linux - 第14节 - 网络编程套接字(三)

1.Linux远程控制的网络程序 1.1.Linux远程控制的网络程序&#xff08;普通版&#xff09; 创建serverTcp.cc文件&#xff0c;写入下图一所示的代码&#xff0c;创建clientTcp.cc文件&#xff0c;写入下图二所示的代码&#xff0c;创建log.hpp文件&#xff0c;写入下图三所示的…

Dart整理笔记 | Dart参考手册

Dart SDK 安装 如果是使用Flutter 开发&#xff0c;Flutter SDK自带&#xff0c;无需单独安装Dart SDK。 如果需要独立调试运行Dart代码&#xff0c;需要独立安装Dart SDK。 官方文档&#xff1a;https://dart.dev/get-dart windows(推荐): http://www.gekorm.com/dart-wind…

秒级数据写入,毫秒查询响应,天眼查基于 Apache Doris 构建统一实时数仓

导读&#xff1a; 随着天眼查近年来对产品的持续深耕和迭代&#xff0c;用户数量也在不断攀升&#xff0c;业务的突破更加依赖于数据赋能&#xff0c;精细化的用户/客户运营也成为提升体验、促进消费的重要动力。在这样的背景下正式引入 Apache Doris 对数仓架构进行升级改造&a…

浅聊一下Linuxptp

浅聊一下Linuxptp 文章目录 浅聊一下Linuxptp1.什么是Linuxptp2.安装Linuxptp3.源码解析一下1.8个带main函数的源文件1.hwstamp_ctl.c2.nsm.c3.phc2sys.84.phc_ctl.85.pmc.86.ptp4l.c7.timemaster.c8.ts2phc.c 2.clock.c文件 4.自己实践 1.什么是Linuxptp LinuxPTP&#xff08…

HIS系统是什么意思?HIS系统的主要功能有哪些?

HIS系统是什么意思&#xff1f; HIS系统即医院信息系统(全称为Hospital information System) &#xff0c;是指利用计算机软硬件技术和网络通信技术等现代化手段&#xff0c;对医院及其所属各部门的人流、物流、财流进行综合管理&#xff0c;对在医疗活动各阶段产生的数据进行采…

构造函数(包括默认构造函数) ,析构函数的使用与特性

文章目录 一、构造函数二、默认构造函数&#xff08;也是构造函数&#xff09;默认构造函数的种类&#xff1a;1.无参类型2.全缺省类型3.编译器自动生成的4.汇总 三、析构函数 一、构造函数 构造函数是一个特殊的成员函数&#xff0c;名字与类名相同,创建类类型对象时由编译器自…

opencv_c++学习(七)

一、图像颜色空间变换 一、图像颜色空间介绍 RGB颜色模型 具体的体现样式如下&#xff1a; 在opencv中有可以实现数据类型的转换接口&#xff0c;如下&#xff1a; Mat:convertTo (OutputArray m, int rtype, alpha, double 1, double beta)实现如下&#xff1a; a.conve…

Python-字典与集合

学习内容&#xff1a;Python基础入门知识 专栏作者&#xff1a;不渴望力量的哈士奇不渴望力量的哈士奇擅长Python全栈白宝书[更新中],⑤ - 数据库开发实战篇,网安之路,等方面的知识,不渴望力量的哈士奇关注云原生,算法,python,集成测试,去中心化,web安全,智能合约,devops,golan…

如何使用jenkins、ant、selenium、testng搭建自动化测试框架

如果在你的理解中自动化测试就是在eclipse里面讲webdriver的包引入&#xff0c;然后写一些测试脚本&#xff0c;这就是你所说的自动化测试&#xff0c;其实这个还不能算是真正的自动化测试&#xff0c;你见过每次需要运行的时候还需要打开eclipse然后去选择运行文件吗&#xff…

NR RLC(二)相关参数及format

欢迎关注同名微信公众号“modem协议笔记”。 实际查看RLC部分log难免要翻协议&#xff0c;查阅最多的就是相关参数的含义&#xff0c;反而RLC具体过程就没有像当初阅读时那样特别关注了。其实清楚RLC参数含义&#xff0c;看38.322就没那么困难。而RLC具体过程往往要用到相关参…

azkaban --- 案例实操

目录 案例一 &#xff1a; 输出Hello World 案例二 &#xff1a;作业依赖 案例三 &#xff1a;内嵌工作流 案例四 &#xff1a;自动失败 案例五 &#xff1a;手动失败 案例六 &#xff1a;JavaProcess 案例七 &#xff1a;启动服务 案例八 &#xff1a;Hbase 案例九 …

SpringBoot整合企业微信消息推送(四十五)

从头开始&#xff0c;并不意味着失败&#xff0c;相反&#xff0c;正是拥抱成功的第一步&#xff0c;即使还会继续失败 上一章简单介绍了 SpringBoot整合钉钉消息推送(四十四) , 如果没有看过,请观看上一章 一. 企业微信前期准备 用户需要注册一个企业微信&#xff0c; 并且登…

ANR基础 - Input系统

系列文章目录 提示&#xff1a;这里可以添加系列文章的所有文章的目录&#xff0c;目录需要自己手动添加 例如&#xff1a;第一章 Python 机器学习入门之pandas的使用 文章目录 系列文章目录前言一、Input系统概述二、整体框架1.整体框架类图2.核心启动过程2.1 initialize2.1 I…

浅析一下PTPD

浅聊一下PTPD 文章目录 浅聊一下PTPD1.什么是PTPD2.PTPD源码浅析一下1.src文件1.arith.c2.bmc.c3.constant.h 和 datatypes.h4.display.c5.management.c6.protocol.c7.ptp_datatypes.h8.ptp_primitives.h9.ptp_timers.c10.ptpd.c11.signaling.c12.timedomain.c 2.def文件夹3.de…