Faster-rcnn.pytorch: make.sh error on pytorch1.0

Created on 19 Dec 2018  路  4Comments  路  Source: jwyang/faster-rcnn.pytorch

running build_ext
copying build/lib.linux-x86_64-3.7/model/_C.cpython-37m-x86_64-linux-gnu.so -> model
Compiling nms kernels by nvcc...
Traceback (most recent call last):
  File "build.py", line 4, in <module>
    from torch.utils.ffi import create_extension
  File "/root/.pyenv/versions/3.7.1/lib/python3.7/site-packages/torch/utils/ffi/__init__.py", line 1, in <module>
    raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.")
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
Compiling roi pooling kernels by nvcc...
Traceback (most recent call last):
  File "build.py", line 4, in <module>
    from torch.utils.ffi import create_extension
  File "/root/.pyenv/versions/3.7.1/lib/python3.7/site-packages/torch/utils/ffi/__init__.py", line 1, in <module>
    raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.")
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
Compiling roi align kernels by nvcc...
Traceback (most recent call last):
  File "build.py", line 4, in <module>
    from torch.utils.ffi import create_extension
  File "/root/.pyenv/versions/3.7.1/lib/python3.7/site-packages/torch/utils/ffi/__init__.py", line 1, in <module>
    raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.")
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
Compiling roi crop kernels by nvcc...
Traceback (most recent call last):
  File "build.py", line 4, in <module>
    from torch.utils.ffi import create_extension
  File "/root/.pyenv/versions/3.7.1/lib/python3.7/site-packages/torch/utils/ffi/__init__.py", line 1, in <module>
    raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.")
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.

when I run sh maske.sh, I got the error message as shown above.

Most helpful comment

I find the reason that I got error message. You should remove make.sh in branch pytorch-1.0, and I also find you didn't compile coco api, which will lead to a error.

You shoud add setup file in pycocotools

# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------

import os
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np


# Obtain the numpy include directory.  This logic works across numpy versions.
try:
    numpy_include = np.get_include()
except AttributeError:
    numpy_include = np.get_numpy_include()


ext_modules = [
    Extension(
        '_mask',
        sources=['maskApi.c', '_mask.pyx'],
        include_dirs = [numpy_include, '.'],
        extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
    )
]

setup(
    name='faster_rcnn',
    ext_modules=ext_modules,
    # inject our custom trigger
    cmdclass={'build_ext': build_ext},
)

and run

python setup.py build_ext --inplace

All 4 comments

@wanghan0501 I guess you are still using pytorch 0.4 (master) branch, please go to pytorch-1.0 branch and try again.

I find the reason that I got error message. You should remove make.sh in branch pytorch-1.0, and I also find you didn't compile coco api, which will lead to a error.

You shoud add setup file in pycocotools

# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------

import os
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np


# Obtain the numpy include directory.  This logic works across numpy versions.
try:
    numpy_include = np.get_include()
except AttributeError:
    numpy_include = np.get_numpy_include()


ext_modules = [
    Extension(
        '_mask',
        sources=['maskApi.c', '_mask.pyx'],
        include_dirs = [numpy_include, '.'],
        extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
    )
]

setup(
    name='faster_rcnn',
    ext_modules=ext_modules,
    # inject our custom trigger
    cmdclass={'build_ext': build_ext},
)

and run

python setup.py build_ext --inplace

thanks! In pytorch-1.0 branch, I already removed sh make.sh for the installation, will remove the file as well. The compiled pycocotools file in pytorch-0.4.0 is reusable and thus I did not compile here. Thanks for reminding.

so there no need to run "sh make.sh" ? or is it necessary to run ??
please help me.

Was this page helpful?
0 / 5 - 0 ratings