Giter VIP home page Giter VIP logo

dynamichead's Introduction

Dynamic Head: Unifying Object Detection Heads with Attentions

PWC PWC

dyhead_video.mp4

This is the official implementation of CVPR 2021 paper "Dynamic Head: Unifying Object Detection Heads with Attentions".

"In this paper, we present a novel dynamic head framework to unify object detection heads with attentions. By coherently combining multiple self-attention mechanisms between feature levels for scale-awareness, among spatial locations for spatial-awareness, and within output channels for task-awareness, the proposed approach significantly improves the representation ability of object detection heads without any computational overhead."

Dynamic Head: Unifying Object Detection Heads With Attentions

Xiyang Dai, Yinpeng Chen, Bin Xiao, Dongdong Chen, Mengchen Liu, Lu Yuan, Lei Zhang

Model Zoo

Code and Model are under internal review and will release soon. Stay tuned!

In order to open-source, we have ported the implementation from our internal framework to Detectron2 and re-train the models.

We notice better performances on some models compared to original paper.

Config Model Backbone Scheduler COCO mAP Weight
cfg FasterRCNN + DyHead R50 1x 40.3 weight
cfg RetinaNet + DyHead R50 1x 39.9 weight
cfg ATSS + DyHead R50 1x 42.4 weight
cfg ATSS + DyHead Swin-Tiny 2x + ms 49.8 weight

Usage

Dependencies:

Detectron2, timm

Installation:

python -m pip install -e DynamicHead

Train:

To train a config on a single node with 8 gpus, simply use:

DETECTRON2_DATASETS=$DATASET python train_net.py --config configs/dyhead_r50_retina_fpn_1x.yaml --num-gpus 8

Test:

To test a config with a weight on a single node with 8 gpus, simply use:

DETECTRON2_DATASETS=$DATASET python train_net.py --config configs/dyhead_r50_retina_fpn_1x.yaml --num-gpus 8 --eval-only MODEL.WEIGHTS $WEIGHT

Citation

@InProceedings{Dai_2021_CVPR,
    author    = {Dai, Xiyang and Chen, Yinpeng and Xiao, Bin and Chen, Dongdong and Liu, Mengchen and Yuan, Lu and Zhang, Lei},
    title     = {Dynamic Head: Unifying Object Detection Heads With Attentions},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2021},
    pages     = {7373-7382}
}

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

dynamichead's People

Contributors

microsoft-github-policy-service[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dynamichead's Issues

ModuleNotFoundError: No module named 'dyhead._C'

Thanks for sharing your great work!But I encountered this error for a long time and can't solve it.
Traceback (most recent call last): File "train_net.py", line 33, in <module> from dyhead import add_dyhead_config File "/user-data/DynamicHead-master/dyhead/__init__.py", line 2, in <module> from .dyhead import DyHead File "/user-data/DynamicHead-master/dyhead/dyhead.py", line 7, in <module> from .deform import ModulatedDeformConv File "/user-data/DynamicHead-master/dyhead/deform.py", line 8, in <module> import dyhead._C as _C ModuleNotFoundError: No module named 'dyhead._C'

errors happened with optimizer

I have tried 2 different configs with diferent backbones, but all occurs exception of one thing, that is weight_decay is NoneType in optimizer SGD and ADAMW. It seems the configs of WEIGHT_DECAY is not imported correctly?

Wrong behavior of modulated convolutions line 71-72

Hi,
First, thank you for your work!
I tried to train a network on my side and I feel like some modulated convolutions are not working as intended regarding the following code:
temp_fea.append(F.upsample_bilinear(self.DyConv[0](x[feature_names[level + 1]], **conv_args), size=[feature.size(2), feature.size(3)])) (l.71-72 of dyhead.py)
When running this line, the modulated conv receives an input which is four times smaller than the offset and mask (twice shorter on H and W dimensions).
As there is no "assert" on the shape of the inputs, the code runs fine but what is being computed is not really what you expect: the offset and the mask are flattened and only the first quarter of the vector is being used.
This leads to a huge shifting in the computation of the output of the modulated convolution.
To "fix" the issue, I think that the upsample_bilinear() should be applied on x[featurenames[level + 1]] and not the output of the layer.
Hope it helps.

model change

Excuse me,could you tell how to apply this module to YOLOv4? If so, do we need to modify the loss function? Thanks for your answer very much!

train Dynamichead

How can I train Dynamichead without using the backbone network, As the training process of the table below
image

Missing the code of scale-aware and task-aware block?

Thank you for sharing the code! I'm seeking for details about scale-aware, spatial-aware and task-aware blocks in the source code. However, as i can see in the source code "dyhead/dyhead.py", there only exists the implementation of spatial-aware block.
Is this a mistake or my misunderstanding?

DynamicHead/dyhead/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIdEEPKNS_6detail12TypeMetaDataEv

Hello, when I run the train_net.py, I encountered this error:
ImportError: XX/Code/DynamicHead/dyhead/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIdEEPKNS_6detail12TypeMetaDataEv,

It caused by "import dyhead._C as _C", I tried change the torch and torchvision version, but it not works.
May you find the solution?

how to change dataset

I want to know how to change my dataset. Can you tell me where to modify it? I've changed the dataset to coco format

No module named "_C"

Thanks for sharing your great work! But I got a "No module issue" when i run your Code. It occurs in deform.py ,
line 8:
"import dyhead._C as _C".

Is pi_s and pi_l in reversed order?

In figure 2(a) of the paper, the is after , but in the code, it seems that the space scale-aware attention is applied after the deformable conv. Is this correct?

do all channel features share same (alpha_1, beta_1, alpha_2, beta_2)?

Hi, Sir,
At equation 5, it seems we only have a set of (alpha_1, beta_1, alpha_2, beta_2). Dose it tell us all channel features slide work with same activation?

Is it possible to set (alpha_1_c1, beta_1_c1, alpha_2_c1, beta_2_c1) for channel 1, (alpha_1_c2, beta_1_c2, alpha_2_c2, beta_2_c2) for channel 2... refer to dynamic relu fig. 2-b?

looking forward to having your answer soon.

Thanks,
Patrick

Question about Equation (4)

In Equation 4 in your paper, you specify an equation for the spatial-aware attention module which averages across the levels of the rescaled spatial pyramid. It appears this equation would map an element of R^(LxSxC) to R^(SxC). Is this intended? How do you apply multiple DyHead modules after this stage, if the L axis is collapsed?

ATSS

Hi, thanks for your wonderful work! I have a question that In the ATSS, It uses three scales for prediction, If I want to apply Dynamic head to ATSS, the final prediction scale is one?

Can I get Swin-L config file?

Hi.
Thanks for your interesting idea.

I'm using swin-tiny for object detection.
But I wanna use Swin-Large.

I'm sorry but can I get Swin-Large config plz?

Thank you.

Is the code for DyHeader?

I do not find the code for the following description

Given a concatenation of features Fin = fFigL i=1 from
L different levels in a feature pyramid, we can resize consecutive
level features towards the scale of the median level
feature using up-sampling or down-sampling. The re-scaled
feature pyramid can be denoted as a 4-dimensional tensor
F 2 RL�H�W�C, where L represents the number of levels
in the pyramid, H, W, and C represent height, width,
and the number of channels of the median level feature respectively.

python -m pip install -e DynamicHead

Hi, when I execute this sentence, an error occurs with DynamicHead.
ERROR: DynamicHead is not a valid editable requirement. It should either be a path to a local p
roject or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bz
r+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http,
hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).

cuda 11.1 fail?

1、nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Tue_Sep_15_19:10:02_PDT_2020
Cuda compilation tools, release 11.1, V11.1.74
Build cuda_11.1.TC455_06.29069683_0

2、pip list
Package Version Location


detectron2 0.6+cu111
torch 1.10.1+cu111
torchaudio 0.10.1+rocm4.1
torchvision 0.11.2+cu111
tqdm 4.63.1

3、log:
sda/okay/ai/project/ocrquesseg-svr/detectron2/detectron2/structures/boxes.py:158: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at ../torch/csrc/utils/tensor_new.cpp:201.)
tensor = torch.as_tensor(tensor, dtype=torch.float32, device=device)
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/nn/functional.py:3847: UserWarning: nn.functional.upsample_bilinear is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.functional.upsample_bilinear is deprecated. Use nn.functional.interpolate instead.")
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device

error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
error in modulated_deformable_im2col_cuda: no kernel image is available for execution on the device
THCudaCheck FAIL file=/sda/okay/ai/project/ocrquesseg-svr/dyhead/csrc/cuda/SigmoidFocalLoss_cuda.cu line=139 error=209 : no kernel image is available for execution on the device
ERROR [04/01 18:08:11 d2.engine.train_loop]: Exception during training:
Traceback (most recent call last):
File "/sda/okay/ai/project/ocrquesseg-svr/detectron2/detectron2/engine/train_loop.py", line 149, in train
self.run_step()
File "/sda/okay/ai/project/ocrquesseg-svr/detectron2/detectron2/engine/defaults.py", line 499, in run_step
self._trainer.run_step()
File "/sda/okay/ai/project/ocrquesseg-svr/detectron2/detectron2/engine/train_loop.py", line 273, in run_step
loss_dict = self.model(data)
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/atss.py", line 204, in forward
losses = self.losses(anchors, pred_logits, gt_labels, pred_anchor_deltas, gt_boxes, pred_centers)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/atss.py", line 236, in losses
cls_loss = self.classification_loss_func(box_cls_flatten, labels_flatten.int()) / num_pos_avg_per_gpu
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/sigmoid_focal_loss.py", line 48, in forward
loss = sigmoid_focal_loss_cuda(logits, targets, self.gamma, self.alpha)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/sigmoid_focal_loss.py", line 20, in forward
logits, targets, num_classes, gamma, alpha
RuntimeError: cuda runtime error (209) : no kernel image is available for execution on the device at /sda/okay/ai/project/ocrquesseg-svr/dyhead/csrc/cuda/SigmoidFocalLoss_cuda.cu:139
[04/01 18:08:11 d2.engine.hooks]: Total training time: 0:00:00 (0:00:00 on hooks)
[04/01 18:08:11 d2.utils.events]: iter: 0 lr: N/A max_mem: 6574M
Traceback (most recent call last):
File "train_net.py", line 224, in
args=(args,),
File "/sda/okay/ai/project/ocrquesseg-svr/detectron2/detectron2/engine/launch.py", line 82, in launch
main_func(*args)
File "train_net.py", line 210, in main
return trainer.train()
File "/sda/okay/ai/project/ocrquesseg-svr/detectron2/detectron2/engine/defaults.py", line 489, in train
super().train(self.start_iter, self.max_iter)
File "/sda/okay/ai/project/ocrquesseg-svr/detectron2/detectron2/engine/train_loop.py", line 149, in train
self.run_step()
File "/sda/okay/ai/project/ocrquesseg-svr/detectron2/detectron2/engine/defaults.py", line 499, in run_step
self._trainer.run_step()
File "/sda/okay/ai/project/ocrquesseg-svr/detectron2/detectron2/engine/train_loop.py", line 273, in run_step
loss_dict = self.model(data)
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/atss.py", line 204, in forward
losses = self.losses(anchors, pred_logits, gt_labels, pred_anchor_deltas, gt_boxes, pred_centers)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/atss.py", line 236, in losses
cls_loss = self.classification_loss_func(box_cls_flatten, labels_flatten.int()) / num_pos_avg_per_gpu
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/sigmoid_focal_loss.py", line 48, in forward
loss = sigmoid_focal_loss_cuda(logits, targets, self.gamma, self.alpha)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/sigmoid_focal_loss.py", line 20, in forward
logits, targets, num_classes, gamma, alpha
RuntimeError: cuda runtime error (209) : no kernel image is available for execution on the device at /sda/okay/ai/project/ocrquesseg-svr/dyhead/csrc/cuda/SigmoidFocalLoss_cuda.cu:139

TypeError: add(): argument 'alpha' must be Number, not NoneType

I was trying to run the repo DynamicHead and trying to run the model with a custom dataset and have the following error. In the repo the launch function is called and I get these errors.

The command I run was

DETECTRON2_DATASETS=$DATASET python train_net.py --config configs/dyhead_r50_retina_fpn_1x.yaml --num-gpus 8

Logs

Traceback (most recent call last):
  File "train_net_custom.py", line 222, in <module>
    launch(
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/launch.py", line 82, in launch
    main_func(*args)
  File "train_net_custom.py", line 216, in main
    return trainer.train()
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 484, in train
    super().train(self.start_iter, self.max_iter)
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/train_loop.py", line 149, in train
    self.run_step()
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 494, in run_step
    self._trainer.run_step()
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/train_loop.py", line 294, in run_step
    self.optimizer.step()
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/optim/lr_scheduler.py", line 65, in wrapper
    return wrapped(*args, **kwargs)
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/optim/optimizer.py", line 89, in wrapper
    return func(*args, **kwargs)
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/optim/sgd.py", line 110, in step
    F.sgd(params_with_grad,
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/optim/_functional.py", line 160, in sgd
    d_p = d_p.add(param, alpha=weight_decay)
TypeError: add(): argument 'alpha' must be Number, not NoneType

Detectron2 version: 0.6

Expected behaviour is the training loop runs without error.

Defining Spatial-aware Attention Layer error

when running this line of code
spatial_output = spatial_layer(scale_output)

I got this error
~\AppData\Local\Continuum\anaconda3\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
725 result = self._slow_forward(*input, **kwargs)
726 else:
--> 727 result = self.forward(*input, **kwargs)
728 for hook in itertools.chain(
729 _global_forward_hooks.values(),

TypeError: forward() takes 3 positional arguments but 4 were given

cuda11.1 train fail?

Traceback (most recent call last):
File "train_net.py", line 224, in
args=(args,),
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/engine/launch.py", line 82, in launch
main_func(*args)
File "train_net.py", line 210, in main
return trainer.train()
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/engine/defaults.py", line 484, in train
super().train(self.start_iter, self.max_iter)
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/engine/train_loop.py", line 149, in train
self.run_step()
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/engine/defaults.py", line 494, in run_step
self._trainer.run_step()
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/engine/train_loop.py", line 273, in run_step
loss_dict = self.model(data)
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/atss.py", line 204, in forward
losses = self.losses(anchors, pred_logits, gt_labels, pred_anchor_deltas, gt_boxes, pred_centers)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/atss.py", line 236, in losses
cls_loss = self.classification_loss_func(box_cls_flatten, labels_flatten.int()) / num_pos_avg_per_gpu
File "/sda/program/anaconda3/envs/detectron2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/sigmoid_focal_loss.py", line 48, in forward
loss = sigmoid_focal_loss_cuda(logits, targets, self.gamma, self.alpha)
File "/sda/okay/ai/project/ocrquesseg-svr/extra/sigmoid_focal_loss.py", line 20, in forward
logits, targets, num_classes, gamma, alpha
RuntimeError: cuda runtime error (209) : no kernel image is available for execution on the device at /sda/okay/ai/project/ocrquesseg-svr/dyhead/csrc/cuda/SigmoidFocalLoss_cuda.cu:139

No detected instances

I am trying to train resnet50-dyhead, but after 180000 steps, the loss is not reduce and there are not dectected instances in test images.
why? How to train dyhead?

Failed install with `python -m pip install -e DynamicHead`

Installing collected packages: dyhead
  Running setup.py develop for dyhead
    ERROR: Command errored out with exit status 1:
     command: /public/home/hpc2/anaconda3/envs/mask/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/public/home/hpc2/rpc/DynamicHead/setup.py'"'"'; __file__='"'"'/public/home/hpc2/rpc/DynamicHead/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: /public/home/hpc2/rpc/DynamicHead/
    Complete output (71 lines):
    which: no nvcc in (/public/home/hpc2/anaconda3/envs/mask/bin:/public/home/hpc2/anaconda3/condabin:/usr/lib64/qt-3.3/bin:/public/home/hpc2/perl5/bin:/public/software/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibutils/bin:/public/home/hpc2/.local/bin:/public/home/hpc204712181/bin)
    running develop
    running egg_info
    writing dyhead.egg-info/PKG-INFO
    writing dependency_links to dyhead.egg-info/dependency_links.txt
    writing top-level names to dyhead.egg-info/top_level.txt
    reading manifest file 'dyhead.egg-info/SOURCES.txt'
    writing manifest file 'dyhead.egg-info/SOURCES.txt'
    running build_ext
    building 'dyhead._C' extension
    gcc -pthread -B /public/home/hpc2/anaconda3/envs/mask/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/public/home/hpc2/rpc/DynamicHead/dyhead/csrc -I/public/home/hpc2/anaconda3/envs/mask/lib/python3.7/site-packages/torch/include -I/public/home/hpc2/anaconda3/envs/mask/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/public/home/hpc2/anaconda3/envs/mask/lib/python3.7/site-packages/torch/include/TH -I/public/home/hpc2/anaconda3/envs/mask/lib/python3.7/site-packages/torch/include/THC -I/public/home/hpc2/anaconda3/envs/mask/include/python3.7m -c /public/home/hpc2/rpc/DynamicHead/dyhead/csrc/vision.cpp -o build/temp.linux-x86_64-3.7/public/home/hpc204712181/rpc/DynamicHead/dyhead/csrc/vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    In file included from /public/home/hpc204712181/rpc/DynamicHead/dyhead/csrc/vision.cpp:2:0:
    /public/home/hpc2/rpc/DynamicHead/dyhead/csrc/deform_conv.h:10:5: error: ‘at’ has not been declared
         at::Tensor input,
         ^
    /public/home/hpc2/rpc/DynamicHead/dyhead/csrc/deform_conv.h:11:5: error: ‘at’ has not been declared
         at::Tensor weight,
         ^

error: command 'gcc' failed with exit status 1
Error seems that at::Tensor can't be recognized, how to solve this problem?
My gcc version is 5.4.0

MaskRCNN + DynamicHead

We implement your Dynamichead with MaskRCNN-r50 on mmdetection. results are worse than maskrcnn, and it took almost twice as long.

Performance when L = 1

Hi, thanks for your nice work.

I am wondering the performance of DynamicHead when the number of levels in the pyramid is one (non-pyramid structure). Thanks

Best,
Xinge

Model train execution fails with a PyTorch error message.

Hello,
I would like to ask if anyone is facing the below issue:
TypeError: add(): argument 'alpha' must be Number, not NoneType

The steps I followed are:

  1. python -m pip install -e DynamicHead.
  2. Added custom dataset using register_coco_instance
  3. Update config in def setup(args) with custom dataset name and the number of classes:
    cfg.DATASETS.TRAIN = ('coco_docbank_train',) cfg.MODEL.ROI_HEADS.NUM_CLASSES = 13
  4. Run the model:
    python train_net.py --config configs/dyhead_r50_rcnn_fpn_1x.yaml --num-gpus 1.

The detailed error message goes like this:

File "train_net.py", line 204, in <module> 
    launch(
  File "/opt/conda/lib/python3.8/site-packages/detectron2/engine/launch.py", line 82, in launch
    main_func(*args)
  File "train_net.py", line 198, in main
    return trainer.train()
  File "/opt/conda/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 484, in train
    super().train(self.start_iter, self.max_iter)
  File "/opt/conda/lib/python3.8/site-packages/detectron2/engine/train_loop.py", line 149, in train
    self.run_step()
  File "/opt/conda/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 494, in run_step
    self._trainer.run_step()
  File "/opt/conda/lib/python3.8/site-packages/detectron2/engine/train_loop.py", line 294, in run_step
    self.optimizer.step()
  File "/opt/conda/lib/python3.8/site-packages/torch/optim/lr_scheduler.py", line 65, in wrapper
    return wrapped(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch/optim/optimizer.py", line 88, in wrapper
    return func(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/torch/optim/sgd.py", line 136, in step
    F.sgd(params_with_grad,
  File "/opt/conda/lib/python3.8/site-packages/torch/optim/_functional.py", line 164, in sgd
    d_p = d_p.add(param, alpha=weight_decay)
TypeError: add(): argument 'alpha' must be Number, not NoneType

Environment Details:
sys.platform = linux
Python = 3.8.12
numpy = 1.21.2
detectron2 = 0.6
CUDA = 11.4
PyTorch = 1.10.0
torchvision = 0.11.0a0
fvcore = 0.1.5.post20211023
iopath = 0.1.9
cv2 = 4.5.4

Kindly request for assistance if you are aware of the solution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.