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

multi_gpu_model AttributeError: 'NoneType' object has no attribute 'fusion_blocks' #12

Open
guiyuliu opened this issue Jul 20, 2020 · 1 comment

Comments

@guiyuliu
Copy link

When multi_gpu=0, the network can be trained smoothly,
but when I change multi_gpu=8, I get the error bellow:
It seems likely the cfg cannot be passed to backbone_retinanet.
it seems like in train_crfnet.py line 131,
backbone_retinanet(num_classes, num_anchors=num_anchors, modifier=modifier, inputs=inputs, distance=distance)
cfg=cfg is missed

File "train_crfnet.py", line 424, in
main()
File "train_crfnet.py", line 329, in main
distance_alpha = cfg.distance_alpha
File "train_crfnet.py", line 131, in create_models
model = model_with_weights(backbone_retinanet(num_classes, num_anchors=num_anchors, modifier=modifier, inputs=inputs, distance=distance), weights=weights, skip_mismatch=True, config=copy.deepcopy(cfg), nu
m_classes=num_classes)
File "../crfnet/model/architectures/vgg.py", line 34, in retinanet
return vgg_retinanet(*args, backbone=self.backbone, **kwargs)
File "../crfnet/model/architectures/vgg.py", line 101, in vgg_retinanet
vgg = vggmax.custom(input_tensor=inputs, include_top=False, weights=None, cfg=cfg)
File "/root/anaconda3/envs/crfnet2/lib/python3.5/site-packages/keras/applications/init.py", line 28, in wrapper
return base_fun(*args, **kwargs)
File "../crfnet/model/architectures/vggmax.py", line 19, in custom
return vggmax(*args, **kwargs)
File "../crfnet/model/architectures/vggmax.py", line 149, in vggmax
fusion_blocks = cfg.fusion_blocks
AttributeError: 'NoneType' object has no attribute 'fusion_blocks'
Exception ignored in: <bound method BaseSession.del of <tensorflow.python.client.session.Session object at 0x7f4762d369e8>>
Traceback (most recent call last):
File "/root/anaconda3/envs/crfnet2/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 738, in del

@nacayu
Copy link

nacayu commented Apr 13, 2022

I solved it. I think authors work lack a var of "cfg" in train_crfnet in line 134:

the previous line:

backbone_retinanet(num_classes, num_anchors=num_anchors, modifier=modifier, inputs=inputs, distance=distance),weights=weights, skip_mismatch=True, config=copy.deepcopy(cfg),num_classes=num_classes)

after modifying(add "cfg = cfg")

backbone_retinanet(num_classes, num_anchors=num_anchors, modifier=modifier, inputs=inputs, distance=distance, **cfg = cfg**), weights=weights, skip_mismatch=True, config=copy.deepcopy(cfg), num_classes=num_classes)
@guiyuliu

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

2 participants