facebookresearch / facebookresearch/SlowFast

[Is it a bug?] cfg.BN.USE_PRECISE_STATS True when cfg.DETECTION.ENABLE True

Open
#282 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Hey guys, thanks first for the really great work. My problem is about the error when using cfg file with BN.USE_PRECISE_STATS True and cfg.DETECTION.ENABLE True.

According to my understanding, when setting BN.USE_PRECISE_STATS True, the model will conduct the function `calculate_and_update_precise_bn(loader, model, num_iters=200, use_gpu=True)` to update bn's parameters. But inside the function, it uses `model(inputs)` to forward inputs ([code is here](https://github.com/facebookresearch/fvcore/blob/65ac931177327ae3fd11af5d183d3a3743ce4b58/fvcore/nn/precise_bn.py#L74)). But when we using cfg.DETECTION.ENABLE True, the model takes two variable as inputs, it should be like `model(inputs, meta["boxes"])` ([code is here](https://github.com/facebookresearch/SlowFast/blob/95a96634bc7df08e7f8bff1ff362eb903cdb0210/tools/train_net.py#L70)). So assert error occurs inside the RoI align layer:
```

class ROIAlign(nn.Module):
def __init__(self, output_size, spatial_scale, sampling_ratio, aligned=True):
...

def forward(self, input, rois): # rois will be None in function calculate_and_update_precise_bn(...)
assert rois.dim() == 2 and rois.size(1) == 5
return roi_align(
input, rois, self.output_size, self.spatial_scale, self.sampling_ratio, self.aligned
)

```

If I don't have a clear description, please let me know about it. Thx a lot

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.