R3Det based on mmdet 2.19.0

Overview

R3Det: Refined Single-Stage Detector with Feature Refinement for Rotating Object

License arXiv

Installation

# install mmdetection first if you haven't installed it yet. (Refer to mmdetection for details.)
pip install mmdet==2.19.0

# install r3det (Compiling rotated ops is a little time-consuming.)
pip install -r requirements.txt
pip install -v -e .
  • It is best to use opencv-python greater than 4.5.1 because its angle representation has been changed in 4.5.1. The following experiments are all run with 4.5.3.

Quick Start

Please change path in configs to your data path.

# train
CUDA_VISIBLE_DEVICES=0 PORT=29500 \
./tools/dist_train.sh configs/rretinanet/rretinanet_obb_r50_fpn_1x_dota_v3.py 1

# submission
CUDA_VISIBLE_DEVICES=0 PORT=29500 \
./tools/dist_test.sh configs/rretinanet/rretinanet_obb_r50_fpn_1x_dota_v3.py \
        work_dirs/rretinanet_obb_r50_fpn_1x_dota_v3/epoch_12.pth 1 --format-only\
        --eval-options submission_dir=work_dirs/rretinanet_obb_r50_fpn_1x_dota_v3/Task1_results

For DOTA dataset, please crop the original images into 1024×1024 patches with an overlap of 200 by run

python tools/split/img_split.py --base_json \
       tools/split/split_configs/split_configs/dota1_0/ss_trainval.json

python tools/split/img_split.py --base_json \
       tools/split/split_configs/dota1_0/ss_test.json

Please change path in ss_trainval.json, ss_test.json to your path. (Forked from BboxToolkit, which is faster then DOTA_Devkit.)

Angle Representations

Three angle representations are built-in, which can freely switch in the config.

  • v1 (from R3Det): [-PI/2, 0)
  • v2 (from S2ANet): [-Pi/4, 3PI/4)
  • v3 (from OBBDetection): [-PI/2, PI/2)

The differences of the three angle representations are reflected in poly2obb, obb2poly, obb2xyxy, obb2hbb, hbb2obb, etc. [More], And according to the above three papers, the coders of them are different.

  • DeltaXYWHAOBBoxCoder
    • v1:None
    • v2:Constrained angle + Projection of dx and dy + Normalized with PI
    • v3:Constrained angle and length&width + Projection of dx and dy
  • DeltaXYWHAHBBoxCoder
    • v1:None
    • v2:Constrained angle + Normalized with PI
    • v3:Constrained angle and length&width + Normalized with 2PI

We believe that different coders are the key reason for the different baselines in different papers. The good news is that all the above coders can be freely switched in R3Det. In addition, R3Det also provide 4 NMS ops and 3 IoU_Calculators for rotation detection as follows:

  • nms.type
    • v1:v1
    • v2:v2
    • v3:v3
    • mmcv: mmcv
  • iou_calculator
    • v1:RBboxOverlaps2D_v1
    • v2:RBboxOverlaps2D_v2
    • v3:RBboxOverlaps2D_v3

Performance

DOTA1.0 (Task1)
Model Backbone Lr schd MS RR Angle box AP Official Download
RRetinaNet HBB R50-FPN 1x - - v1 65.19 65.73 Baidu:0518/Google
RRetinaNet OBB R50-FPN 1x - - v3 68.20 69.40 Baidu:0518/Google
RRetinaNet OBB R50-FPN 1x - - v2 68.64 68.40 Baidu:0518/Google
R3Det R50-FPN 1x - - v1 70.41 70.66 Baidu:0518/Google
R3Det* R50-FPN 1x - - v1 70.86 - Baidu:0518/Google
  • MS means multiple scale image split.
  • RR means random rotation.

Citation

@inproceedings{yang2021r3det,
    title={R3Det: Refined Single-Stage Detector with Feature Refinement for Rotating Object},
    author={Yang, Xue and Yan, Junchi and Feng, Ziming and He, Tao},
    booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
    volume={35},
    number={4},
    pages={3163--3171},
    year={2021}
}

Comments
  •   pip install -v -e .

    pip install -v -e .

    Compiling objects...
    Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
    [1/4] /usr/local/cuda-11.0/bin/nvcc -DWITH_CUDA -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/TH -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda-11.0/include -I/home/hw/anaconda3/envs/R3Det/include/python3.8 -c -c /home/hw/Project/r3det-pytorch/r3det/ops/nms_rotated/src/nms_rotated_cuda.cu -o /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/nms_rotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=nms_rotated_ext -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=sm_86 -std=c++14
    FAILED: /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/nms_rotated_cuda.o
    /usr/local/cuda-11.0/bin/nvcc -DWITH_CUDA -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/TH -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda-11.0/include -I/home/hw/anaconda3/envs/R3Det/include/python3.8 -c -c /home/hw/Project/r3det-pytorch/r3det/ops/nms_rotated/src/nms_rotated_cuda.cu -o /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/nms_rotated_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=nms_rotated_ext -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=sm_86 -std=c++14
    nvcc fatal   : Unsupported gpu architecture 'compute_86'
    [2/4] /usr/local/cuda-11.0/bin/nvcc -DWITH_CUDA -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/TH -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda-11.0/include -I/home/hw/anaconda3/envs/R3Det/include/python3.8 -c -c /home/hw/Project/r3det-pytorch/r3det/ops/nms_rotated/src/poly_nms_cuda.cu -o /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/poly_nms_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=nms_rotated_ext -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=sm_86 -std=c++14
    FAILED: /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/poly_nms_cuda.o
    /usr/local/cuda-11.0/bin/nvcc -DWITH_CUDA -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/TH -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda-11.0/include -I/home/hw/anaconda3/envs/R3Det/include/python3.8 -c -c /home/hw/Project/r3det-pytorch/r3det/ops/nms_rotated/src/poly_nms_cuda.cu -o /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/poly_nms_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=nms_rotated_ext -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=sm_86 -std=c++14
    nvcc fatal   : Unsupported gpu architecture 'compute_86'
    [3/4] c++ -MMD -MF /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/nms_rotated_cpu.o.d -pthread -B /home/hw/anaconda3/envs/R3Det/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/TH -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda-11.0/include -I/home/hw/anaconda3/envs/R3Det/include/python3.8 -c -c /home/hw/Project/r3det-pytorch/r3det/ops/nms_rotated/src/nms_rotated_cpu.cpp -o /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/nms_rotated_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=nms_rotated_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    [4/4] c++ -MMD -MF /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/nms_rotated_ext.o.d -pthread -B /home/hw/anaconda3/envs/R3Det/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/TH -I/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda-11.0/include -I/home/hw/anaconda3/envs/R3Det/include/python3.8 -c -c /home/hw/Project/r3det-pytorch/r3det/ops/nms_rotated/src/nms_rotated_ext.cpp -o /home/hw/Project/r3det-pytorch/build/temp.linux-x86_64-3.8/r3det/ops/nms_rotated/src/nms_rotated_ext.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=nms_rotated_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    In file included from /home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:149,
                     from /home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
                     from /home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
                     from /home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
                     from /home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:12,
                     from /home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/torch/extension.h:4,
                     from /home/hw/Project/r3det-pytorch/r3det/ops/nms_rotated/src/nms_rotated_ext.cpp:5:
    /home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/include/ATen/ParallelOpenMP.h:84: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
       84 | #pragma omp parallel for if ((end - begin) >= grain_size)
          |
    ninja: build stopped: subcommand failed.
    Traceback (most recent call last):
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1533, in _run_ninja_build
        subprocess.run(
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/subprocess.py", line 516, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/hw/Project/r3det-pytorch/setup.py", line 178, in <module>
        setup(
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/setuptools/command/develop.py", line 114, in install_for_development
        self.run_command('build_ext')
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run
        _build_ext.run(self)
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
        _build_ext.build_ext.run(self)
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 670, in build_extensions
        build_ext.build_extensions(self)
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
        _build_ext.build_ext.build_extensions(self)
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
        self._build_extensions_serial()
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
        self.build_extension(ext)
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
        _build_ext.build_extension(self, ext)
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension
        objects = self.compiler.compile(sources,
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 491, in unix_wrap_ninja_compile
        _write_ninja_file_and_compile_objects(
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1250, in _write_ninja_file_and_compile_objects
        _run_ninja_build(
      File "/home/hw/anaconda3/envs/R3Det/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1555, in _run_ninja_build
        raise RuntimeError(message) from e
    RuntimeError: Error compiling objects for extension
    

    ERROR: Command errored out with exit status 1: /home/hw/anaconda3/envs/R3Det/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/hw/Project/r3det-pytorch/setup.py'"'"'; file='"'"'/home/hw/Project/r3det-pytorch/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

    opened by houw0517 6
  • ERROR: Command errored out with exit status 1:    develop --no-deps Check the logs for full command output.

    ERROR: Command errored out with exit status 1: develop --no-deps Check the logs for full command output.

    PS D:\任慧娟\python\r3det-pytorch-main> pip install -v -e .
    Using pip 21.3.1 from D:\program\anaconda\lib\site-packages\pip-21.3.1-py3.8.egg\pip (python 3.8) WARNING: Ignoring invalid distribution -ip (d:\program\anaconda\lib\site-packages) WARNING: Ignoring invalid distribution -ip (d:\program\anaconda\lib\site-packages) Obtaining file:///D:/%E4%BB%BB%E6%85%A7%E5%A8%9F/python/r3det-pytorch-main Running command python setup.py egg_info running egg_info creating C:\Users\zqdell\AppData\Local\Temp\pip-pip-egg-info-2wem_6cv\r3det.egg-info writing manifest file 'C:\Users\zqdell\AppData\Local\Temp\pip-pip-egg-info-2wem_6cv\r3det.egg-info\SOURCES.txt' writing manifest file 'C:\Users\zqdell\AppData\Local\Temp\pip-pip-egg-info-2wem_6cv\r3det.egg-info\SOURCES.txt' D:\program\anaconda\lib\site-packages\torch\utils\cpp_extension.py:335: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils b ackend. warnings.warn(msg.format('we could not find ninja.')) Error in atexit._run_exitfuncs: Traceback (most recent call last): File "D:\program\anaconda\lib\site-packages\colorama\ansitowin32.py", line 59, in closed return stream.closed ValueError: underlying buffer has been detached Preparing metadata (setup.py) ... done WARNING: Ignoring invalid distribution -ip (d:\program\anaconda\lib\site-packages) Requirement already satisfied: matplotlib in d:\program\anaconda\lib\site-packages (from r3det==0.1.0) (3.3.2) Requirement already satisfied: numpy in d:\program\anaconda\lib\site-packages (from r3det==0.1.0) (1.19.2) Installing collected packages: r3det Running setup.py develop for r3det Running command 'D:\program\anaconda\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\任慧娟\python\r3det-pytorch-main\setup.py'"'"'; file='"'"'D:\任慧娟\python\r3det -pytorch-main\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'" '"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Traceback (most recent call last): File "", line 1, in File "D:\任慧娟\python\r3det-pytorch-main\setup.py", line 177, in add_mim_extension() File "D:\任慧娟\python\r3det-pytorch-main\setup.py", line 164, in add_mim_extension os.symlink(src_relpath, tar_path) OSError: [WinError 1314] 客户端没有所需的特权。: '..\..\tools' -> 'D:\任慧娟\python\r3det-pytorch-main\r3det\.mim\tools'

    ERROR: Command errored out with exit status 1: 'D:\program\anaconda\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\任慧娟\python\r3det-pytorch-main\setup.py'"'"'; file='"' "'D:\任慧娟\python\r3det-pytorch-main\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f .read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output. WARNING: Ignoring invalid distribution -ip (d:\program\anaconda\lib\site-packages) WARNING: Ignoring invalid distribution -ip (d:\program\anaconda\lib\site-packages)

    opened by rhj0103 6
  • train Error

    train Error

    (open-mmlab) junjzhan@junjzhan-Super-Server:~/zhao_jg/code/r3det-pytorch-main$ CUDA_VISIBLE_DEVICES=0 PORT=29500 ./tools/dist_train.sh configs/rretinanet/rretinanet_obb_r50_fpn_1x_dota_v3.py 1 Traceback (most recent call last): File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/./tools/train.py", line 20, in import r3det # noqa: F401 File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/init.py", line 4, in from .core import * # noqa: F401, F403 File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/core/init.py", line 2, in from .bbox import * # noqa: F401, F403 File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/core/bbox/init.py", line 2, in from .iou_calculators import (RBboxOverlaps2D_v1, RBboxOverlaps2D_v2, File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/core/bbox/iou_calculators/init.py", line 1, in from .rotate_iou2d_calculator import (RBboxOverlaps2D_v1, RBboxOverlaps2D_v2, File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/core/bbox/iou_calculators/rotate_iou2d_calculator.py", line 4, in from r3det.ops import obb_overlaps, rbbox_iou File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/ops/init.py", line 1, in from .box_iou_rotated import obb_overlaps File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/ops/box_iou_rotated/init.py", line 1, in from .box_iou_rotated_wrapper import obb_overlaps # noqa: F401, F403 File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/ops/box_iou_rotated/box_iou_rotated_wrapper.py", line 4, in from ..convex import convex_sort File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/ops/convex/init.py", line 1, in from .convex_wrapper import convex_sort # noqa: F401, F403 File "/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/ops/convex/convex_wrapper.py", line 3, in from . import convex_ext ImportError: cannot import name 'convex_ext' from partially initialized module 'r3det.ops.convex' (most likely due to a circular import) (/home/junjzhan/zhao_jg/code/r3det-pytorch-main/r3det/ops/convex/init.py) Traceback (most recent call last): File "/home/junjzhan/rogers/libraries/anaconda3/envs/open-mmlab/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/junjzhan/rogers/libraries/anaconda3/envs/open-mmlab/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/junjzhan/rogers/libraries/anaconda3/envs/open-mmlab/lib/python3.9/site-packages/torch/distributed/launch.py", line 260, in main() File "/home/junjzhan/rogers/libraries/anaconda3/envs/open-mmlab/lib/python3.9/site-packages/torch/distributed/launch.py", line 255, in main raise subprocess.CalledProcessError(returncode=process.returncode, subprocess.CalledProcessError: Command '['/home/junjzhan/rogers/libraries/anaconda3/envs/open-mmlab/bin/python', '-u', './tools/train.py', '--local_rank=0', 'configs/rretinanet/rretinanet_obb_r50_fpn_1x_dota_v3.py', '--launcher', 'pytorch']' returned non-zero exit status 1.

    opened by ggzjg 3
  • Error

    Error

    when I run the 'python tools/split/img_split.py --base_json
    tools/split/split_configs/split_configs/dota1_0/ss_trainval.json' output the error

    TypeError: _nonzero_dispatcher() got an unexpected keyword argument 'as_tuple'

    opened by ggzjg 3
  • 用HRSC2016进行训练时,报错KeyError: 'ship'

    用HRSC2016进行训练时,报错KeyError: 'ship'

    我仿照DOTA的配置文件写了一个MyDataset类,并只把 CLASSES = ('plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court', 'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter') 改为了: CLASSES = 'ship' 以下为运行后自动生成的代码

    data_root = '/content/drive/MyDrive/HRSC2016/'
    img_norm_cfg = dict(
        mean=[70.954, 81.526, 78.456], std=[58.371, 57.745, 50.858], to_rgb=True)
    train_pipeline = [
        dict(type='LoadImageFromFile'),
        dict(type='LoadAnnotations', with_bbox=True),
        dict(type='RResize', img_scale=(512, 512)),
        dict(type='RRandomFlip', flip_ratio=0.5),
        dict(
            type='Normalize',
            mean=[70.954, 81.526, 78.456],
            std=[58.371, 57.745, 50.858],
            to_rgb=True),
        dict(type='Pad', size_divisor=32),
        dict(type='DefaultFormatBundle'),
        dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
    ]
    test_pipeline = [
        dict(type='LoadImageFromFile'),
        dict(
            type='MultiScaleFlipAug',
            img_scale=(512, 512),
            flip=False,
            transforms=[
                dict(type='RResize'),
                dict(
                    type='Normalize',
                    mean=[70.954, 81.526, 78.456],
                    std=[58.371, 57.745, 50.858],
                    to_rgb=True),
                dict(type='Pad', size_divisor=32),
                dict(type='DefaultFormatBundle'),
                dict(type='Collect', keys=['img'])
            ])
    ]
    data = dict(
        samples_per_gpu=2,
        workers_per_gpu=2,
        train=dict(
            type='MyDataset',
            ann_file='/content/drive/MyDrive/HRSC2016/Train/labelTxt/',
            img_prefix='/content/drive/MyDrive/HRSC2016/Train/AllImages/',
            pipeline=[
                dict(type='LoadImageFromFile'),
                dict(type='LoadAnnotations', with_bbox=True),
                dict(type='RResize', img_scale=(512, 512)),
                dict(type='RRandomFlip', flip_ratio=0.5),
                dict(
                    type='Normalize',
                    mean=[70.954, 81.526, 78.456],
                    std=[58.371, 57.745, 50.858],
                    to_rgb=True),
                dict(type='Pad', size_divisor=32),
                dict(type='DefaultFormatBundle'),
                dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
            ]),
        val=dict(
            type='MyDataset',
            ann_file='/content/drive/MyDrive/HRSC2016/Test/labelTxt/',
            img_prefix='/content/drive/MyDrive/HRSC2016/Test/AllImages/',
            pipeline=[
                dict(type='LoadImageFromFile'),
                dict(
                    type='MultiScaleFlipAug',
                    img_scale=(512, 512),
                    flip=False,
                    transforms=[
                        dict(type='RResize'),
                        dict(
                            type='Normalize',
                            mean=[70.954, 81.526, 78.456],
                            std=[58.371, 57.745, 50.858],
                            to_rgb=True),
                        dict(type='Pad', size_divisor=32),
                        dict(type='DefaultFormatBundle'),
                        dict(type='Collect', keys=['img'])
                    ])
            ]),
        test=dict(
            type='MyDataset',
            ann_file='/content/drive/MyDrive/HRSC2016/Test/Annotations/',
            img_prefix='/content/drive/MyDrive/HRSC2016/Test/AllImages/',
            pipeline=[
                dict(type='LoadImageFromFile'),
                dict(
                    type='MultiScaleFlipAug',
                    img_scale=(512, 512),
                    flip=False,
                    transforms=[
                        dict(type='RResize'),
                        dict(
                            type='Normalize',
                            mean=[70.954, 81.526, 78.456],
                            std=[58.371, 57.745, 50.858],
                            to_rgb=True),
                        dict(type='Pad', size_divisor=32),
                        dict(type='DefaultFormatBundle'),
                        dict(type='Collect', keys=['img'])
                    ])
            ]))
    evaluation = dict(interval=12, metric='mAP')
    optimizer = dict(type='SGD', lr=0.0025, momentum=0.9, weight_decay=0.0001)
    optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
    lr_config = dict(
        policy='step',
        warmup='linear',
        warmup_iters=500,
        warmup_ratio=0.3333333333333333,
        step=[8, 11])
    runner = dict(type='EpochBasedRunner', max_epochs=12)
    checkpoint_config = dict(interval=12)
    log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')])
    dist_params = dict(backend='nccl')
    log_level = 'INFO'
    load_from = None
    resume_from = None
    workflow = [('train', 1)]
    model = dict(
        type='R3Det',
        backbone=dict(
            type='ResNet',
            depth=50,
            num_stages=4,
            out_indices=(0, 1, 2, 3),
            frozen_stages=1,
            zero_init_residual=False,
            norm_cfg=dict(type='BN', requires_grad=True),
            norm_eval=True,
            style='pytorch',
            init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
        neck=dict(
            type='FPN',
            in_channels=[256, 512, 1024, 2048],
            out_channels=256,
            start_level=1,
            add_extra_convs='on_input',
            num_outs=5),
        bbox_head=dict(
            type='RRetinaHead',
            num_classes=15,
            in_channels=256,
            stacked_convs=4,
            feat_channels=256,
            anchor_generator=dict(
                type='RAnchorGenerator',
                octave_base_scale=4,
                scales_per_octave=3,
                ratios=[1.0, 0.5, 2.0],
                strides=[8, 16, 32, 64, 128]),
            bbox_coder=dict(
                type='DeltaXYWHAOBBoxCoder',
                target_means=(0.0, 0.0, 0.0, 0.0, 0.0),
                target_stds=(1.0, 1.0, 1.0, 1.0, 1.0)),
            loss_cls=dict(
                type='FocalLoss',
                use_sigmoid=True,
                gamma=2.0,
                alpha=0.25,
                loss_weight=1.0),
            loss_bbox=dict(type='SmoothL1Loss', beta=0.11, loss_weight=1.0)),
        frm_cfgs=[dict(in_channels=256, featmap_strides=[8, 16, 32, 64, 128])],
        num_refine_stages=1,
        refine_heads=[
            dict(
                type='RRetinaRefineHead',
                num_classes=15,
                in_channels=256,
                stacked_convs=4,
                feat_channels=256,
                assign_by_circumhbbox=None,
                anchor_generator=dict(
                    type='PseudoAnchorGenerator', strides=[8, 16, 32, 64, 128]),
                bbox_coder=dict(
                    type='DeltaXYWHAOBBoxCoder',
                    target_means=(0.0, 0.0, 0.0, 0.0, 0.0),
                    target_stds=(1.0, 1.0, 1.0, 1.0, 1.0)),
                loss_cls=dict(
                    type='FocalLoss',
                    use_sigmoid=True,
                    gamma=2.0,
                    alpha=0.25,
                    loss_weight=1.0),
                loss_bbox=dict(type='SmoothL1Loss', beta=0.11, loss_weight=1.0))
        ],
        train_cfg=dict(
            s0=dict(
                assigner=dict(
                    type='MaxIoUAssigner',
                    pos_iou_thr=0.5,
                    neg_iou_thr=0.4,
                    min_pos_iou=0,
                    ignore_iof_thr=-1,
                    iou_calculator=dict(type='RBboxOverlaps2D_v1')),
                allowed_border=-1,
                pos_weight=-1,
                debug=False),
            sr=[
                dict(
                    assigner=dict(
                        type='MaxIoUAssigner',
                        pos_iou_thr=0.6,
                        neg_iou_thr=0.5,
                        min_pos_iou=0,
                        ignore_iof_thr=-1,
                        iou_calculator=dict(type='RBboxOverlaps2D_v1')),
                    allowed_border=-1,
                    pos_weight=-1,
                    debug=False)
            ],
            stage_loss_weights=[1.0]),
        test_cfg=dict(
            nms_pre=2000,
            min_bbox_size=0,
            score_thr=0.05,
            nms=dict(iou_thr=0.1),
            max_per_img=2000))
    work_dir = './work_dirs/r3det_r50_fpn_1x_dota_v1'
    gpu_ids = range(0, 1)```
    
    以下为报错:
    

    2022-03-19 09:44:59,167 - mmdet - INFO - initialize ResNet with init_cfg {'type': 'Pretrained', 'checkpoint': 'torchvision://resnet50'} 2022-03-19 09:44:59,168 - mmcv - INFO - load model from: torchvision://resnet50 2022-03-19 09:44:59,168 - mmcv - INFO - load checkpoint from torchvision path: torchvision://resnet50 2022-03-19 09:44:59,410 - mmcv - WARNING - The model and loaded state dict do not match exactly

    unexpected key in source state_dict: fc.weight, fc.bias

    2022-03-19 09:44:59,444 - mmdet - INFO - initialize FPN with init_cfg {'type': 'Xavier', 'layer': 'Conv2d', 'distribution': 'uniform'} Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py", line 52, in build_from_cfg return obj_cls(**args) File "/content/drive/MyDrive/Colab/r3det-pytorch-main/r3det/datasets/mydataset1.py", line 47, in init super(MyDataset, self).init(ann_file, pipeline, **kwargs) File "/usr/local/lib/python3.7/dist-packages/mmdet/datasets/custom.py", line 95, in init self.data_infos = self.load_annotations(local_path) File "/content/drive/MyDrive/Colab/r3det-pytorch-main/r3det/datasets/mydataset1.py", line 102, in load_annotations label = cls_map[cls_name] KeyError: 'ship'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "./tools/train.py", line 193, in main() File "./tools/train.py", line 169, in main datasets = [build_dataset(cfg.data.train)] File "/usr/local/lib/python3.7/dist-packages/mmdet/datasets/builder.py", line 81, in build_dataset dataset = build_from_cfg(cfg, DATASETS, default_args) File "/usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py", line 55, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') KeyError: "MyDataset: 'ship'"

    
    目前推测是单类训练导致的问题,因为CSDN上也有人反映:
    ![image](https://user-images.githubusercontent.com/76859231/159116704-7d0f6225-f09b-4734-a816-1e4c79f85204.png)
    想知道大佬有没有解决这个问题的思路呢?
    opened by LastSummer09 1
  • readme

    readme

    For DOTA dataset, please crop the original images into 1024×1024 patches with an overlap of 200 by run

    python tools/split/img_split.py --base_json
    tools/split/split_configs/~~split_configs~~/dota1_0/ss_trainval.json

    python tools/split/img_split.py --base_json
    tools/split/split_configs/dota1_0/ss_test.json

    opened by sylarwcy 1
  • ModuleNotFoundError: No module named 'r3det.datasets.rotate'

    ModuleNotFoundError: No module named 'r3det.datasets.rotate'

    import r3det Traceback (most recent call last): File "", line 1, in File "/home/amax/WorkSpace/liu/R3Det/r3det/init.py", line 5, in from .datasets import * # noqa: F401, F403 File "/home/amax/WorkSpace/liu/R3Det/r3det/datasets/init.py", line 3, in from .rotate import ROTATEDataset # noqa: F401, F403 ModuleNotFoundError: No module named 'r3det.datasets.rotate'

    Is there any file not uploaded?

    opened by Ariyl 1
Owner
SJTU-Thinklab-Det
SJTU-Thinklab-Det
PyTorch implementation of Algorithm 1 of "On the Anatomy of MCMC-Based Maximum Likelihood Learning of Energy-Based Models"

Code for On the Anatomy of MCMC-Based Maximum Likelihood Learning of Energy-Based Models This repository will reproduce the main results from our pape

Mitch Hill 32 Nov 25, 2022
Deep Image Search is an AI-based image search engine that includes deep transfor learning features Extraction and tree-based vectorized search.

Deep Image Search - AI-Based Image Search Engine Deep Image Search is an AI-based image search engine that includes deep transfer learning features Ex

null 139 Jan 1, 2023
Alex Pashevich 62 Dec 24, 2022
DIT is a DTLS MitM proxy implemented in Python 3. It can intercept, manipulate and suppress datagrams between two DTLS endpoints and supports psk-based and certificate-based authentication schemes (RSA + ECC).

DIT - DTLS Interception Tool DIT is a MitM proxy tool to intercept DTLS traffic. It can intercept, manipulate and/or suppress DTLS datagrams between t

null 52 Nov 30, 2022
Calculates carbon footprint based on fuel mix and discharge profile at the utility selected. Can create graphs and tabular output for fuel mix based on input file of series of power drawn over a period of time.

carbon-footprint-calculator Conda distribution ~/anaconda3/bin/conda install anaconda-client conda-build ~/anaconda3/bin/conda config --set anaconda_u

Seattle university Renewable energy research 7 Sep 26, 2022
A lightweight Python-based 3D network multi-agent simulator. Uses a cell-based congestion model. Calculates risk, loudness and battery capacities of the agents. Suitable for 3D network optimization tasks.

AMAZ3DSim AMAZ3DSim is a lightweight python-based 3D network multi-agent simulator. It uses a cell-based congestion model. It calculates risk, battery

Daniel Hirsch 13 Nov 4, 2022
Fast and customizable reconnaissance workflow tool based on simple YAML based DSL.

Fast and customizable reconnaissance workflow tool based on simple YAML based DSL, with support of notifications and distributed workload of that work

Américo Júnior 3 Mar 11, 2022
Numenta Platform for Intelligent Computing is an implementation of Hierarchical Temporal Memory (HTM), a theory of intelligence based strictly on the neuroscience of the neocortex.

NuPIC Numenta Platform for Intelligent Computing The Numenta Platform for Intelligent Computing (NuPIC) is a machine intelligence platform that implem

Numenta 6.3k Dec 30, 2022
PyTorchCV: A PyTorch-Based Framework for Deep Learning in Computer Vision.

PyTorchCV: A PyTorch-Based Framework for Deep Learning in Computer Vision @misc{CV2018, author = {Donny You ([email protected])}, howpubl

Donny You 40 Sep 14, 2022
💡 Learnergy is a Python library for energy-based machine learning models.

Learnergy: Energy-based Machine Learners Welcome to Learnergy. Did you ever reach a bottleneck in your computational experiments? Are you tired of imp

Gustavo Rosa 57 Nov 17, 2022
A web-based application for quick, scalable, and automated hyperparameter tuning and stacked ensembling in Python.

Xcessiv Xcessiv is a tool to help you create the biggest, craziest, and most excessive stacked ensembles you can think of. Stacked ensembles are simpl

Reiichiro Nakano 1.3k Nov 17, 2022
Official PyTorch implementation for paper Context Matters: Graph-based Self-supervised Representation Learning for Medical Images

Context Matters: Graph-based Self-supervised Representation Learning for Medical Images Official PyTorch implementation for paper Context Matters: Gra

null 49 Nov 23, 2022
Code for "Contextual Non-Local Alignment over Full-Scale Representation for Text-Based Person Search"

Contextual Non-Local Alignment over Full-Scale Representation for Text-Based Person Search This is an implementation for our paper Contextual Non-Loca

Tencent YouTu Research 50 Dec 3, 2022
PaddleRobotics is an open-source algorithm library for robots based on Paddle, including open-source parts such as human-robot interaction, complex motion control, environment perception, SLAM positioning, and navigation.

简体中文 | English PaddleRobotics paddleRobotics是基于paddle的机器人开源算法库集,包括人机交互、复杂运动控制、环境感知、slam定位导航等开源算法部分。 人机交互 主动多模交互技术TFVT-HRI 主动多模交互技术是通过视觉、语音、触摸传感器等输入机器人

null 185 Dec 26, 2022
PIKA: a lightweight speech processing toolkit based on Pytorch and (Py)Kaldi

PIKA: a lightweight speech processing toolkit based on Pytorch and (Py)Kaldi PIKA is a lightweight speech processing toolkit based on Pytorch and (Py)

null 336 Nov 25, 2022
PyTorch code for the paper: FeatMatch: Feature-Based Augmentation for Semi-Supervised Learning

FeatMatch: Feature-Based Augmentation for Semi-Supervised Learning This is the PyTorch implementation of our paper: FeatMatch: Feature-Based Augmentat

null 43 Nov 19, 2022
Only a Matter of Style: Age Transformation Using a Style-Based Regression Model

Only a Matter of Style: Age Transformation Using a Style-Based Regression Model The task of age transformation illustrates the change of an individual

null 444 Dec 30, 2022