FMA-Net icon indicating copy to clipboard operation
FMA-Net copied to clipboard

Model Parameters is different from the paper

Open DachunKai opened this issue 7 months ago • 5 comments

I found that when num_seq=10 and num_flow=9, the measured parameter count is 10.41M; when num_seq=3 and num_flow=2, the measured parameter count is 9.37M. But the parameter count mentioned in the paper is 9.6M. Under what input conditions was this tested? Does the parameter count of FMA-Net change with the number of input frame sequences? If the number of input frames changes during training and testing, can the model still function correctly?

The parameter computation snippet is as follows.

class Config:
    def __init__(self, config_dict):
        for key, value in config_dict.items():
            setattr(self, key, value)

def test_fmanet():
    config_dict = {
        'stage': 2,
        'scale': 4,
        'num_seq': 10,
        'ds_kernel_size': 20,
        'in_channels': 3,
        'dim': 90,
        'ds_kernel_size': 20,
        'us_kernel_size': 5,
        'num_RDB': 12,
        'growth_rate': 18,
        'num_dense_layer': 4,
        'num_flow': 9,
        'num_FRMA': 4,
        'num_transformer_block': 2,
        'num_heads': 6,
        'LayerNorm_type': 'WithBias',
        'ffn_expansion_factor': 2.66,
        'bias': False,
    }
    config = Config(config_dict)

    net = FMANet(
        config
    ).cuda()
    net.eval()

    t = 10 
    input = torch.rand(1, 3, t, 180, 320).cuda()

    macs, _ = profile(model=net, inputs=(input, ), verbose=False)
    params = sum(p.numel() for p in net.parameters())

Above snippet returns that parameters is 10.41M.

DachunKai avatar Jul 04 '24 12:07 DachunKai