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

Raised exception - AttributeError: 'dict' object has no attribute 'MODEL' #231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions lib/models/pose_resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class PoseResNet(nn.Module):

def __init__(self, block, layers, cfg, **kwargs):
self.inplanes = 64
extra = cfg.MODEL.EXTRA
self.deconv_with_bias = extra.DECONV_WITH_BIAS
extra = cfg['MODEL']['EXTRA']
self.deconv_with_bias = extra['DECONV_WITH_BIAS']

super(PoseResNet, self).__init__()
self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3,
Expand All @@ -120,17 +120,17 @@ def __init__(self, block, layers, cfg, **kwargs):

# used for deconv layers
self.deconv_layers = self._make_deconv_layer(
extra.NUM_DECONV_LAYERS,
extra.NUM_DECONV_FILTERS,
extra.NUM_DECONV_KERNELS,
extra['NUM_DECONV_LAYERS'],
extra['NUM_DECONV_FILTERS'],
extra['NUM_DECONV_KERNELS'],
)

self.final_layer = nn.Conv2d(
in_channels=extra.NUM_DECONV_FILTERS[-1],
out_channels=cfg.MODEL.NUM_JOINTS,
kernel_size=extra.FINAL_CONV_KERNEL,
in_channels=extra['NUM_DECONV_FILTERS'][-1],
out_channels=cfg['MODEL']['NUM_JOINTS'],
kernel_size=extra['FINAL_CONV_KERNEL'],
stride=1,
padding=1 if extra.FINAL_CONV_KERNEL == 3 else 0
padding=1 if extra['FINAL_CONV_KERNEL'] == 3 else 0
)

def _make_layer(self, block, planes, blocks, stride=1):
Expand Down Expand Up @@ -259,13 +259,13 @@ def init_weights(self, pretrained=''):


def get_pose_net(cfg, is_train, **kwargs):
num_layers = cfg.MODEL.EXTRA.NUM_LAYERS
num_layers = cfg['MODEL']['EXTRA']['NUM_LAYERS']

block_class, layers = resnet_spec[num_layers]

model = PoseResNet(block_class, layers, cfg, **kwargs)

if is_train and cfg.MODEL.INIT_WEIGHTS:
model.init_weights(cfg.MODEL.PRETRAINED)
if is_train and cfg['MODEL']['INIT_WEIGHTS']:
model.init_weights(cfg['MODEL']['PRETRAINED'])

return model