VITA-Group / FasterSeg

[ICLR 2020] "FasterSeg: Searching for Faster Real-time Semantic Segmentation" by Wuyang Chen, Xinyu Gong, Xianming Liu, Qian Zhang, Yuan Li, Zhangyang Wang
MIT License
525 stars 107 forks source link

flop calcuate #10

Closed pawopawo closed 4 years ago

pawopawo commented 4 years ago
--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/local/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/local/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/local/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "train_search.py", line 306, in <module>
    main(pretrain=config.pretrain)
  File "train_search.py", line 68, in main
    flops, params = profile(model, inputs=(torch.randn(1, 3, 1024, 2048)))
  File "/usr/local/lib/python3.6/site-packages/thop/profile.py", line 97, in profile
    model.apply(add_hooks)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 247, in apply
    module.apply(fn)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 247, in apply
    module.apply(fn)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 247, in apply
    module.apply(fn)
  [Previous line repeated 4 more times]
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 248, in apply
    fn(self)
  File "/usr/local/lib/python3.6/site-packages/thop/profile.py", line 87, in add_hooks
    logger.info("THOP has not implemented counting method for ", m)
Message: 'THOP has not implemented counting method for '
Arguments: (USConv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False),)
30 22:57:41 Register FLOP counter for module BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module BatchNorm2d(320, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module Conv2d(384, 192, kernel_size=(1, 1), stride=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(384, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(192, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(192, 96, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(256, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(128, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(128, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(192, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(192, 96, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(128, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(128, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(96, 96, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(96, 19, kernel_size=(1, 1), stride=(1, 1))
30 22:57:41 Register FLOP counter for module Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(64, 19, kernel_size=(1, 1), stride=(1, 1))
30 22:57:41 Register FLOP counter for module Conv2d(96, 96, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(96, 19, kernel_size=(1, 1), stride=(1, 1))
30 22:57:41 Register FLOP counter for module Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(64, 19, kernel_size=(1, 1), stride=(1, 1))
30 22:57:41 Register FLOP counter for module Conv2d(96, 96, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(96, 19, kernel_size=(1, 1), stride=(1, 1))
30 22:57:41 Register FLOP counter for module Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(64, 19, kernel_size=(1, 1), stride=(1, 1))
30 22:57:41 Register FLOP counter for module Conv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(192, 19, kernel_size=(1, 1), stride=(1, 1))
30 22:57:41 Register FLOP counter for module Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(128, 19, kernel_size=(1, 1), stride=(1, 1))
30 22:57:41 Register FLOP counter for module Conv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(192, 19, kernel_size=(1, 1), stride=(1, 1))
30 22:57:41 Register FLOP counter for module Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
30 22:57:41 Register FLOP counter for module BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
30 22:57:41 Register FLOP counter for module ReLU(inplace)
30 22:57:41 Register FLOP counter for module Conv2d(128, 19, kernel_size=(1, 1), stride=(1, 1))
Traceback (most recent call last):
  File "train_search.py", line 306, in <module>
    main(pretrain=config.pretrain) 
  File "train_search.py", line 68, in main
    flops, params = profile(model, inputs=(torch.randn(1, 3, 1024, 2048)))
  File "/usr/local/lib/python3.6/site-packages/thop/profile.py", line 100, in profile
    model(*inputs)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/mnt/cephfs_new_wj/cv/xiaxin/NAS/nas_seg/FasterSeg/search/model_search.py", line 287, in forward
    out_prev = [[stem(input), None]] # stem: one cell
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/container.py", line 92, in forward
    input = module(input)
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/mnt/cephfs_new_wj/cv/xiaxin/NAS/nas_seg/FasterSeg/search/operations.py", line 125, in forward
    assert x.size()[1] == self.C_in, "{} {}".format(x.size()[1], self.C_in)
AssertionError: 1024 3

thanks for your excellent work!

when I run CUDA_VISIBLE_DEVICES=0 python train_search.py, The code running here produces the above error

chenwydj commented 4 years ago

@pawopawo Thank you for your interest!

Your code is not update: https://github.com/TAMU-VITA/FasterSeg/blob/master/search/train_search.py#L66

Also please make sure the version of your thop library matches the requirement.