speedinghzl / CCNet

CCNet: Criss-Cross Attention for Semantic Segmentation (TPAMI 2020 & ICCV 2019).
MIT License
1.42k stars 277 forks source link

build.py issue #49

Open ginobilinie opened 4 years ago

ginobilinie commented 4 years ago

Hi, thanks for the great work and code.

When I try to build the code, the build.sh is fine but when I run the build.py, an error occurs: "ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead."

I'm currently using pytorch 1.2.0. Can you please let me know some solution for this problem? I have searched some solutions but all of them failed.

Thanks.

speedinghzl commented 4 years ago

The master branch requires pytorch==0.4.1, maybe you can try the Pytorch-1.1 branch.

Fly-dream12 commented 4 years ago

There is no corresponding libs for bn module as the RCCA module is compiled.

In network/cc_net.py from inplace_abn import InPlaceABN, InPlaceABNSync This line may run into an error. @ speedinghzl

speedinghzl commented 4 years ago

@Fly-dream12 You need install inplace_abn package. Please refer to ReadMe.

ginobilinie commented 4 years ago

Thanks. @speedinghzl

cauivy commented 4 years ago

@speedinghzl Hello! I configured my conda-env with python3.7.1 and pytorch1.11. After complied according to https://github.com/speedinghzl/CCNet/tree/pytorch-1.1#requirements, I still got the error: from torch.utils.ffi import _wrap_function raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.") ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.

Do you have any idea about this? Thank you!

cauivy commented 4 years ago

Hi, thanks for the great work and code.

When I try to build the code, the build.sh is fine but when I run the build.py, an error occurs: "ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead."

I'm currently using pytorch 1.2.0. Can you please let me know some solution for this problem? I have searched some solutions but all of them failed.

Thanks. @ginobilinie Hi, I got the same problem with pytorch1.11. Did you solve the problem?

speedinghzl commented 4 years ago

@cauivy You do not have to compile cc_attention if you are using the Pytorch-1.1 branch.

cauivy commented 4 years ago

@cauivy You do not have to compile cc_attention if you are using the Pytorch-1.1 branch.

@speedinghzl Thanks for your reply! I used Pythorch-1.1 branch and followed the README:

Install Pytorch-1.1

$ conda install pytorch torchvision cudatoolkit=9.0 -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

After the installation above, I still got the error: File ".../python3.7/site-packages/torch/utils/ffi/init.py", line 1, in raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.") ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.

Do you have any idea about this? Thank you!

speedinghzl commented 4 years ago

@cauivy Is the error message is thrown out when you run the script? After checking my PyTorch, my Pytorch version is 1.2.0. But Pytorch 1.1 should be ok. Please re-check out the pytorch-1.1 branch and run with pytorch>1.1. The master branch supports Pytorch 0.4.

cauivy commented 4 years ago

@cauivy Is the error message is thrown out when you run the script? After checking my PyTorch, my Pytorch version is 1.2.0. But Pytorch 1.1 should be ok. Please re-check out the pytorch-1.1 branch and run with pytorch>1.1. The master branch supports Pytorch 0.4.

@speedinghzl Sorry for my late reply. After changing into pytorch-1.1 branch, my env works! Thank you!

cauivy commented 4 years ago

@cauivy Is the error message is thrown out when you run the script? After checking my PyTorch, my Pytorch version is 1.2.0. But Pytorch 1.1 should be ok. Please re-check out the pytorch-1.1 branch and run with pytorch>1.1. The master branch supports Pytorch 0.4. I used the version of pytroch1.1, but I still got this error. I compiled according to the above several times. How can I solve this problem?I have changed the version of pytorch, tried both 1.1 and 1.2, but still didn't resolve the compilation issue

After changing the pytorch-1.1 branch, the error was gone in my side. Please make sure you are using the pytorch-1.1 branch with 'git branch' command.

cauivy commented 4 years ago

@cauivy Is the error message is thrown out when you run the script? After checking my PyTorch, my Pytorch version is 1.2.0. But Pytorch 1.1 should be ok. Please re-check out the pytorch-1.1 branch and run with pytorch>1.1. The master branch supports Pytorch 0.4.

@speedinghzl Sorry for my late reply. After changing into pytorch-1.1 branch, my env works! Thank you!

@speedinghzl BTW, I want to run your model on my own data, I found images were subtracted mean values: IMG_MEAN = np.array((104.00698793,116.66876762,122.67891434), dtype=np.float32)

I wonder where are these three values from? Thanks in advance!

kimkimyoung commented 3 years ago

Thank you! I find my mistakes, 在2020-02-25 18:21:04,cauivynotifications@github.com写道: @cauivy Is the error message is thrown out when you run the script? After checking my PyTorch, my Pytorch version is 1.2.0. But Pytorch 1.1 should be ok. Please re-check out the pytorch-1.1 branch and run with pytorch>1.1. The master branch supports Pytorch 0.4. I used the version of pytroch1.1, but I still got this error. I compiled according to the above several times. How can I solve this problem?I have changed the version of pytorch, tried both 1.1 and 1.2, but still didn't resolve the compilation issue After changing the pytorch-1.1 branch, the error was gone in my side. Please make sure you are using the pytorch-1.1 branch with 'git branch' command. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Hi Lu, how did you fix the problem? and what mistakes you had found? I can not fix it.