Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么使用cbam训练后,显示map有提升,但是推理时出现了预测图片没有效果(整张图片没有预测框)的问题 #1000

Open
3 tasks done
2660383028 opened this issue May 2, 2024 · 0 comments

Comments

@2660383028
Copy link

Prerequisite

💬 Describe the reimplementation questions

代码修改:
我添加了cbam插件
model = dict(
backbone=dict(
plugins=[
dict(cfg=dict(type='CBAM'),
stages=(True, True, True, True)),
]),
bbox_head=dict(
head_module=dict(num_classes=num_classes),
prior_generator=dict(base_sizes=anchors),

    # loss_cls 会根据 num_classes 动态调整,但是 num_classes = 1 的时候,loss_cls 恒为 0
    loss_cls=dict(loss_weight=0.5 *
                  (num_classes / 80 * 3 / _base_.num_det_layers))))

报告:
!!!You are using YOLOv5Head with num_classes == 1. The loss_cls will be 0. This is a normal phenomenon.
Loads checkpoint by local backend from path: work_dirs_LLVIP/with_cbam/best_coco_bbox_mAP_epoch_44.pth
The model and loaded state dict do not match exactly

unexpected key in source state_dict: backbone.stage1.2.channel_attention.fc.0.conv.weight, backbone.stage1.2.channel_attention.fc.0.conv.bias, backbone.stage1.2.channel_attention.fc.1.conv.weight, backbone.stage1.2.channel_attention
.fc.1.conv.bias, backbone.stage1.2.spatial_attention.conv.conv.weight, backbone.stage1.2.spatial_attention.conv.conv.bias, backbone.stage4.3.channel_attention.fc.0.conv.weight, backbone.stage4.3.channel_attention.fc.0.conv.bias, bac
kbone.stage4.3.channel_attention.fc.1.conv.weight, backbone.stage4.3.channel_attention.fc.1.conv.bias, backbone.stage4.3.spatial_attention.conv.conv.weight, backbone.stage4.3.spatial_attention.conv.conv.bias

F:\Miniconda3\envs\mmyolo2\lib\site-packages\mmengine\visualization\visualizer.py:196: UserWarning: Failed to add <class 'mmengine.visualization.vis_backend.LocalVisBackend'>, please provide the save_dir argument.
warnings.warn(f'Failed to add {vis_backend.class}, '
F:\Miniconda3\envs\mmyolo2\lib\site-packages\mmengine\visualization\visualizer.py:196: UserWarning: Failed to add <class 'mmengine.visualization.vis_backend.TensorboardVisBackend'>, please provide the save_dir argument.
warnings.warn(f'Failed to add {vis_backend.class}, '
[>>>>>>>>>>>>>>>>>>>>>> ] 9/20, 1.8 task/s, elapsed: 5s, ETA: 6sF:\Miniconda3\envs\mmyolo2\lib\site-packages\mmdet\visualization\palette.py:90: UserWarning: floordiv is deprecated, and its behavior
will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mo
de='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
scales = 0.5 + (areas - min_area) // (max_area - min_area)
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 20/20, 2.7 task/s, elapsed: 7s, ETA: 0s
Results have been saved at F:\ssq\data_small_test\out

Environment

absl-py 2.1.0 pypi_0 pypi
addict 2.4.0 pypi_0 pypi
albumentations 1.4.2 pypi_0 pypi
aliyun-python-sdk-core 2.15.0 pypi_0 pypi
aliyun-python-sdk-kms 2.16.2 pypi_0 pypi
appdirs 1.4.4 pypi_0 pypi
bcrypt 4.1.2 pypi_0 pypi
ca-certificates 2024.3.11 haa95532_0 defaults
cachetools 5.3.3 pypi_0 pypi
certifi 2024.2.2 pypi_0 pypi
cffi 1.16.0 pypi_0 pypi
charset-normalizer 3.3.2 pypi_0 pypi
cityscapesscripts 2.2.2 pypi_0 pypi
click 8.1.7 pypi_0 pypi
cloudpickle 3.0.0 pypi_0 pypi
colorama 0.4.6 pypi_0 pypi
coloredlogs 15.0.1 pypi_0 pypi
contourpy 1.1.1 pypi_0 pypi
crcmod 1.7 pypi_0 pypi
cryptography 42.0.5 pypi_0 pypi
cycler 0.12.1 pypi_0 pypi
filelock 3.9.0 pypi_0 pypi
fonttools 4.50.0 pypi_0 pypi
fsspec 2023.4.0 pypi_0 pypi
google-auth 2.28.2 pypi_0 pypi
google-auth-oauthlib 1.0.0 pypi_0 pypi
grpcio 1.62.1 pypi_0 pypi
gym 0.26.2 pypi_0 pypi
gym-notices 0.0.8 pypi_0 pypi
humanfriendly 10.0 pypi_0 pypi
idna 3.6 pypi_0 pypi
imageio 2.34.0 pypi_0 pypi
importlib-metadata 7.0.2 pypi_0 pypi
importlib-resources 6.3.1 pypi_0 pypi
jinja2 3.1.2 pypi_0 pypi
jmespath 0.10.0 pypi_0 pypi
joblib 1.3.2 pypi_0 pypi
kiwisolver 1.4.5 pypi_0 pypi
lazy-loader 0.3 pypi_0 pypi
libffi 3.4.4 hd77b12b_0 defaults
markdown 3.6 pypi_0 pypi
markdown-it-py 3.0.0 pypi_0 pypi
markupsafe 2.1.5 pypi_0 pypi
matplotlib 3.7.5 pypi_0 pypi
mdurl 0.1.2 pypi_0 pypi
mmcv 2.0.1 pypi_0 pypi
mmdet 3.3.0 pypi_0 pypi
mmengine 0.10.3 pypi_0 pypi
mmyolo 0.6.0 pypi_0 pypi
model-index 0.1.11 pypi_0 pypi
mpmath 1.3.0 pypi_0 pypi
nes-py 8.2.1 pypi_0 pypi
networkx 3.1 pypi_0 pypi
numpy 1.24.4 pypi_0 pypi
oauthlib 3.2.2 pypi_0 pypi
opencv-python 4.9.0.80 pypi_0 pypi
opencv-python-headless 4.9.0.80 pypi_0 pypi
opendatalab 0.0.10 pypi_0 pypi
openmim 0.3.9 pypi_0 pypi
openssl 3.0.13 h2bbff1b_0 defaults
openxlab 0.0.36 pypi_0 pypi
ordered-set 4.1.0 pypi_0 pypi
oss2 2.17.0 pypi_0 pypi
packaging 24.0 pypi_0 pypi
pandas 2.0.3 pypi_0 pypi
pillow 10.2.0 pypi_0 pypi
pip 24.0 pypi_0 pypi
platformdirs 4.2.0 pypi_0 pypi
prettytable 3.10.0 pypi_0 pypi
protobuf 5.26.0 pypi_0 pypi
pyasn1 0.5.1 pypi_0 pypi
pyasn1-modules 0.3.0 pypi_0 pypi
pycocotools 2.0.7 pypi_0 pypi
pycparser 2.21 pypi_0 pypi
pycryptodome 3.20.0 pypi_0 pypi
pyglet 1.5.21 pypi_0 pypi
pygments 2.17.2 pypi_0 pypi
pynacl 1.5.0 pypi_0 pypi
pyparsing 3.1.2 pypi_0 pypi
pyquaternion 0.9.9 pypi_0 pypi
pyreadline3 3.4.1 pypi_0 pypi
python 3.8.18 h1aa4202_0 defaults
python-dateutil 2.9.0.post0 pypi_0 pypi
pytz 2023.4 pypi_0 pypi
pywavelets 1.4.1 pypi_0 pypi
pywin32 306 pypi_0 pypi
pyyaml 6.0.1 pypi_0 pypi
regex 2023.12.25 pypi_0 pypi
requests 2.28.2 pypi_0 pypi
requests-oauthlib 1.4.0 pypi_0 pypi
rich 13.4.2 pypi_0 pypi
rsa 4.9 pypi_0 pypi
scikit-image 0.21.0 pypi_0 pypi
scikit-learn 1.3.2 pypi_0 pypi
scipy 1.10.1 pypi_0 pypi
setuptools 60.2.0 pypi_0 pypi
shapely 2.0.3 pypi_0 pypi
six 1.16.0 pypi_0 pypi
sqlite 3.41.2 h2bbff1b_0 defaults
sympy 1.12 pypi_0 pypi
tabulate 0.9.0 pypi_0 pypi
tensorboard 2.14.0 pypi_0 pypi
tensorboard-data-server 0.7.2 pypi_0 pypi
termcolor 2.4.0 pypi_0 pypi
terminaltables 3.1.10 pypi_0 pypi
threadpoolctl 3.3.0 pypi_0 pypi
tifffile 2023.7.10 pypi_0 pypi
tomli 2.0.1 pypi_0 pypi
torch 1.12.1+cu113 pypi_0 pypi
torchaudio 0.12.1+cu113 pypi_0 pypi
torchvision 0.13.1+cu113 pypi_0 pypi
tqdm 4.65.2 pypi_0 pypi
typing 3.7.4.3 pypi_0 pypi
typing-extensions 4.10.0 pypi_0 pypi
tzdata 2024.1 pypi_0 pypi
urllib3 1.26.18 pypi_0 pypi
vc 14.2 h21ff451_1 defaults
vs2015_runtime 14.27.29016 h5e58377_2 defaults
wcwidth 0.2.13 pypi_0 pypi
werkzeug 3.0.1 pypi_0 pypi
wheel 0.43.0 pypi_0 pypi
yapf 0.40.2 pypi_0 pypi
zipp 3.18.1 pypi_0 pypi

Expected results

我想知道为什么推理的结果是识别不出我的类,并且我想知道cbam应该在哪个阶段使用,我在3,4阶段使用,1,2阶段不使用时效果反而出现了下降

Additional information

我仅仅添加了插件,未添加前的推理结果是可观的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant