Skip to content

Commit

Permalink
Fix opencv(4.5.2) and smplx(0.1.27) compatibility (open-mmlab#635)
Browse files Browse the repository at this point in the history
* fix opencv-python 4.5.2 compatibility
BottomUpRandomAffine fails with opencv-python>=4.5.2 because a
single valued numpy.ndarray is no longer a valid data type for
image_size in cv2.warpAffine. This commit fix it by repacing
image_size with image_size.item().

* fix smplx 0.1.27 compatibility
smplx>=0.1.27 requires loguru, which will not be automatically installed
when installing smplx. So we add loguru into mmpose requirements.
  • Loading branch information
ly015 authored May 11, 2021
1 parent b0acfc4 commit 3e2a7ac
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
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 @@ -496,8 +496,8 @@ def __call__(self, results):
mat_input = self._get_affine_matrix(center, scale,
(self.input_size,
self.input_size), aug_rot)[:2]
image = cv2.warpAffine(image, mat_input,
(self.input_size, self.input_size))
image = cv2.warpAffine(image, mat_input, (self.input_size.item(),
self.input_size.item()))

results['img'], results['mask'], results[
'joints'] = image, mask, joints
Expand Down
1 change: 1 addition & 0 deletions requirements/optional.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
albumentations>=0.3.2
loguru
onnx
onnxruntime
poseval@git+https://github.com/svenkreiss/poseval.git
Expand Down
1 change: 0 additions & 1 deletion tests/test_pipelines/test_bottom_up_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ def test_BottomUpGeneratePAFTarget():
generate_paf_target = BottomUpGeneratePAFTarget(1)
results_generate_paf_target = generate_paf_target(results)
sqrt = np.sqrt(2) / 2
print(results_generate_paf_target['target'])
assert (results_generate_paf_target['target'] == np.array(
[[[sqrt, sqrt, 0, sqrt, sqrt], [sqrt, sqrt, sqrt, sqrt, sqrt],
[0, sqrt, sqrt, sqrt, 0], [sqrt, sqrt, sqrt, sqrt, sqrt],
Expand Down

0 comments on commit 3e2a7ac

Please sign in to comment.