CCNet: Criss-Cross Attention for Semantic Segmentation (TPAMI 2020 & ICCV 2019).

Overview

CCNet: Criss-Cross Attention for Semantic Segmentation

Paper Links: Our most recent TPAMI version with improvements and extensions (Earlier ICCV version).

By Zilong Huang, Xinggang Wang, Yunchao Wei, Lichao Huang, Chang Huang, Humphrey Shi, Wenyu Liu and Thomas S. Huang.

Updates

2021/02: The pure python implementation of CCNet is released in the branch pure-python. Thanks Serge-weihao.

2019/08: The new version CCNet is released on branch Pytorch-1.1 which supports Pytorch 1.0 or later and distributed multiprocessing training and testing This current code is a implementation of the experiments on Cityscapes in the CCNet ICCV version. We implement our method based on open source pytorch segmentation toolbox.

2018/12: Renew the code and release trained models with R=1,2. The trained model with R=2 achieves 79.74% on val set and 79.01% on test set with single scale testing.

2018/11: Code released.

Introduction

motivation of CCNet Long-range dependencies can capture useful contextual information to benefit visual understanding problems. In this work, we propose a Criss-Cross Network (CCNet) for obtaining such important information through a more effective and efficient way. Concretely, for each pixel, our CCNet can harvest the contextual information of its surrounding pixels on the criss-cross path through a novel criss-cross attention module. By taking a further recurrent operation, each pixel can finally capture the long-range dependencies from all pixels. Overall, our CCNet is with the following merits:

  • GPU memory friendly
  • High computational efficiency
  • The state-of-the-art performance

Architecture

Overview of CCNet Overview of the proposed CCNet for semantic segmentation. The proposed recurrent criss-cross attention takes as input feature maps H and output feature maps H'' which obtain rich and dense contextual information from all pixels. Recurrent criss-cross attention module can be unrolled into R=2 loops, in which all Criss-Cross Attention modules share parameters.

Visualization of the attention map

Overview of Attention map To get a deeper understanding of our RCCA, we visualize the learned attention masks as shown in the figure. For each input image, we select one point (green cross) and show its corresponding attention maps when R=1 and R=2 in columns 2 and 3 respectively. In the figure, only contextual information from the criss-cross path of the target point is capture when R=1. By adopting one more criss-cross module, ie, R=2 the RCCA can finally aggregate denser and richer contextual information compared with that of R=1. Besides, we observe that the attention module could capture semantic similarity and long-range dependencies.

License

CCNet is released under the MIT License (refer to the LICENSE file for details).

Citing CCNet

If you find CCNet useful in your research, please consider citing:

@article{huang2020ccnet,
  author={Huang, Zilong and Wang, Xinggang and Wei, Yunchao and Huang, Lichao and Shi, Humphrey and Liu, Wenyu and Huang, Thomas S.},
  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, 
  title={CCNet: Criss-Cross Attention for Semantic Segmentation}, 
  year={2020},
  month={},
  volume={},
  number={},
  pages={1-1},
  keywords={Semantic Segmentation;Graph Attention;Criss-Cross Network;Context Modeling},
  doi={10.1109/TPAMI.2020.3007032},
  ISSN={1939-3539}}

@article{huang2018ccnet,
    title={CCNet: Criss-Cross Attention for Semantic Segmentation},
    author={Huang, Zilong and Wang, Xinggang and Huang, Lichao and Huang, Chang and Wei, Yunchao and Liu, Wenyu},
    booktitle={ICCV},
    year={2019}}

Instructions for Code (2019/08 version):

Requirements

To install PyTorch==0.4.0 or 0.4.1, please refer to https://github.com/pytorch/pytorch#installation.
4 x 12G GPUs (e.g. TITAN XP)
Python 3.6
gcc (GCC) 4.8.5
CUDA 8.0

Compiling

# Install **Pytorch**
$ conda install pytorch torchvision -c pytorch

# Install **Apex**
$ git clone https://github.com/NVIDIA/apex
$ cd apex
$ pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

# Install **Inplace-ABN**
$ git clone https://github.com/mapillary/inplace_abn.git
$ cd inplace_abn
$ python setup.py install

Dataset and pretrained model

Plesae download cityscapes dataset and unzip the dataset into YOUR_CS_PATH.

Please download MIT imagenet pretrained resnet101-imagenet.pth, and put it into dataset folder.

Training and Evaluation

Training script.

python train.py --data-dir ${YOUR_CS_PATH} --random-mirror --random-scale --restore-from ./dataset/resnet101-imagenet.pth --gpu 0,1,2,3 --learning-rate 1e-2 --input-size 769,769 --weight-decay 1e-4 --batch-size 8 --num-steps 60000 --recurrence 2

Recommend】You can also open the OHEM flag to reduce the performance gap between val and test set.

python train.py --data-dir ${YOUR_CS_PATH} --random-mirror --random-scale --restore-from ./dataset/resnet101-imagenet.pth --gpu 0,1,2,3 --learning-rate 1e-2 --input-size 769,769 --weight-decay 1e-4 --batch-size 8 --num-steps 60000 --recurrence 2 --ohem 1 --ohem-thres 0.7 --ohem-keep 100000

Evaluation script.

python evaluate.py --data-dir ${YOUR_CS_PATH} --restore-from snapshots/CS_scenes_60000.pth --gpu 0 --recurrence 2

All in one.

./run_local.sh YOUR_CS_PATH

Models

We run CCNet with R=1,2 three times on cityscape dataset separately and report the results in the following table. Please note there exist some problems about the validation/testing set accuracy gap (1~2%). You need to run multiple times to achieve a small gap or turn on OHEM flag. Turning on OHEM flag also can improve the performance on the val set. In general, I recommend you use OHEM in training step.

We train all the models on fine training set and use the single scale for testing. The trained model with R=2 79.74 can also achieve about 79.01 mIOU on cityscape test set with single scale testing (for saving time, we use the whole image as input).

R mIOU on cityscape val set (single scale) Link
1 77.31 & 77.91 & 76.89 77.91
2 79.74 & 79.22 & 78.40 79.74
2+OHEM 78.67 & 80.00 & 79.83 80.00

Acknowledgment

We thank NSFC, ARC DECRA DE190101315, ARC DP200100938, HUST-Horizon Computer Vision ResearchCenter, and IBM-ILLINOIS Center for Cognitive ComputingSystems Research (C3SR).

Thanks to the Third Party Libs

Self-attention related methods:
Object Context Network
Dual Attention Network
Semantic segmentation toolboxs:
pytorch-segmentation-toolbox
semantic-segmentation-pytorch
PyTorch-Encoding

Comments
  • Reproduce Performance Discussion

    Reproduce Performance Discussion

    Thx for the nice job. However I downloaded the code and trained the model, but the results in the paper were not well reproduced.

    Setting

    Dataset: Cityscapes Train with train split, 2975 images. Evaluate with val split. Follow all details in this repo. Train models with different max_iterations (60000 as default setting in this repo.)

    Results in paper

    selection_001

    Result

    | model | Max Iter | mIoU | |---|---|---| | Resnet101-RCCA(R=2) | 40000 | 75.85% | | Resnet101-RCCA(R=2) | 60000 | 76.81% | | Resnet101-RCCA(R=2) | 100000 | 76.36% | | Resnet101-PSP | 40000 | 76.92% | | Resnet101-PSP | 60000 | 76.85% | | Resnet101-PSP | 100000 | 76.90% |

    Env

    pytorch 0.4.0 torchvision 0.2.1 4*TITAN XP

    Is there any tricks in the implementation?

    opened by EthanZhangYi 30
  • How to use OHEM loss function?

    How to use OHEM loss function?

    Hi, Zilong:

    Thanks for your contribution to this amazing repo! I really appreciate of this! By the way, I want to reproduce the highest score in your paper: 81.4 on Cityscapes test set.(with 4 V100 GPUs). I have already reproduced the default setting single-scale result on val set: 79.7 on my machine. To reach the 81.4, as far as I have known: besides the default settings, OHEM loss function and multi-scale inference should also be used. But when I re-train the code with setting --ohem True, the evaluation results drop a lot - about 10 points are decreased. So my problem is, what also should I modify to achieve the result as proposed in the original paper?

    Thanks a lot for your help!

    result reproduced 
    opened by qijiezhao 12
  • How to replace feature extraction network?

    How to replace feature extraction network?

    Hello, I would like to quote your RecurrentCriss-CrossAttention separately, but the main framework has CNN feature extraction, so the CNN feature extraction and segmentation module is no longer needed, but I do not know how to get independent RecurrentCriss-CrossAttention code, I hope to get your guidance.Thank you very much

    opened by 284513016 8
  • nvcc: not found

    nvcc: not found

    build.sh: 11: build.sh: nvcc: not found image hello,such problem hapeened,i have write the path in ~/.bashrc ,do you have some solution? export CUDA_HOME=/usr/local/cuda export PATH=$PATH:/usr/local/cuda-9.0/bin export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

    opened by TianMingChen 5
  • The value of gamma is set to zero?

    The value of gamma is set to zero?

    Thank you very much for the source code provided. I have some questions about the parameter settings in your code. The value of gamma is set to zero?

    class CrissCrossAttention(nn.Module): """ Pixel-wise attention module""" def init(self,in_dim): super(CrissCrossAttention,self).init() self.chanel_in = in_dim

        self.query_conv = nn.Conv2d(in_channels = in_dim , out_channels = in_dim//8 , kernel_size= 1)
        self.key_conv = nn.Conv2d(in_channels = in_dim , out_channels = in_dim//8 , kernel_size= 1)
        self.value_conv = nn.Conv2d(in_channels = in_dim , out_channels = in_dim , kernel_size= 1)
        self.gamma = nn.Parameter(torch.zeros(1))
    
    def forward(self,x):
        proj_query = self.query_conv(x)
        proj_key = self.key_conv(x)
        proj_value = self.value_conv(x)
    
        energy = ca_weight(proj_query, proj_key)
        attention = F.softmax(energy, 1)
        out = ca_map(attention, proj_value)
        out = self.gamma*out + x
    
        return out
    
    question 
    opened by HqWei 5
  • AssertionError: Default process group is not initialized

    AssertionError: Default process group is not initialized

    I have got the error below, how can i fix it?

    [00:00<?,?it/s]17 08:33:48 WRN A exception occurred during Engine initialization, give up running process Traceback (most recent call last): File "train.py", line 251, in main() File "train.py", line 226, in main loss = model(images, labels) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 152, in forward outputs = self.parallel_apply(replicas, inputs, kwargs) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 162, in parallel_apply return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)]) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/nn/parallel/parallel_apply.py", line 85, in parallel_apply output.reraise() File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/_utils.py", line 369, in reraise raise self.exc_type(msg) AssertionError: Caught AssertionError in replica 0 on device 0. Original Traceback (most recent call last): File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/nn/parallel/parallel_apply.py", line 60, in _worker output = module(*input, **kwargs) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/zmz/ccnet/networks/ccnet.py", line 189, in forward x = self.relu1(self.bn1(self.conv1(x))) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/inplace_abn-1.1.0-py3.6-linux-x86_64.egg/inplace_abn/abn.py", line 323, in forward self.group, File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/inplace_abn-1.1.0-py3.6-linux-x86_64.egg/inplace_abn/functions.py", line 307, in inplace_abn_sync group, File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/inplace_abn-1.1.0-py3.6-linux-x86_64.egg/inplace_abn/functions.py", line 91, in forward ctx.world_size = distributed.get_world_size(group=group) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/distributed/distributed_c10d.py", line 584, in get_world_size return _get_group_size(group) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/distributed/distributed_c10d.py", line 200, in _get_group_size _check_default_pg() File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/distributed/distributed_c10d.py", line 191, in _check_default_pg "Default process group is not initialized" AssertionError: Default process group is not initialized

    opened by mZhenz 4
  • AttributeError: 'NoneType' object has no attribute 'copy'

    AttributeError: 'NoneType' object has no attribute 'copy'

    Thanks for this grateful implementation. I am training cityscapes dataset. But I am facing this issue. seeking help. I will be very thankful. Regards File "/adata/Naushad/CCNet/dataset/datasets.py", line 164, in id2trainId label_copy = label.copy() AttributeError: 'NoneType' object has no attribute 'copy'

    opened by nooriahmed 4
  • AssertionError: Default process group is not initialized

    AssertionError: Default process group is not initialized

    [00:00<?,?it/s]12 15:10:26 WRN A exception occurred during Engine initialization, give up running process
    Traceback (most recent call last):
      File "evaluate.py", line 284, in <module>
        main()
      File "evaluate.py", line 247, in main
        output = predict_multiscale(model, image, input_size, [1.0], args.num_classes, False, 0)
      File "evaluate.py", line 168, in predict_multiscale
        scaled_probs = predict_sliding(net, scale_image, tile_size, classes, recurrence)
      File "evaluate.py", line 130, in predict_sliding
        padded_prediction = net(torch.from_numpy(padded_img).cuda(non_blocking=True))
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
        result = self.forward(*input, **kwargs)
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
        return self.module(*inputs[0], **kwargs[0])
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
        result = self.forward(*input, **kwargs)
      File "/home/spple/paddle/DeepGlint/CCNet-pytorch-1.1/networks/ccnet.py", line 176, in forward
        x = self.relu1(self.bn1(self.conv1(x)))
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
        result = self.forward(*input, **kwargs)
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/inplace_abn-1.0.7-py3.6-linux-x86_64.egg/inplace_abn/abn.py", line 152, in forward
        self.activation, self.activation_param, self.group)
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/inplace_abn-1.0.7-py3.6-linux-x86_64.egg/inplace_abn/functions.py", line 157, in inplace_abn_sync
        training, momentum, eps, activation, activation_param, group)
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/inplace_abn-1.0.7-py3.6-linux-x86_64.egg/inplace_abn/functions.py", line 72, in forward
        ctx.world_size = distributed.get_world_size(group=group)
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/torch/distributed/distributed_c10d.py", line 584, in get_world_size
        return _get_group_size(group)
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/torch/distributed/distributed_c10d.py", line 200, in _get_group_size
        _check_default_pg()
      File "/home/spple/anaconda3/envs/pytorch1_1_0--py3_6--cuda9_0/lib/python3.6/site-packages/torch/distributed/distributed_c10d.py", line 191, in _check_default_pg
        "Default process group is not initialized"
    AssertionError: Default process group is not initialized
    
    opened by yangninghua 3
  • Param Initialization

    Param Initialization

    Hi, thanks for sharing the code for your insightful work!

    From your code I didn't find any explicit param initialization, so do you initialize your weights using the default initialization? (which is kaiming_uniform for convolution layers)

    Thanks!

    result reproduced 
    opened by chengdazhi 3
  • rcca compile error #7

    rcca compile error #7

    I'm cuda toolkit 11.2 - ubuntu 20 / python 3.8 nightly build of pytorch.

    Linux pop-os 5.8.0-7630-generic #32~1609193707~20.10~781bb80-Ubuntu SMP Tue Jan 5 21:29:56 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Sat 06 Feb 2021 06:56:10 AEDT


    Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.


    Detected CUDA files, patching ldflags Emitting ninja build file /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/build/build.ninja... Building extension module rcca... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/2] c++ -MMD -MF lib_cffi.o.d -DTORCH_EXTENSION_NAME=rcca -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.2/include -isystem /home/jp/miniconda3/envs/torch/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -O3 -c /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp -o lib_cffi.o FAILED: lib_cffi.o c++ -MMD -MF lib_cffi.o.d -DTORCH_EXTENSION_NAME=rcca -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.2/include -isystem /home/jp/miniconda3/envs/torch/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -O3 -c /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp -o lib_cffi.o /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp: In function ‘int ca_forward_cuda(const at::Tensor&, const at::Tensor&, at::Tensor&)’: /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:10:25: error: ‘THCState_getCurrentStream’ was not declared in this scope 10 | cudaStream_t stream = THCState_getCurrentStream(state); | ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:13:34: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 13 | float * t_data = t.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:14:34: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 14 | float * f_data = f.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:15:44: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 15 | float * weight_data = weight.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp: In function ‘int ca_backward_cuda(const at::Tensor&, const at::Tensor&, const at::Tensor&, at::Tensor&, at::Tensor&)’: /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:21:25: error: ‘THCState_getCurrentStream’ was not declared in this scope 21 | cudaStream_t stream = THCState_getCurrentStream(state); | ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:24:34: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 24 | float * t_data = t.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:25:34: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 25 | float * f_data = f.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:26:36: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 26 | float * dt_data = dt.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:27:36: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 27 | float * df_data = df.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:28:36: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 28 | float * dw_data = dw.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp: In function ‘int ca_map_forward_cuda(const at::Tensor&, const at::Tensor&, at::Tensor&)’: /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:33:25: error: ‘THCState_getCurrentStream’ was not declared in this scope 33 | cudaStream_t stream = THCState_getCurrentStream(state); | ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:38:49: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 38 | const float weight_data = weight.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:39:39: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 39 | const float g_data = g.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:40:37: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 40 | float out_data = out.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp: In function ‘int ca_map_backward_cuda(const at::Tensor&, const at::Tensor&, const at::Tensor&, at::Tensor&, at::Tensor&)’: /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:47:25: error: ‘THCState_getCurrentStream’ was not declared in this scope 47 | cudaStream_t stream = THCState_getCurrentStream(state); | ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:52:45: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 52 | const float dout_data = dout.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:53:49: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 53 | const float weight_data = weight.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:54:39: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 54 | const float g_data = g.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:55:35: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 55 | float dw_data = dw.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:56:35: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] 56 | float *dg_data = dg.data(); | ^ In file included from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:2, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensorApply.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH/THTensor.h:5, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THCTensor.h:4, from /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC/THC.h:13, from /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:3: /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here 363 | T * data() const { | ^~~~ ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1533, in _run_ninja_build subprocess.run( File "/home/jp/miniconda3/envs/torch/lib/python3.8/subprocess.py", line 512, in run raise CalledProcessError(retcode, process.args, 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 "train.py", line 17, in import networks File "/home/jp/Documents/gitWorkspace/CCNet-1/networks/init.py", line 3, in import networks.ccnet File "/home/jp/Documents/gitWorkspace/CCNet-1/networks/ccnet.py", line 13, in from cc_attention import CrissCrossAttention File "/home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/init.py", line 1, in from .functions import CrissCrossAttention, ca_weight, ca_map File "/home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/functions.py", line 16, in rcca = load(name="rcca", File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 986, in load return _jit_compile( File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1193, in _jit_compile _write_ninja_file_and_build_library( File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1297, in _write_ninja_file_and_build_library _run_ninja_build( File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1555, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error building extension 'rcca' Loading extension module rcca... Traceback (most recent call last): File "train.py", line 17, in import networks File "/home/jp/Documents/gitWorkspace/CCNet-1/networks/init.py", line 3, in import networks.ccnet File "/home/jp/Documents/gitWorkspace/CCNet-1/networks/ccnet.py", line 13, in from cc_attention import CrissCrossAttention File "/home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/init.py", line 1, in from .functions import CrissCrossAttention, ca_weight, ca_map File "/home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/functions.py", line 16, in rcca = load(name="rcca", File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 986, in load return _jit_compile( File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1213, in _jit_compile return _import_module_from_library(name, build_directory, is_python_module) File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1560, in _import_module_from_library Loading extension module rcca... Traceback (most recent call last): file, path, description = imp.find_module(module_name, [path]) File "train.py", line 17, in File "/home/jp/miniconda3/envs/torch/lib/python3.8/imp.py", line 296, in find_module import networks raise ImportError(_ERR_MSG.format(name), name=name) File "/home/jp/Documents/gitWorkspace/CCNet-1/networks/init.py", line 3, in ImportError: No module named 'rcca'import networks.ccnet

    File "/home/jp/Documents/gitWorkspace/CCNet-1/networks/ccnet.py", line 13, in from cc_attention import CrissCrossAttention File "/home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/init.py", line 1, in from .functions import CrissCrossAttention, ca_weight, ca_map File "/home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/functions.py", line 16, in rcca = load(name="rcca", File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 986, in load return _jit_compile( File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1213, in _jit_compile return _import_module_from_library(name, build_directory, is_python_module) File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1560, in _import_module_from_library Loading extension module rcca... file, path, description = imp.find_module(module_name, [path]) File "/home/jp/miniconda3/envs/torch/lib/python3.8/imp.py", line 296, in find_module raise ImportError(_ERR_MSG.format(name), name=name) ImportError: No module named 'rcca' Traceback (most recent call last): File "train.py", line 17, in import networks File "/home/jp/Documents/gitWorkspace/CCNet-1/networks/init.py", line 3, in import networks.ccnet File "/home/jp/Documents/gitWorkspace/CCNet-1/networks/ccnet.py", line 13, in from cc_attention import CrissCrossAttention File "/home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/init.py", line 1, in from .functions import CrissCrossAttention, ca_weight, ca_map File "/home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/functions.py", line 16, in rcca = load(name="rcca", File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 986, in load return _jit_compile( File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1213, in _jit_compile return _import_module_from_library(name, build_directory, is_python_module) File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1560, in _import_module_from_library file, path, description = imp.find_module(module_name, [path]) File "/home/jp/miniconda3/envs/torch/lib/python3.8/imp.py", line 296, in find_module raise ImportError(_ERR_MSG.format(name), name=name) ImportError: No module named 'rcca' Traceback (most recent call last): File "/home/jp/miniconda3/envs/torch/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/jp/miniconda3/envs/torch/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/distributed/launch.py", line 260, in main() File "/home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/distributed/launch.py", line 255, in main raise subprocess.CalledProcessError(returncode=process.returncode, subprocess.CalledProcessError: Command '['/home/jp/miniconda3/envs/torch/bin/python', '-u', 'train.py', '--local_rank=3', '--data-dir', '--model', '--random-mirror', '--random-scale', '--restore-from', './dataset/resnet101-imagenet.pth', '--input-size', '--gpu', '0,1,2,3', '--learning-rate', '1e-2', '--weight-decay', '5e-4', '--batch-size', '8', '--num-steps', '--ohem']' returned non-zero exit status 1.


    Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.


    Detected CUDA files, patching ldflags Emitting ninja build file /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/build/build.ninja... Building extension module rcca... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/2] c++ -MMD -MF lib_cffi.o.d -DTORCH_EXTENSION_NAME=rcca -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.2/include -isystem /home/jp/miniconda3/envs/torch/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -O3 -c /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp -o lib_cffi.o FAILED: lib_cffi.o c++ -MMD -MF lib_cffi.o.d -DTORCH_EXTENSION_NAME=rcca -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/TH -isystem /home/jp/miniconda3/envs/torch/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda-11.2/include -isystem /home/jp/miniconda3/envs/torch/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -O3 -c /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp -o lib_cffi.o /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp: In function ‘int ca_forward_cuda(const at::Tensor&, const at::Tensor&, at::Tensor&)’: /home/jp/Documents/gitWorkspace/CCNet-1/cc_attention/src/lib_cffi.cpp:10:25: error: ‘THCState_getCurrentStream’ was not declared in this scope 10 | cudaStream_t stream = THCState_getCurrentStream(state);

    opened by johndpope 2
  • Training speed slower  than Non-local attention

    Training speed slower than Non-local attention

    I found add a module of Non-local attention which just add a little extra time cost about 0.4s each iter. But if I add a CC-attention take R==1 , the train time each iter about 0.7s, and 1.0s if R==2. It's not like the description in your paper. I dont know why. Can anyone explain it .

    opened by noobliang 2
  • Inplace-ABN does not work

    Inplace-ABN does not work

    I follow your step like this: git clone https://github.com/mapillary/inplace_abn.git $ cd inplace_abn $ python setup.py install File "/public/home/cxj123456/anaconda3/envs/tcx/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1354, in _write_ninja_file_and_compile_objects _run_ninja_build( File "/public/home/cxj123456/anaconda3/envs/tcx/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1683, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension errors happened,but I don't know how to install it correctly.thanks

    opened by chunxt 0
  • about INF

    about INF

    excuse me . Is there an another method? the torch.diag methon isn't supported by onnx version and when i use torch.eye ,my tensorrt doesn‘t support it either.

    opened by Thatboy7 1
  • Some questions about 'Criss-Cross Attention'

    Some questions about 'Criss-Cross Attention'

    ** image I have some questions about 'Criss-Cross Attention'. Here should be C×W×H or C×H×W in the place marked by the red circle?

    image At the same time, I have some questions about Affinity. Which variables corresponds to the codes in the place marked by the blue line,proj_query_H and proj_key_H , or proj_query_W and proj_key_W? I don’t understand the definition of Qu and Ωu very well. Is it convenient for you to answer? Looking forward to your answer, thank you very much!

    opened by yiyi-today 2
Owner
Zilong Huang
HUSTer
Zilong Huang
Deep Learning for 3D Point Clouds: A Survey (IEEE TPAMI, 2020)

??Deep Learning for 3D Point Clouds (IEEE TPAMI, 2020)

Qingyong 1.4k Jan 8, 2023
🔥RandLA-Net in Tensorflow (CVPR 2020, Oral & IEEE TPAMI 2021)

RandLA-Net: Efficient Semantic Segmentation of Large-Scale Point Clouds (CVPR 2020) This is the official implementation of RandLA-Net (CVPR2020, Oral

Qingyong 1k Dec 30, 2022
PFENet: Prior Guided Feature Enrichment Network for Few-shot Segmentation (TPAMI).

PFENet This is the implementation of our paper PFENet: Prior Guided Feature Enrichment Network for Few-shot Segmentation that has been accepted to IEE

DV Lab 230 Dec 31, 2022
Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation)

Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation) Download Synthia dataset The model uses

null 32 Sep 21, 2022
Adaptive Pyramid Context Network for Semantic Segmentation (APCNet CVPR'2019)

Adaptive Pyramid Context Network for Semantic Segmentation (APCNet CVPR'2019) Introduction Official implementation of Adaptive Pyramid Context Network

null 21 Nov 9, 2022
(ImageNet pretrained models) The official pytorch implemention of the TPAMI paper "Res2Net: A New Multi-scale Backbone Architecture"

Res2Net The official pytorch implemention of the paper "Res2Net: A New Multi-scale Backbone Architecture" Our paper is accepted by IEEE Transactions o

Res2Net Applications 928 Dec 29, 2022
DVG-Face: Dual Variational Generation for Heterogeneous Face Recognition, TPAMI 2021

DVG-Face: Dual Variational Generation for HFR This repo is a PyTorch implementation of DVG-Face: Dual Variational Generation for Heterogeneous Face Re

null 52 Dec 30, 2022
The PyTorch improved version of TPAMI 2017 paper: Face Alignment in Full Pose Range: A 3D Total Solution.

Face Alignment in Full Pose Range: A 3D Total Solution By Jianzhu Guo. [Updates] 2020.8.30: The pre-trained model and code of ECCV-20 are made public

Jianzhu Guo 3.4k Jan 2, 2023
This is the pytorch implementation for the paper: *Learning Accurate Performance Predictors for Ultrafast Automated Model Compression*, which is in submission to TPAMI

SeerNet This is the pytorch implementation for the paper: Learning Accurate Performance Predictors for Ultrafast Automated Model Compression, which is

null 3 May 1, 2022
[TPAMI 2021] iOD: Incremental Object Detection via Meta-Learning

Incremental Object Detection via Meta-Learning To appear in an upcoming issue of the IEEE Transactions on Pattern Analysis and Machine Intelligence (T

Joseph K J 66 Jan 4, 2023
Implementation of CVPR 2020 Dual Super-Resolution Learning for Semantic Segmentation

Dual super-resolution learning for semantic segmentation 2021-01-02 Subpixel Update Happy new year! The 2020-12-29 update of SISR with subpixel conv p

Sam 79 Nov 24, 2022
Exploring Cross-Image Pixel Contrast for Semantic Segmentation

Exploring Cross-Image Pixel Contrast for Semantic Segmentation Exploring Cross-Image Pixel Contrast for Semantic Segmentation, Wenguan Wang, Tianfei Z

Tianfei Zhou 510 Jan 2, 2023
[CVPR 2021] Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision

TorchSemiSeg [CVPR 2021] Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision by Xiaokang Chen1, Yuhui Yuan2, Gang Zeng1, Jingdong Wang

Chen XiaoKang 387 Jan 8, 2023
An official implementation of "Exploiting a Joint Embedding Space for Generalized Zero-Shot Semantic Segmentation" (ICCV 2021) in PyTorch.

Exploiting a Joint Embedding Space for Generalized Zero-Shot Semantic Segmentation This is an official implementation of the paper "Exploiting a Joint

CV Lab @ Yonsei University 35 Oct 26, 2022
Code for the ICCV 2021 Workshop paper: A Unified Efficient Pyramid Transformer for Semantic Segmentation.

Unified-EPT Code for the ICCV 2021 Workshop paper: A Unified Efficient Pyramid Transformer for Semantic Segmentation. Installation Linux, CUDA>=10.0,

null 29 Aug 23, 2022
[ICCV 2021] A Simple Baseline for Semi-supervised Semantic Segmentation with Strong Data Augmentation

[ICCV 2021] A Simple Baseline for Semi-supervised Semantic Segmentation with Strong Data Augmentation

CodingMan 45 Dec 12, 2022
《Deep Single Portrait Image Relighting》(ICCV 2019)

Ratio Image Based Rendering for Deep Single-Image Portrait Relighting [Project Page] This is part of the Deep Portrait Relighting project. If you find

null 62 Dec 21, 2022
This Repo is the official CUDA implementation of ICCV 2019 Oral paper for CARAFE: Content-Aware ReAssembly of FEatures

Introduction This Repo is the official CUDA implementation of ICCV 2019 Oral paper for CARAFE: Content-Aware ReAssembly of FEatures. @inproceedings{Wa

Jiaqi Wang 42 Jan 7, 2023
A Fast and Accurate One-Stage Approach to Visual Grounding, ICCV 2019 (Oral)

One-Stage Visual Grounding ***** New: Our recent work on One-stage VG is available at ReSC.***** A Fast and Accurate One-Stage Approach to Visual Grou

Zhengyuan Yang 118 Dec 5, 2022