errata

The 1.1.0 version of Pytorch does compile and run Demo properly, even test_net.py. Torch. Nonzero _TH_or not supported on CUDAType for Bool. Torch.bool () is supported only by PyTorch1.2.0. After pyTorch is updated to 1.2.0, train_net.py will run normally. All the following uses version 1.2.0, hereby errata.

version

  • Python: 3.7
  • Torch: 1.2.0 (Important)

Torch was just released to 1.0.1 when MaskrCNN was released, and it was stated in the installation guide that 1.0.0NightRelease must be used, and now Torch has been released to 1.4, I am confused as to which version to compile. In the end, it was found that version 1.2.0 compiled successfully, and this version should also correspond to some of the features of version 1.0.0-Nightrelease.

Conda install PyTorch ==1.2.0 TorchVision ==0.4.0 CUDatoolKit =10.0 -C Pytorch

GCC compiler

At first, I used MINGW32 in Anaconda, but kept compiling and reporting errors. Finally, I downloaded and installed Mingw on the official website, and finally I was able to use it successfully.

Compile cocoAPI

Be sure to follow the official documentation

#To prevent installation error do the following after commiting cocooapi :
#using file explorer  naviagate to cocoapi\PythonAPI\setup.py and change line 14 from:
#extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
#to
#extra_compile_args={'gcc': ['/Qstd=c99']},
#Based on  https://github.com/cocodataset/cocoapi/issues/51
Copy the code

Modify setup.py to compile, otherwise an error will be reported

Compile the APEX

While compiling Apex, PYtorch1.0.0 is using CUDA10.0, while I am installing CUDA10.1 on my native computer, so I was prompted for a version conflict. Solution: Comment out line 106 in apex/setup.py and cancel version checking to compile successfully

if "--cuda_ext" in sys.argv:
    from torch.utils.cpp_extension import CUDAExtension
    sys.argv.remove("--cuda_ext")

    if torch.utils.cpp_extension.CUDA_HOME is None:
        raise RuntimeError("--cuda_ext was requested, but nvcc was not found. Are you sure your environment has nvcc available? If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc.")
    else:
        # Comment out this sentence
        # check_cuda_torch_binary_vs_bare_metal(torch.utils.cpp_extension.CUDA_HOME)
Copy the code

Compile MaskrcnnBenchmark

This step will compile as long as you make sure the previous steps are all right. It is important that the Torch and CUDA versions correspond to the versions the code is using. At the same time, the author could not compile properly using Anaconda’s MINGW, and only GCC downloaded from the website mentioned in the above article could compile properly

Run the DEMO

To verify that the compilation is correct, let’s run demo

PIL version problem

ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (H:\Anaconda3\envs\maskrcnn\lib\site-packages\PIL\__init__.py)
Copy the code

Replace PIL to 6.2.1

PIP install - user Pillow = = 6.1Copy the code

Reference:

Github.com/python-pill…

DEMO Running Successfully