Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'NoneType' object is not callable #85

Open
liaoyanchun opened this issue Feb 14, 2022 · 2 comments
Open

TypeError: 'NoneType' object is not callable #85

liaoyanchun opened this issue Feb 14, 2022 · 2 comments

Comments

@liaoyanchun
Copy link

liaoyanchun commented Feb 14, 2022

Hi!
I meet the following error while training. Can anyone help me?

2022-02-14 14:33:01,692 INFO    [offset_helper.py, 54] engery/max-distance: 5 engery/min-distance: 0
2022-02-14 14:33:01,692 INFO    [offset_helper.py, 61] direction/num_classes: 8 scale: 1
2022-02-14 14:33:01,692 INFO    [offset_helper.py, 66] c4 align axis: False
2022-02-14 14:33:01,711 INFO    [module_runner.py, 44] BN Type is inplace_abn.
2022-02-14 14:33:01,711 INFO    [__init__.py, 17] Using evaluator: StandardEvaluator
Traceback (most recent call last):
  File "main.py", line 215, in <module>
    model = Trainer(configer)
  File "D:\openseg\segmentor\trainer.py", line 70, in __init__
    self._init_model()
  File "D:\openseg\segmentor\trainer.py", line 73, in _init_model
    self.seg_net = self.model_manager.semantic_segmentor()
  File "D:\openseg\lib\models\model_manager.py", line 86, in semantic_segmentor
    model = SEG_MODEL_DICT[model_name](self.configer)
  File "D:\openseg\lib\models\nets\hrnet.py", line 105, in __init__
    self.backbone = BackboneSelector(configer).get_backbone()
  File "D:\openseg\lib\models\backbones\backbone_selector.py", line 34, in get_backbone
    model = HRNetBackbone(self.configer)(**params)
  File "D:\openseg\lib\models\backbones\hrnet\hrnet_backbone.py", line 769, in __call__
    bn_momentum=0.1)
  File "D:\openseg\lib\models\backbones\hrnet\hrnet_backbone.py", line 313, in __init__
    self.bn1 = ModuleHelper.BatchNorm2d(bn_type=bn_type)(64, momentum=bn_momentum)
TypeError: 'NoneType' object is not callable

I followed the guidelines GETTING_STARTED.md and run bash scripts/cityscapes/hrnet/run_h_48_d_4_ocr.sh train 1 . I have not changed any code in configs/cityscapes/H_48_D_4.json and scripts/cityscapes/hrnet/run_h_48_d_4_ocr.sh

@liaoyanchun
Copy link
Author

I tried to use the trained model to evaluate HRNet-W48 + OCR on Cityscapes(guided by MODEL_ZOO.md), and this error occured again.

2022-02-14 20:05:14,497 INFO    [offset_helper.py, 54] engery/max-distance: 5 engery/min-distance: 0
2022-02-14 20:05:14,497 INFO    [offset_helper.py, 61] direction/num_classes: 8 scale: 1
2022-02-14 20:05:14,497 INFO    [offset_helper.py, 66] c4 align axis: False
2022-02-14 20:05:14,557 INFO    [module_runner.py, 44] BN Type is inplace_abn.
Traceback (most recent call last):
  File "main.py", line 218, in <module>
    model = Tester(configer)
  File "D:\openseg\segmentor\tester.py", line 69, in __init__
    self._init_model()
  File "D:\openseg\segmentor\tester.py", line 72, in _init_model
    self.seg_net = self.model_manager.semantic_segmentor()
  File "D:\openseg\lib\models\model_manager.py", line 86, in semantic_segmentor
    model = SEG_MODEL_DICT[model_name](self.configer)
  File "D:\openseg\lib\models\nets\hrnet.py", line 105, in __init__
    self.backbone = BackboneSelector(configer).get_backbone()
  File "D:\openseg\lib\models\backbones\backbone_selector.py", line 34, in get_backbone
    model = HRNetBackbone(self.configer)(**params)
  File "D:\openseg\lib\models\backbones\hrnet\hrnet_backbone.py", line 769, in __call__
    bn_momentum=0.1)
  File "D:\openseg\lib\models\backbones\hrnet\hrnet_backbone.py", line 313, in __init__
    self.bn1 = ModuleHelper.BatchNorm2d(bn_type=bn_type)(64, momentum=bn_momentum)
TypeError: 'NoneType' object is not callable

Help me....

@liaoyanchun
Copy link
Author

I solved the problem by changing the version of PyTorch(from 1.8.0 to 1.0.0), inspired by this post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant