"ppocr/modeling/necks/sast_fpn.py" did not exist on "55c28ed5b4d5d3482c7ad0bb5b8706eaf122a755"
test_repvgg.py 784 Bytes
Newer Older
dengjb's avatar
update  
dengjb committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sys
import unittest

import torch

sys.path.append('.')
from fastreid.config import get_cfg
from fastreid.modeling.backbones import build_backbone


class MyTestCase(unittest.TestCase):
    def test_fusebn(self):
        cfg = get_cfg()
        cfg.defrost()
        cfg.MODEL.BACKBONE.NAME = 'build_repvgg_backbone'
        cfg.MODEL.BACKBONE.DEPTH = 'B1g2'
        cfg.MODEL.BACKBONE.PRETRAIN = False
        model = build_backbone(cfg)
        model.eval()

        test_inp = torch.randn((1, 3, 256, 128))

        y = model(test_inp)

        model.deploy(mode=True)
        from ipdb import set_trace; set_trace()
        fused_y = model(test_inp)

        print("final error :", torch.max(torch.abs(fused_y - y)).item())


if __name__ == '__main__':
    unittest.main()