Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-plus committed Aug 2, 2021
2 parents a7495f1 + e271582 commit c1e14af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def update_video(i):

for n, ax in enumerate(ax_3d):
pos = poses[n][i]
lines_3d[n][j - 1][0].set_xdata([pos[j, 0], pos[j_parent, 0]])
lines_3d[n][j - 1][0].set_xdata(np.array([pos[j, 0], pos[j_parent, 0]])) # Hotfix matplotlib's bug. https://github.com/matplotlib/matplotlib/pull/20555
lines_3d[n][j - 1][0].set_ydata([pos[j, 1], pos[j_parent, 1]])
lines_3d[n][j - 1][0].set_3d_properties([pos[j, 2], pos[j_parent, 2]], zdir='z')

Expand Down
8 changes: 4 additions & 4 deletions joints_detectors/Alphapose/fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import cv2
import numpy as np
import torch
from torch._six import string_classes, int_classes
from torch._six import string_classes

RED = (0, 0, 255)
GREEN = (0, 255, 0)
Expand Down Expand Up @@ -57,7 +57,7 @@ def collate_fn(batch):
if elem.shape == (): # scalars
py_type = float if elem.dtype.name.startswith('float') else int
return numpy_type_map[elem.dtype.name](list(map(py_type, batch)))
elif isinstance(batch[0], int_classes):
elif isinstance(batch[0], int):
return torch.LongTensor(batch)
elif isinstance(batch[0], float):
return torch.DoubleTensor(batch)
Expand Down Expand Up @@ -194,7 +194,7 @@ def vis_frame(frame, im_res, format='coco'):
bg = img.copy()
cv2.circle(bg, (int(cor_x / 2), int(cor_y / 2)), 2, p_color[n], -1)
# Now create a mask of logo and create its inverse mask also
transparency = max(0, min(1, kp_scores[n]))
transparency = max(0, min(1, kp_scores[n].item()))
img = cv2.addWeighted(bg, transparency, img, 1 - transparency, 0)

# Draw proposal score on the head
Expand All @@ -219,7 +219,7 @@ def vis_frame(frame, im_res, format='coco'):
polygon = cv2.ellipse2Poly((int(mX), int(mY)), (int(length / 2), int(stickwidth)), int(angle), 0, 360, 1)
cv2.fillConvexPoly(bg, polygon, line_color[i])
# cv2.line(bg, start_xy, end_xy, line_color[i], (2 * (kp_scores[start_p] + kp_scores[end_p])) + 1)
transparency = max(0, min(1, 0.5 * (kp_scores[start_p] + kp_scores[end_p])))
transparency = max(0, min(1, 0.5 * (kp_scores[start_p] + kp_scores[end_p]).item()))
img = cv2.addWeighted(bg, transparency, img, 1 - transparency, 0)
img = cv2.resize(img, (width, height), interpolation=cv2.INTER_CUBIC)
return img
Expand Down
2 changes: 1 addition & 1 deletion pose_trackers/PoseFlow/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ opencv_contrib_python==3.4.2.16
matplotlib==2.2.2
tqdm==4.23.4
Image==1.5.25
Pillow==6.2.0
Pillow==8.2.0
munkres==1.0.12

0 comments on commit c1e14af

Please sign in to comment.