Detectorch - detectron for PyTorch

Overview

Detectorch - detectron for PyTorch

(Disclaimer: this is work in progress and does not feature all the functionalities of detectron. Currently only inference and evaluation are supported -- no training) (News: Now supporting FPN and ResNet-101!)

This code allows to use some of the Detectron models for object detection from Facebook AI Research with PyTorch.

It currently supports:

  • Fast R-CNN
  • Faster R-CNN
  • Mask R-CNN

It supports ResNet-50/101 models with or without FPN. The pre-trained models from caffe2 can be imported and used on PyTorch.

Example Mask R-CNN with ResNet-101 and FPN.

Evaluation

Both bounding box evaluation and instance segmentation evaluation where tested, yielding the same results as in the Detectron caffe2 models. These results below have been computed using the PyTorch code:

Model box AP mask AP model id
fast_rcnn_R-50-C4_2x 35.6 36224046
fast_rcnn_R-50-FPN_2x 36.8 36225249
e2e_faster_rcnn_R-50-C4_2x 36.5 35857281
e2e_faster_rcnn_R-50-FPN_2x 37.9 35857389
e2e_mask_rcnn_R-50-C4_2x 37.8 32.8 35858828
e2e_mask_rcnn_R-50-FPN_2x 38.6 34.5 35859007
e2e_mask_rcnn_R-101-FPN_2x 40.9 36.4 35861858

Training

Training code is experimental. See train_fast.py for training Fast R-CNN. It seems to work, but slow.

Installation

First, clone the repo with git clone --recursive https://github.com/ignacio-rocco/detectorch so that you also clone the Coco API.

The code can be used with PyTorch 0.3.1 or PyTorch 0.4 (master) under Python 3. Anaconda is recommended. Other required packages

  • torchvision (conda install torchvision -c soumith)
  • opencv (conda install -c conda-forge opencv )
  • cython (conda install cython)
  • matplotlib (conda install matplotlib)
  • scikit-image (conda install scikit-image)
  • ninja (conda install ninja) (required for Pytorch 0.4 only)

Additionally, you need to build the Coco API and RoIAlign layer. See below.

Compiling the Coco API

If you cloned this repo with git clone --recursive you should have also cloned the cocoapi in lib/cocoapi. Compile this with:

cd lib/cocoapi/PythonAPI
make install

Compiling RoIAlign

The RoIAlign layer was converted from the caffe2 version. There are two different implementations for each PyTorch version:

  • Pytorch 0.4: RoIAlign using ATen library (lib/cppcuda). Compiled JIT when loaded.
  • PyTorch 0.3.1: RoIAlign using TH/THC and cffi (lib/cppcuda_cffi). Needs to be compiled with:
cd lib/cppcuda_cffi
./make.sh 

Quick Start

Check the demo notebook.

Comments
  • Problem with build_cython.py

    Problem with build_cython.py

    Hello,

    First of all thank you for share this amazing code and repo.

    I am having troubles with build_cython.py, when I compile I got the following error:

    Traceback (most recent call last): File "build_cython.py", line 20, in from Cython.Build import cythonize ImportError: No module named Cython.Build Traceback (most recent call last): File "/home/alupotto/PycharmProjects/c_mon/utils/boxes.py", line 54, in import utils_cython.cython_bbox as cython_bbox ImportError: No module named 'utils_cython.cython_bbox'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/home/alupotto/PycharmProjects/c_mon/cmon.py", line 10, in from utils.preprocess_sample import preprocess_sample File "/home/alupotto/PycharmProjects/c_mon/utils/preprocess_sample.py", line 5, in from utils.multilevel_rois import add_multilevel_rois_for_test File "/home/alupotto/PycharmProjects/c_mon/utils/multilevel_rois.py", line 16, in import utils.boxes as box_utils File "/home/alupotto/PycharmProjects/c_mon/utils/boxes.py", line 66, in raise('--> utils_cython modules compilation failed') TypeError: exceptions must derive from BaseException

    I tried to dis comment other libraries of build_cython.py and it can't detect the others as well. It would be awesome if anybody can help me out.

    Thank you,

    opened by lupotto 6
  • Error when JIT compilation

    Error when JIT compilation

    I got the following error:

    [1/4] c++ -MMD -MF roi_align_binding.o.d -DTORCH_EXTENSION_NAME=roialign -I/opt/pytorch/torch/lib/include -I/opt/pytorch/torch/lib/include/TH -I/opt/pytorch/torch/lib/include/THC -I/share/data/vision-greg/rluo/local/cuda-8.0/include -I/opt/conda/include/python3.6m -fPIC -std=c++11 -c /share/data/vision-greg/rluo/detectorch/lib/cppcuda/roi_align_binding.cpp -o roi_align_binding.o FAILED: roi_align_binding.o c++ -MMD -MF roi_align_binding.o.d -DTORCH_EXTENSION_NAME=roialign -I/opt/pytorch/torch/lib/include -I/opt/pytorch/torch/lib/include/TH -I/opt/pytorch/torch/lib/include/THC -I/share/data/vision-greg/rluo/local/cuda-8.0/include -I/opt/conda/include/python3.6m -fPIC -std=c++11 -c /share/data/vision-greg/rluo/detectorch/lib/cppcuda/roi_align_binding.cpp -o roi_align_binding.o /share/data/vision-greg/rluo/detectorch/lib/cppcuda/roi_align_binding.cpp:1:25: fatal error: torch/torch.h: No such file or directory compilation terminated.

    It seems that it can't find <torch.torch.h> which is supposed to be under /opt/pytorch. But it's not included in the -I options.

    Do you have any idea how to solve this.

    opened by ruotianluo 5
  • How to run the project?

    How to run the project?

    Hello.

    Thank you so much for your work. Really appreciate it. Best mask-RCNN implementation.

    I have completed Compiling the Coco API and RoIAlign.

    I checked the demo notebook. But I was not able to understand how to run this project. Could you please tell me which file I need to run to get the results pdf output.

    Thanks!

    opened by riteshhota2008 4
  • error when running demo.ipynb, [Errno 2] No such file or directory: '/home/nguyen/detectorch/lib/cppcuda/build/lock'

    error when running demo.ipynb, [Errno 2] No such file or directory: '/home/nguyen/detectorch/lib/cppcuda/build/lock'

    Thank you for sharing your great work. However, when i tried to run the demo.ipynb, I received the the following error because of this line of code in the first block [1]: from model.detector import detector

    ---------------------------------------------------------------------------
    FileNotFoundError                         Traceback (most recent call last)
    <ipython-input-1-87b548d7a38f> in <module>()
         12 from utils.utils import to_cuda_variable
         13 from utils.json_dataset_evaluator import evaluate_boxes,evaluate_masks
    ---> 14 from model.detector import detector
         15 import utils.result_utils as result_utils
         16 import utils.vis as vis_utils
    
    /data/share/nguyen/detectorch/lib/model/detector.py in <module>()
          3 import numpy as np
          4 import torchvision.models as models
    ----> 5 from model.roi_align import RoIAlignFunction, preprocess_rois
          6 from model.generate_proposals import GenerateProposals
          7 from model.collect_and_distribute_fpn_rpn_proposals import CollectAndDistributeFpnRpnProposals
    
    /data/share/nguyen/detectorch/lib/model/roi_align.py in <module>()
         16                                             'lib/cppcuda/roi_align_forward_cuda.cu',
         17                                             'lib/cppcuda/roi_align_backward_cuda.cu'],
    ---> 18                     build_directory=build_path,verbose=True)
         19 else:
         20     import cppcuda_cffi.roialign as roialign
    
    ~/.pyenv/versions/anaconda3-5.0.1/envs/pytorch/lib/python3.6/site-packages/torch/utils/cpp_extension.py in load(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose)
        474     baton = FileBaton(os.path.join(build_directory, 'lock'))
        475 
    --> 476     if baton.try_acquire():
        477         try:
        478             with_cuda = any(map(_is_cuda_file, sources))
    
    ~/.pyenv/versions/anaconda3-5.0.1/envs/pytorch/lib/python3.6/site-packages/torch/utils/file_baton.py in try_acquire(self)
         27         '''
         28         try:
    ---> 29             self.fd = os.open(self.lock_file_path, os.O_CREAT | os.O_EXCL)
         30             return True
         31         except FileExistsError:
    
    FileNotFoundError: [Errno 2] No such file or directory: '/data/share/nguyen/detectorch/lib/cppcuda/build/lock'
    
    

    seem that the the folder cppcuda/build/lock was not generated. How should I fix this problem? I use: python = 3.6. pytorch = 0.4.0 Thank you!

    opened by melody2204 3
  • Issue with installing COCO API

    Issue with installing COCO API

    Hey, I managed to clone the required repositories and all install the requirements but when I finally ran:

    cd/lib/cocoapi/PythonAPI make install

    I ran into this error:

    Traceback (most recent call last): File "setup.py", line 13, in include_dirs = [np.get_include(), '../common'], AttributeError: module 'numpy' has no attribute 'get_include'

    Would you have any suggestions to deal with this?

    opened by MathewSam 1
  • No such file or directory: 'detectorch/lib/cppcuda/build/build.ninja'

    No such file or directory: 'detectorch/lib/cppcuda/build/build.ninja'

    Hi,

    firstly, thank you for your work. I have tried your code, but I cannot get it working. It looks like that the file build.ninja cannot be created. Don't you have please any idea why it is happening?

    Using PyTorch 0.4, Ubuntu 16.4, Anaconda with all requirements installed.

    Output of first cell from demo.ipynb ` compiling/loading roi_align Detected CUDA files, patching ldflags Emitting ninja build file /home/lukas/dev/detectorch/lib/cppcuda/build/build.ninja...

    FileNotFoundError Traceback (most recent call last) in () 12 from utils.utils import to_cuda_variable 13 from utils.json_dataset_evaluator import evaluate_boxes,evaluate_masks ---> 14 from model.detector import detector 15 import utils.result_utils as result_utils 16 import utils.vis as vis_utils

    ~/dev/detectorch/lib/model/detector.py in () 3 import numpy as np 4 import torchvision.models as models ----> 5 from model.roi_align import RoIAlignFunction, preprocess_rois 6 from model.generate_proposals import GenerateProposals 7 from model.collect_and_distribute_fpn_rpn_proposals import CollectAndDistributeFpnRpnProposals

    ~/dev/detectorch/lib/model/roi_align.py in () 16 'lib/cppcuda/roi_align_forward_cuda.cu', 17 'lib/cppcuda/roi_align_backward_cuda.cu'], ---> 18 build_directory=build_path,verbose=True) 19 else: 20 import cppcuda_cffi.roialign as roialign

    ~/anaconda3/envs/darknetTracking/lib/python3.6/site-packages/torch/utils/cpp_extension.py in load(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose) 493 extra_ldflags=extra_ldflags or [], 494 extra_include_paths=extra_include_paths or [], --> 495 with_cuda=with_cuda) 496 497 if verbose:

    ~/anaconda3/envs/darknetTracking/lib/python3.6/site-packages/torch/utils/cpp_extension.py in _write_ninja_file(path, name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, with_cuda) 671 blocks.append(cuda_compile_rule) 672 blocks += [link_rule, build, link, default] --> 673 with open(path, 'w') as build_file: 674 for block in blocks: 675 lines = '\n'.join(block)

    FileNotFoundError: [Errno 2] No such file or directory: '/home/lukas/dev/detectorch/lib/cppcuda/build/build.ninja'`

    opened by lukasbrchl 1
  • Windows support?

    Windows support?

    I was hoping to get this to run on Windows10 with GPU support (enabled by this repo.

    I've modified bind.py a bit and am still getting this error : C:...\Dev\detectorch\lib\cppcuda_cffi\src\cpp\roi_align_cpu_loop.o : fatal error LNK1107: invalid or corrupt file: cannot read at 0x3A8

    Any clue what to look out for? Are you planning for Windows support?

    opened by omartin2010 1
  • ModuleNotFoundError: No module named 'utils.preprocess_sample'

    ModuleNotFoundError: No module named 'utils.preprocess_sample'

    When I try to sub classes of the utils.preprocess_samples it says the following error has occured ModuleNotFoundError: No module named 'utils.preprocess_sample' BTW i can able to import utils module but not the sub modules inside it. Can anyone help?

    opened by saravanakumarjsk 0
  • the error of Create detector model

    the error of Create detector model


    KeyError Traceback (most recent call last) in 2 detector_pkl_file=pretrained_model_file, 3 use_rpn_head = use_rpn_head, ----> 4 use_mask_head = use_mask_head) 5 model = model.cuda()

    /mnt/wifiperson-master/dataprocessing/detectorch/lib/model/detector.py in init(self, train, arch, conv_body_layers, conv_head_layers, fpn_layers, fpn_extra_lvl, use_rpn_head, use_mask_head, mask_head_type, roi_feature_channels, N_classes, detector_pkl_file, base_cnn_pkl_file, output_prob, roi_height, roi_width, roi_spatial_scale, roi_sampling_ratio) 224 # load pretrained weights 225 if detector_pkl_file is not None: --> 226 self.load_pretrained_weights(detector_pkl_file, model='detector') 227 elif base_cnn_pkl_file is not None: 228 self.load_pretrained_weights(base_cnn_pkl_file, model='base_cnn')

    /mnt/wifiperson-master/dataprocessing/detectorch/lib/model/detector.py in load_pretrained_weights(self, caffe_pkl_file, model) 306 model_dict[k]=torch.FloatTensor(caffe_data[k_caffe][:,(2, 1, 0),:,:]) 307 else: --> 308 model_dict[k]=torch.FloatTensor(caffe_data[k_caffe]) 309 # update model 310 self.model.load_state_dict(model_dict)

    KeyError: 'res_conv1'

    opened by ljl199711129 0
  • ninja: build stopped: subcommand failed.

    ninja: build stopped: subcommand failed.

    I'm using pytorch 0.4.1, when i ran demo.py,

    compiling/loading roi_align
    /home/feiw/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py:118: UserWarning: 
    
                                   !! WARNING !!
    
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Your compiler (c++) may be ABI-incompatible with PyTorch!
    Please use a compiler that is ABI-compatible with GCC 4.9 and above.
    See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.
    
    See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
    for instructions on how to install GCC 4.9 or higher.
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
                                  !! WARNING !!
    
      warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))
    Detected CUDA files, patching ldflags
    Emitting ninja build file /home/feiw/Detectron/detectorch/lib/cppcuda/build/build.ninja...
    Building extension module roialign...
    Traceback (most recent call last):
      File "/home/feiw/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 759, in _build_extension_module
        ['ninja', '-v'], stderr=subprocess.STDOUT, cwd=build_directory)
      File "/home/feiw/anaconda3/lib/python3.6/subprocess.py", line 336, in check_output
        **kwargs).stdout
      File "/home/feiw/anaconda3/lib/python3.6/subprocess.py", line 418, in run
        output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "demo.py", line 25, in <module>
        from model.detector import detector
      File "lib/model/detector.py", line 5, in <module>
        from model.roi_align import RoIAlignFunction, preprocess_rois
      File "lib/model/roi_align.py", line 18, in <module>
        build_directory=build_path,verbose=True)
      File "/home/feiw/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 514, in load
        with_cuda=with_cuda)
      File "/home/feiw/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 682, in _jit_compile
        _build_extension_module(name, build_directory)
      File "/home/feiw/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 765, in _build_extension_module
        name, error.output.decode()))
    RuntimeError: Error building extension 'roialign': [1/4] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=roialign -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/TH -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/feiw/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options '-fPIC' -std=c++11 -c /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_forward_cuda.cu -o roi_align_forward_cuda.cuda.o
    FAILED: roi_align_forward_cuda.cuda.o 
    /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=roialign -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/TH -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/feiw/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options '-fPIC' -std=c++11 -c /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_forward_cuda.cu -o roi_align_forward_cuda.cuda.o
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_forward_cuda.cu:173:82: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(input.ndimension() == 4, "Input to RoI Align should be a NCHW Tensor");
                                                                                      ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_forward_cuda.cu:178:105: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.ndimension() == 2, "RoI Proposals should be a 2D Tensor, (batch_sz x proposals)");
                                                                                                             ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_forward_cuda.cu:179:109: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.size(1) == 5, "Proposals should be of the form [batch_index startW startH endW enH]");
                                                                                                                 ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_forward_cuda.cu:189:62: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(input.is_contiguous(), "input must be contiguous");
                                                                  ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_forward_cuda.cu:190:74: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.is_contiguous(), "bottom_rois must be contiguous");
                                                                              ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_forward_cuda.cu:209:81: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(cudaGetLastError() == cudaSuccess, "roi_align_forward_kernel failed");
                                                                                     ^
    [2/4] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=roialign -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/TH -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/feiw/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options '-fPIC' -std=c++11 -c /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cuda.cu -o roi_align_backward_cuda.cuda.o
    FAILED: roi_align_backward_cuda.cuda.o 
    /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=roialign -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/TH -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/feiw/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options '-fPIC' -std=c++11 -c /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cuda.cu -o roi_align_backward_cuda.cuda.o
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cuda.cu:225:105: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.ndimension() == 2, "RoI Proposals should be a 2D Tensor, (batch_sz x proposals)");
                                                                                                             ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cuda.cu:226:109: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.size(1) == 5, "Proposals should be of the form [batch_index startW startH endW enH]");
                                                                                                                 ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cuda.cu:231:87: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(roi_cols == 4 || roi_cols == 5, "RoI Proposals should have 4 or 5 columns");
                                                                                           ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cuda.cu:236:74: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.is_contiguous(), "bottom_rois must be contiguous");
                                                                              ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cuda.cu:256:81: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(cudaGetLastError() == cudaSuccess, "roi_align_forward_kernel failed");
                                                                                     ^
    [3/4] c++ -MMD -MF roi_align_binding.o.d -DTORCH_EXTENSION_NAME=roialign -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/TH -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/feiw/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_binding.cpp -o roi_align_binding.o
    FAILED: roi_align_binding.o 
    c++ -MMD -MF roi_align_binding.o.d -DTORCH_EXTENSION_NAME=roialign -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/TH -I/home/feiw/anaconda3/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/feiw/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_binding.cpp -o roi_align_binding.o
    In file included from /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_binding.cpp:2:0:
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_cpu.cpp:237:84: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(input.ndimension() == 4, "Input to RoI Pooling should be a NCHW Tensor");
                                                                                        ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_cpu.cpp:242:105: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.ndimension() == 2, "RoI Proposals should be a 2D Tensor, (batch_sz x proposals)");
                                                                                                             ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_cpu.cpp:243:109: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.size(1) == 5, "Proposals should be of the form [batch_index startW startH endW enH]");
                                                                                                                 ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_cpu.cpp:251:87: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(roi_cols == 4 || roi_cols == 5, "RoI Proposals should have 4 or 5 columns");
                                                                                           ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_cpu.cpp:257:62: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(input.is_contiguous(), "input must be contiguous");
                                                                  ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_cpu.cpp:258:74: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.is_contiguous(), "bottom_rois must be contiguous");
                                                                              ^
    In file included from /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_binding.cpp:3:0:
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cpu.cpp:205:105: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.ndimension() == 2, "RoI Proposals should be a 2D Tensor, (batch_sz x proposals)");
                                                                                                             ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cpu.cpp:206:109: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.size(1) == 5, "Proposals should be of the form [batch_index startW startH endW enH]");
                                                                                                                 ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cpu.cpp:211:87: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(roi_cols == 4 || roi_cols == 5, "RoI Proposals should have 4 or 5 columns");
                                                                                           ^
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cpu.cpp:216:74: error: macro "AT_ASSERT" passed 2 arguments, but takes just 1
       AT_ASSERT(bottom_rois.is_contiguous(), "bottom_rois must be contiguous");
                                                                              ^
    In file included from /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_binding.cpp:2:0:
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_cpu.cpp: In function ‘at::Tensor at::contrib::roi_align_forward_cpu(const at::Tensor&, const at::Tensor&, int64_t, int64_t, double, int64_t)’:
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_cpu.cpp:237:3: error: ‘AT_ASSERT’ was not declared in this scope
       AT_ASSERT(input.ndimension() == 4, "Input to RoI Pooling should be a NCHW Tensor");
       ^
    In file included from /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_binding.cpp:3:0:
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cpu.cpp: In function ‘at::Tensor at::contrib::roi_align_backward_cpu(const at::Tensor&, const at::Tensor&, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, double, int64_t)’:
    /home/feiw/Detectron/detectorch/lib/cppcuda/roi_align_backward_cpu.cpp:205:3: error: ‘AT_ASSERT’ was not declared in this scope
       AT_ASSERT(bottom_rois.ndimension() == 2, "RoI Proposals should be a 2D Tensor, (batch_sz x proposals)");
       ^
    ninja: build stopped: subcommand failed.
    opened by wangfei-cs 6
  • How to build ROIAlign for pytorch 0.4

    How to build ROIAlign for pytorch 0.4

    Do we have to do the same operations for both pytorch 0.3.1 and pytorch 0.4 to build ROIAlign? The demo file keeps restarting every time I pass a sample image to the model and this is the only thing I am doubtful about. Thanks

    opened by MathewSam 0
  • Key-point detection

    Key-point detection

    Hi, I run this project and it results are great. Now I also want extract the keypoints of people, but cannot find it anywhere in the code. Is the keypoints detection already available in this project or I need to trained it by myself? did Anyone already try this please give me some suggestions.

    Thank you! Uyen

    opened by melody2204 1
  • Error when loading pretrained weights

    Error when loading pretrained weights

    Dear @ignacio-rocco, Thank you for your fantastic work. When I want to run your demo_FPN code, I get this error:

    Loading pretrained weights:
    Traceback (most recent call last):
      File "SampleRun1.py", line 102, in <module>
        mask_head_type='1up4convs')
      File ".../detectorch/lib/model/detector.py", line 226, in __init__
        self.load_pretrained_weights(detector_pkl_file, model='detector')
      File ".../detectorch/lib/model/detector.py", line 294, in load_pretrained_weights
        caffe_data = pickle.load(f, encoding='latin1')
    ValueError: could not convert string to int
    

    Would you please kindly help me to address this error?

    opened by ahkarami 0
Owner
Ignacio Rocco
Ignacio Rocco
An essential implementation of BYOL in PyTorch + PyTorch Lightning

Essential BYOL A simple and complete implementation of Bootstrap your own latent: A new approach to self-supervised Learning in PyTorch + PyTorch Ligh

Enrico Fini 48 Sep 27, 2022
RealFormer-Pytorch Implementation of RealFormer using pytorch

RealFormer-Pytorch Implementation of RealFormer using pytorch. Includes comparison with classical Transformer on image classification task (ViT) wrt C

Simo Ryu 90 Dec 8, 2022
Generic template to bootstrap your PyTorch project with PyTorch Lightning, Hydra, W&B, and DVC.

NN Template Generic template to bootstrap your PyTorch project. Click on Use this Template and avoid writing boilerplate code for: PyTorch Lightning,

Luca Moschella 520 Dec 30, 2022
A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch

This repository holds NVIDIA-maintained utilities to streamline mixed precision and distributed training in Pytorch. Some of the code here will be included in upstream Pytorch eventually. The intention of Apex is to make up-to-date utilities available to users as quickly as possible.

NVIDIA Corporation 6.9k Jan 3, 2023
Objective of the repository is to learn and build machine learning models using Pytorch. 30DaysofML Using Pytorch

30 Days Of Machine Learning Using Pytorch Objective of the repository is to learn and build machine learning models using Pytorch. List of Algorithms

Mayur 119 Nov 24, 2022
Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch

Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch

Pytorch Lightning 1.4k Jan 1, 2023
Amazon Forest Computer Vision: Satellite Image tagging code using PyTorch / Keras with lots of PyTorch tricks

Amazon Forest Computer Vision Satellite Image tagging code using PyTorch / Keras Here is a sample of images we had to work with Source: https://www.ka

Mamy Ratsimbazafy 360 Dec 10, 2022
The Incredible PyTorch: a curated list of tutorials, papers, projects, communities and more relating to PyTorch.

This is a curated list of tutorials, projects, libraries, videos, papers, books and anything related to the incredible PyTorch. Feel free to make a pu

Ritchie Ng 9.2k Jan 2, 2023
A PyTorch implementation of the paper Mixup: Beyond Empirical Risk Minimization in PyTorch

Mixup: Beyond Empirical Risk Minimization in PyTorch This is an unofficial PyTorch implementation of mixup: Beyond Empirical Risk Minimization. The co

Harry Yang 121 Dec 17, 2022
A pytorch implementation of Pytorch-Sketch-RNN

Pytorch-Sketch-RNN A pytorch implementation of https://arxiv.org/abs/1704.03477 In order to draw other things than cats, you will find more drawing da

Alexis David Jacq 172 Dec 12, 2022
PyTorch implementation of Advantage async actor-critic Algorithms (A3C) in PyTorch

Advantage async actor-critic Algorithms (A3C) in PyTorch @inproceedings{mnih2016asynchronous, title={Asynchronous methods for deep reinforcement lea

LEI TAI 111 Dec 8, 2022
Amazon Forest Computer Vision: Satellite Image tagging code using PyTorch / Keras with lots of PyTorch tricks

Amazon Forest Computer Vision Satellite Image tagging code using PyTorch / Keras Here is a sample of images we had to work with Source: https://www.ka

Mamy Ratsimbazafy 359 Jan 5, 2023
A bunch of random PyTorch models using PyTorch's C++ frontend

PyTorch Deep Learning Models using the C++ frontend Gettting started Clone the repo 1. https://github.com/mrdvince/pytorchcpp 2. cd fashionmnist or

Vince 0 Jul 13, 2021
PyTorch Autoencoders - Implementing a Variational Autoencoder (VAE) Series in Pytorch.

PyTorch Autoencoders Implementing a Variational Autoencoder (VAE) Series in Pytorch. Inspired by this repository Model List check model paper conferen

Subin An 8 Nov 21, 2022
PyTorch-LIT is the Lite Inference Toolkit (LIT) for PyTorch which focuses on easy and fast inference of large models on end-devices.

PyTorch-LIT PyTorch-LIT is the Lite Inference Toolkit (LIT) for PyTorch which focuses on easy and fast inference of large models on end-devices. With

Amin Rezaei 157 Dec 11, 2022
A general framework for deep learning experiments under PyTorch based on pytorch-lightning

torchx Torchx is a general framework for deep learning experiments under PyTorch based on pytorch-lightning. TODO list gan-like training wrapper text

Yingtian Liu 6 Mar 17, 2022
A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch

Introduction This is a Python package available on PyPI for NVIDIA-maintained utilities to streamline mixed precision and distributed training in Pyto

Artit 'Art' Wangperawong 5 Sep 29, 2021
Pytorch-diffusion - A basic PyTorch implementation of 'Denoising Diffusion Probabilistic Models'

PyTorch implementation of 'Denoising Diffusion Probabilistic Models' This reposi

Arthur Juliani 76 Jan 7, 2023
Fang Zhonghao 13 Nov 19, 2022