Skip to content

Commit

Permalink
Unused vars. (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaochaorui authored and wusize committed Nov 13, 2020
1 parent 63d3257 commit 4100117
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion mmpose/core/post_processing/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def adjust(self, ans, heatmaps):
ans (list(np.ndarray)): Keypoint predictions.
heatmaps (torch.Tensor[NxKxHxW]): Heatmaps.
"""
N, K, H, W = heatmaps.shape
_, _, H, W = heatmaps.shape
for batch_id, people in enumerate(ans):
for people_id, people_i in enumerate(people):
for joint_id, joint in enumerate(people_i):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ def _do_python_keypoint_eval(self, gt_folder, pred_folder):
# evaluate per-frame multi-person pose estimation (AP)
# compute AP
print('Evaluation of per-frame multi-person pose estimation')
apAll, preAll, recAll = evaluateAP(gtFramesAll, prFramesAll, None,
False, False)
apAll, _, _ = evaluateAP(gtFramesAll, prFramesAll, None, False, False)

# print AP
print('Average Precision (AP) metric:')
Expand Down
4 changes: 2 additions & 2 deletions mmpose/datasets/pipelines/bottom_up_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,9 @@ def __call__(self, results):
test_scale_factor = results['ann_info']['test_scale_factor']
aug_data = []

for idx, s in enumerate(sorted(test_scale_factor, reverse=True)):
for _, s in enumerate(sorted(test_scale_factor, reverse=True)):
_results = results.copy()
image_resized, center, scale = _resize_align_multi_scale(
image_resized, _, _ = _resize_align_multi_scale(
_results['img'], input_size, s, min(test_scale_factor))
_results['img'] = image_resized
_results = self.transforms(_results)
Expand Down
4 changes: 2 additions & 2 deletions mmpose/models/backbones/hrnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _make_one_branch(self,
conv_cfg=self.conv_cfg))
self.in_channels[branch_index] = \
num_channels[branch_index] * get_expansion(block)
for i in range(1, num_blocks[branch_index]):
for _ in range(1, num_blocks[branch_index]):
layers.append(
block(
self.in_channels[branch_index],
Expand Down Expand Up @@ -437,7 +437,7 @@ def _make_layer(self, block, in_channels, out_channels, blocks, stride=1):
with_cp=self.with_cp,
norm_cfg=self.norm_cfg,
conv_cfg=self.conv_cfg))
for i in range(1, blocks):
for _ in range(1, blocks):
layers.append(
block(
out_channels,
Expand Down
2 changes: 1 addition & 1 deletion mmpose/models/backbones/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def __init__(self,
norm_cfg=norm_cfg,
**kwargs))
in_channels = out_channels
for i in range(1, num_blocks):
for _ in range(1, num_blocks):
layers.append(
block(
in_channels=in_channels,
Expand Down
2 changes: 1 addition & 1 deletion mmpose/models/detectors/bottom_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def show_result(self,
for res in result:
pose_result.append(res['keypoints'])

for person_id, kpts in enumerate(pose_result):
for _, kpts in enumerate(pose_result):
# draw each point on image
if pose_kpt_color is not None:
assert len(pose_kpt_color) == len(kpts)
Expand Down
2 changes: 1 addition & 1 deletion mmpose/models/detectors/top_down.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def show_result(self,
wait_time=wait_time,
out_file=None)

for person_id, kpts in enumerate(pose_result):
for _, kpts in enumerate(pose_result):
# draw each point on image
if pose_kpt_color is not None:
assert len(pose_kpt_color) == len(kpts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ def forward(self, x):

def init_weights(self):
"""Initialize model weights."""
for name, m in self.deconv_layers.named_modules():
for _, m in self.deconv_layers.named_modules():
if isinstance(m, nn.ConvTranspose2d):
normal_init(m, std=0.001)
elif isinstance(m, nn.BatchNorm2d):
constant_init(m, 1)
for name, m in self.final_layers.named_modules():
for _, m in self.final_layers.named_modules():
if isinstance(m, nn.Conv2d):
normal_init(m, std=0.001, bias=0)
2 changes: 1 addition & 1 deletion mmpose/models/keypoint_heads/bottom_up_simple_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _get_deconv_cfg(self, deconv_kernel):

def init_weights(self):
"""Initialize model weights."""
for name, m in self.deconv_layers.named_modules():
for _, m in self.deconv_layers.named_modules():
if isinstance(m, nn.ConvTranspose2d):
normal_init(m, std=0.001)
elif isinstance(m, nn.BatchNorm2d):
Expand Down
4 changes: 2 additions & 2 deletions mmpose/models/keypoint_heads/top_down_multi_stage_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self,

# build multi-stage deconv layers
self.multi_deconv_layers = nn.ModuleList([])
for i in range(self.num_stages):
for _ in range(self.num_stages):
if num_deconv_layers > 0:
deconv_layers = self._make_deconv_layer(
num_deconv_layers,
Expand Down Expand Up @@ -153,7 +153,7 @@ def _get_deconv_cfg(self, deconv_kernel):

def init_weights(self):
"""Initialize model weights."""
for name, m in self.multi_deconv_layers.named_modules():
for _, m in self.multi_deconv_layers.named_modules():
if isinstance(m, nn.ConvTranspose2d):
normal_init(m, std=0.001)
elif isinstance(m, nn.BatchNorm2d):
Expand Down
2 changes: 1 addition & 1 deletion mmpose/models/keypoint_heads/top_down_simple_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _get_deconv_cfg(self, deconv_kernel):

def init_weights(self):
"""Initialize model weights."""
for name, m in self.deconv_layers.named_modules():
for _, m in self.deconv_layers.named_modules():
if isinstance(m, nn.ConvTranspose2d):
normal_init(m, std=0.001)
elif isinstance(m, nn.BatchNorm2d):
Expand Down
2 changes: 1 addition & 1 deletion mmpose/models/losses/mse_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _ohkm(self, loss):
N = len(loss)
for i in range(N):
sub_loss = loss[i]
topk_val, topk_idx = torch.topk(
_, topk_idx = torch.topk(
sub_loss, k=self.topk, dim=0, sorted=False)
tmp_loss = torch.gather(sub_loss, 0, topk_idx)
ohkm_loss += torch.sum(tmp_loss) / self.topk
Expand Down
2 changes: 1 addition & 1 deletion mmpose/models/mesh_heads/discriminator.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def _create_sub_modules(self):

def forward(self, thetas):
"""Forward function."""
cams, poses, shapes = thetas
_, poses, shapes = thetas

batch_size = poses.shape[0]
shape_disc_value = self.shape_discriminator(shapes)
Expand Down
2 changes: 1 addition & 1 deletion mmpose/models/mesh_heads/hmr_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def forward(self, x):
pred_pose = init_pose
pred_shape = init_shape
pred_cam = init_cam
for i in range(self.n_iter):
for _ in range(self.n_iter):
xc = torch.cat([x, pred_pose, pred_shape, pred_cam], 1)
xc = self.fc1(xc)
xc = self.drop1(xc)
Expand Down

0 comments on commit 4100117

Please sign in to comment.