tianzhi0549 / FCOS

FCOS: Fully Convolutional One-Stage Object Detection (ICCV'19)
https://arxiv.org/abs/1904.01355
Other
3.26k stars 630 forks source link

Does anyone modify nms in FCOS? #163

Open 1356789-rr opened 4 years ago

1356789-rr commented 4 years ago

I want to replace NMS with soft-nms, but I find that the code is nms = _C.nms directly, so how to modify it?

1356789-rr commented 4 years ago

@tianzhi0549 AttributeError: module 'fcos_core._C' has no attribute 'soft_nms' I want to know what this mistake means. I modified nms. Do I need to re-execute setup.py?.

1356789-rr commented 4 years ago

I rescheduled the problem by re-executing the code setup.py

1356789-rr commented 4 years ago

@tianzhi0549 I want to know that I changed the NMS under the cpu, so does it mean that only the CPU can be used for training? After I trained with GPU, it made the following mistakes:

TypeError: soft_nms(): incompatible function arguments. The following argument types are supported:

  1. (arg0: at::Tensor, arg1: at::Tensor, arg2: float, arg3: float) -> Tuple[at::Tensor, at::Tensor]

Invoked with: tensor([[327.8995, 47.2685, 355.4270, 93.3744], [327.4995, 48.7287, 359.0144, 101.9610], [327.1015, 47.4387, 359.3018, 104.6860], [327.4035, 46.5408, 358.2711, 105.0878], [327.3345, 46.2306, 359.3198, 105.7501], [327.8994, 50.2494, 360.5788, 104.5905], [327.6187, 48.6214, 360.0731, 106.2034], [327.9669, 47.4720, 358.8925, 106.7337], [327.3083, 47.3729, 358.0426, 108.4901], [327.9398, 51.1350, 361.1434, 104.9170], [328.3127, 49.0745, 360.7763, 105.8977], [328.3316, 47.8240, 359.4240, 106.9553], [327.2661, 48.3898, 358.4930, 108.4254], [380.0000, 104.3251, 404.5209, 145.1190], [379.8471, 103.9523, 404.5392, 145.6564], [378.7968, 103.6746, 404.4926, 145.4437], [378.1633, 101.4548, 407.2842, 145.0099], [379.5026, 106.1022, 405.1763, 146.9368], [379.6914, 104.8152, 404.7070, 146.0232], [378.6171, 104.3213, 404.7714, 145.9986], [376.9970, 102.9757, 405.8806, 145.9707], [379.2361, 108.8532, 403.4287, 146.9196], [380.1276, 106.1812, 404.6460, 146.4751], [378.6341, 105.5007, 404.3172, 146.8362], [380.4797, 110.7195, 403.7887, 147.2310]], device='cuda:0'), tensor([0.1728, 0.4708, 0.7484, 0.7467, 0.2374, 0.3174, 0.8431, 0.8486, 0.3415, 0.1516, 0.7694, 0.7967, 0.3741, 0.1523, 0.6794, 0.6742, 0.1388, 0.1350, 0.7923, 0.7806, 0.1160, 0.1500, 0.6967, 0.6722, 0.2029], device='cuda:0'), 0.6 Traceback (most recent call last): File "/home/rc/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/rc/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/rc/anaconda3/lib/python3.7/site-packages/torch/distributed/launch.py", line 235, in main() File "/home/rc/anaconda3/lib/python3.7/site-packages/torch/distributed/launch.py", line 231, in main cmd=process.args) subprocess.CalledProcessError: Command '['/home/rc/anaconda3/bin/python', '-u', 'tools/train_net.py', '--local_rank=0', '--use-tensorboard', '--config-file', 'configs/fcos/fcos_imprv_R_50_FPN_1x.yaml', 'DATALOADER.NUM_WORKERS', '2', 'OUTPUT_DIR', 'training_dir/fcos_imprv_R_50_FPN_1x']' returned non-zero exit status 1.

dreamhighchina commented 4 years ago

大佬,源代码在哪里进行了NMS??

1356789-rr commented 4 years ago

大佬,源代码在哪里进行了NMS??

fcos_core/structures/boxlist_ops.py里边

dreamhighchina commented 4 years ago

大佬,源代码在哪里进行了NMS??

fcos_core/structures/boxlist_ops.py里边

好的谢谢大佬

dreamhighchina commented 4 years ago

你不用编译,只是在测试的时候将nms函数修改下就可以了

lawo123 commented 4 years ago

需要先把build/lib.linux-x86_64-3.6/fcos_core/_C.cpython-36m-x86_64-linux-gnu.so 删除然后重新编译一下python setup.py build develop --no-deps就可以了