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

Bug in tool/demo.py #61

Open
yangweixiang opened this issue Aug 10, 2020 · 3 comments
Open

Bug in tool/demo.py #61

yangweixiang opened this issue Aug 10, 2020 · 3 comments

Comments

@yangweixiang
Copy link

I train segmentation mode (deeplabV3+MobileNetV2) on my own dataset, demo.py can run , but the result was wrong. all of the catergory is 0(backgourd).

https://github.com/LikeLy-Journey/SegmenTron/blob/master/tools/demo.py

backbone: Inception is ok
backbone: MobileNet is not ok .

but if I add below source code in demo.py , it will be work.

if hasattr(self.model, 'encoder') and hasattr(self.model.encoder, 'named_modules') and \

        cfg.MODEL.BN_EPS_FOR_ENCODER:

        logging.info('set bn custom eps for bn in encoder: {}'.format(cfg.MODEL.BN_EPS_FOR_ENCODER))

        self.set_batch_norm_attr(self.model.encoder.named_modules(), 'eps', cfg.MODEL.BN_EPS_FOR_ENCODER)

It will change EPS , not use the default.

And I found in https://github.com/LikeLy-Journey/SegmenTron/blob/master/segmentron/solver/optimizer.py

def _get_paramters(model):

params_list = list()

if hasattr(model, 'encoder') and model.encoder is not None and hasattr(model, 'decoder'):

    params_list.append({'params': model.encoder.parameters(), 'lr': cfg.SOLVER.LR})

    if cfg.MODEL.BN_EPS_FOR_ENCODER:

        logging.info('Set bn custom eps for bn in encoder: {}'.format(cfg.MODEL.BN_EPS_FOR_ENCODER))

        _set_batch_norm_attr(model.encoder.named_modules(), 'eps', cfg.MODEL.BN_EPS_FOR_ENCODER)

I am confused about this change of EPS.

would you please explain the reason of change BN EPS ?

@hzhang33BEI
Copy link

some issues with you, and cost me almost one day to solve the problem. Seems we set use the constant BN EPS.

@dreamlychina
Copy link

self.set_batch_norm_attr(self.model.encoder.named_modules(), 'eps', cfg.MODEL.BN_EPS_FOR_ENCODER)

NameError: name 'self' is not defined in demo.py

@xhangHU
Copy link

xhangHU commented Aug 22, 2023

I had the same problem. I used multi-gpu for distributed training on the server. Now I'm testing on single-gpu PC. The result is all zero. I followed your method but the result is still zero. How did you solve it, can you solve it in detail?

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

4 participants