MVIG-SJTU / AlphaPose

Real-Time and Accurate Full-Body Multi-Person Pose Estimation&Tracking System
http://mvig.org/research/alphapose.html
Other
8.01k stars 1.97k forks source link

cannot import name 'deform_conv_cuda' #492

Closed shartoo closed 4 years ago

shartoo commented 4 years ago

Hi,i'm working on Windows 10,python 3.6.7 and get error as below when runing .scripts\demo_inference.py with nessary parameters.

Traceback (most recent call last):
  File "D:/WorkProgram/PoseCheck/code/AlphaPose/scripts/demo_inference.py", line 13, in <module>
    from alphapose.models import builder
  File "D:\WorkProgram\PoseCheck\code\AlphaPose\alphapose\__init__.py", line 1, in <module>
    from .datasets import *  # noqa: F401,F403
  File "D:\WorkProgram\PoseCheck\code\AlphaPose\alphapose\datasets\__init__.py", line 1, in <module>
    from .coco_det import Mscoco_det
  File "D:\WorkProgram\PoseCheck\code\AlphaPose\alphapose\datasets\coco_det.py", line 17, in <module>
    from alphapose.models.builder import DATASET
  File "D:\WorkProgram\PoseCheck\code\AlphaPose\alphapose\models\__init__.py", line 1, in <module>
    from .fastpose import FastPose
  File "D:\WorkProgram\PoseCheck\code\AlphaPose\alphapose\models\fastpose.py", line 10, in <module>
    from .layers.SE_Resnet import SEResnet
  File "D:\WorkProgram\PoseCheck\code\AlphaPose\alphapose\models\layers\SE_Resnet.py", line 9, in <module>
    from .dcn import DeformConv, ModulatedDeformConv
  File "D:\WorkProgram\PoseCheck\code\AlphaPose\alphapose\models\layers\dcn\__init__.py", line 1, in <module>
    from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv,
  File "D:\WorkProgram\PoseCheck\code\AlphaPose\alphapose\models\layers\dcn\deform_conv.py", line 9, in <module>
    from . import deform_conv_cuda
ImportError: cannot import name 'deform_conv_cuda'
shartoo commented 4 years ago

I did check that there was no file named deform_conv_cuda in that directory but file like deform_conv_cuda.cpp in dcn/src

susfly commented 4 years ago

same problem

Fang-Haoshu commented 4 years ago

Hi, I guess it's a problem from here: https://github.com/MVIG-SJTU/AlphaPose/blob/master/setup.py#L124 You can try to remove the if command. We will update the setup.py later

mazatov commented 4 years ago

I have the same error. Were you able to resolve it, @shartoo

(alphapose) C:\Users\mazat\Documents\Python\AlphaPose>python scripts/demo_inference.py --cfg ${cfg_file} --checkpoint ${trained_model} --outdir examples/res --vis --webcam 0
Traceback (most recent call last):
  File "scripts/demo_inference.py", line 13, in <module>
    from alphapose.models import builder
  File "c:\users\mazat\documents\python\alphapose\alphapose\models\__init__.py", line 1, in <module>
    from .fastpose import FastPose
  File "c:\users\mazat\documents\python\alphapose\alphapose\models\fastpose.py", line 10, in <module>
    from .layers.SE_Resnet import SEResnet
  File "c:\users\mazat\documents\python\alphapose\alphapose\models\layers\SE_Resnet.py", line 9, in <module>
    from .dcn import DeformConv, ModulatedDeformConv
  File "c:\users\mazat\documents\python\alphapose\alphapose\models\layers\dcn\__init__.py", line 1, in <module>
    from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv,
  File "c:\users\mazat\documents\python\alphapose\alphapose\models\layers\dcn\deform_conv.py", line 9, in <module>
    from . import deform_conv_cuda
ImportError: cannot import name 'deform_conv_cuda'
shartoo commented 4 years ago

not yet,remove code as @Fang-Haoshu Fang-Haoshu could not help.

timiderinola commented 4 years ago

I had the problem and I've been able to solve it by doing what @Fang-Haoshu said. There is an if statement that makes setup.py skip some module installations if you're on Windows.

if platform.system() != 'Windows': ..........ext_modules = [...

After doing this, run setup.py again:

$ python setup.py build develop

This time, 'deform_conv_cuda' and other modules will be installed and you should stop seeing this error. It worked for me.

myounus96 commented 4 years ago

I had the problem and I've been able to solve it by doing what @Fang-Haoshu said. There is an if statement that makes setup.py skip some module installations if you're on Windows.

  • Go to setup.py in your Alphapose folder.
  • On line 124, comment out the "if" statement.

if platform.system() != 'Windows': ..........ext_modules = [...

  • Ensure you adjust the code block under the if statement (since you have removed the "if"). Make them one indent instead of two.

After doing this, run setup.py again:

$ python setup.py build develop

This time, 'deform_conv_cuda' and other modules will be installed and you should stop seeing this error. It worked for me.

Thank you @timiderinola

myounus96 commented 4 years ago

But now I am getting cuda related error, dont know why even I installed cpu version of pytorch.

Jeff-sjtu commented 4 years ago

Hi @M-Younus, GPU version of PyTorch is necessary.

myounus96 commented 4 years ago

Hi @M-Younus, GPU version of PyTorch is necessary.

Right,Thanks for response. Please, can you look into this https://github.com/MVIG-SJTU/AlphaPose/issues/503

myounus96 commented 4 years ago

Hi @M-Younus, GPU version of PyTorch is necessary.

BTW just for confirmation, the master branch is pytorch based,am I right?As mentioned here https://github.com/MVIG-SJTU/AlphaPose/tree/pytorch#notice

Jeff-sjtu commented 4 years ago

Yes, the master branch is based on PyTorch.

GreenTeaHua commented 4 years ago

setup.py line 124:if platform.system() != 'Windows': ---》if platform.system() == 'Windows': for me,win10+pytorch1.3.1+vs2019+cuda10.1,it's ok.

aFewThings commented 4 years ago

I followed @timiderinola and I got this error. error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.0\\bin\\nvcc.exe' failed with exit status 2 My version is window10+pytorch1.2.0+cuda10.0

Fang-Haoshu commented 4 years ago

@aFewThings Is VS 2019 installed? If not, I recommend using the pytorch branch, which does not require VS.

aFewThings commented 4 years ago

thx.

Fang-Haoshu commented 4 years ago

Solved. Close

bqFirst commented 3 years ago

I had the problem and I've been able to solve it by doing what @Fang-Haoshu said. There is an if statement that makes setup.py skip some module installations if you're on Windows.

  • Go to setup.py in your Alphapose folder.
  • On line 124, comment out the "if" statement.

if platform.system() != 'Windows': ..........ext_modules = [...

  • Ensure you adjust the code block under the if statement (since you have removed the "if"). Make them one indent instead of two.

After doing this, run setup.py again:

$ python setup.py build develop

This time, 'deform_conv_cuda' and other modules will be installed and you should stop seeing this error. It worked for me.

Thx for solving the problem that had been bothering me for several days!