Skip to content

Commit

Permalink
dev(narugo): fix the dwpose unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
narugo1992 committed Dec 8, 2024
1 parent 15afb33 commit c2c3476
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions test/pose/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,50 +16,50 @@ def _get_xy_range(data):
class TestPoseFormat:
def test_pose18_points(self, demo_pose18):
assert _get_xy_range(demo_pose18.face) == \
pytest.approx((463.900390625, 578.451171875, 169.853515625, 276.93359375))
pytest.approx((465.76692708333326, 582.9609375, 171.5625, 276.2890625))
assert _get_xy_range(demo_pose18.body) == \
pytest.approx((321.95703125, 802.572265625, 184.794921875, 1365.166015625))
pytest.approx((321.14453125, 804.8815104166667, 186.5234375, 1368.4375))
assert _get_xy_range(demo_pose18.left_hand) == \
pytest.approx((807.552734375, 872.298828125, 715.21484375, 777.470703125))
pytest.approx((809.8684895833335, 879.6861979166665, 717.63671875, 772.4934895833335))
assert _get_xy_range(demo_pose18.right_hand) == \
pytest.approx((252.23046875, 316.9765625, 725.17578125, 787.431640625))
pytest.approx((253.8203125, 316.1575520833335, 725.1171875, 787.4544270833335))
assert _get_xy_range(demo_pose18.left_foot) == \
pytest.approx((697.982421875, 742.806640625, 1320.341796875, 1419.951171875))
pytest.approx((697.6614583333335, 742.5442708333335, 1323.5546875, 1420.80078125))
assert _get_xy_range(demo_pose18.right_foot) == \
pytest.approx((453.939453125, 501.25390625, 1390.068359375, 1482.20703125))
pytest.approx((453.2994791666665, 500.67578125, 1395.8658854166665, 1483.1380208333335))

def test_pose18_mul(self, demo_pose18):
pose = demo_pose18 * 1.2
assert _get_xy_range(pose.face) == \
pytest.approx((556.6804687499999, 694.1414062499999, 203.82421875, 332.3203125))
pytest.approx((558.9203124999999, 699.553125, 205.875, 331.546875))
assert _get_xy_range(pose.body) == \
pytest.approx((386.3484375, 963.0867187499999, 221.75390625, 1638.19921875))
pytest.approx((385.37343749999997, 965.8578125, 223.828125, 1642.125))
assert _get_xy_range(pose.left_hand) == \
pytest.approx((969.0632812499999, 1046.75859375, 858.2578125, 932.96484375))
pytest.approx((971.8421875000001, 1055.6234374999997, 861.1640625, 926.9921875000001))
assert _get_xy_range(pose.right_hand) == \
pytest.approx((302.6765625, 380.371875, 870.2109375, 944.91796875))
pytest.approx((304.58437499999997, 379.3890625000002, 870.140625, 944.9453125000001))
assert _get_xy_range(pose.left_foot) == \
pytest.approx((837.5789062499999, 891.3679687499999, 1584.41015625, 1703.94140625))
pytest.approx((837.1937500000001, 891.0531250000001, 1588.265625, 1704.9609375))
assert _get_xy_range(pose.right_foot) == \
pytest.approx((544.7273437499999, 601.5046874999999, 1668.08203125, 1778.6484375))
pytest.approx((543.9593749999998, 600.8109375, 1675.0390624999998, 1779.7656250000002))

with pytest.raises(TypeError):
_ = demo_pose18 * 'st'

def test_pose18_div(self, demo_pose18):
pose = demo_pose18 / 1.2
assert _get_xy_range(pose.face) == \
pytest.approx((386.5836588541667, 482.0426432291667, 141.54459635416669, 230.77799479166669))
pytest.approx((388.1391059027777, 485.80078125, 142.96875, 230.24088541666669))
assert _get_xy_range(pose.body) == \
pytest.approx((268.2975260416667, 668.8102213541667, 153.99576822916669, 1137.6383463541667))
pytest.approx((267.62044270833337, 670.734592013889, 155.43619791666669, 1140.3645833333335))
assert _get_xy_range(pose.left_hand) == \
pytest.approx((672.9606119791667, 726.9156901041667, 596.0123697916667, 647.8922526041667))
pytest.approx((674.8904079861113, 733.0718315972222, 598.0305989583334, 643.7445746527779))
assert _get_xy_range(pose.right_hand) == \
pytest.approx((210.19205729166669, 264.1471354166667, 604.3131510416667, 656.1930338541667))
pytest.approx((211.51692708333334, 263.46462673611126, 604.2643229166667, 656.2120225694446))
assert _get_xy_range(pose.left_foot) == \
pytest.approx((581.6520182291667, 619.0055338541667, 1100.2848307291667, 1183.2926432291667))
pytest.approx((581.3845486111113, 618.7868923611113, 1102.9622395833335, 1184.0006510416667))
assert _get_xy_range(pose.right_foot) == \
pytest.approx((378.2828776041667, 417.7115885416667, 1158.3902994791667, 1235.1725260416667))
pytest.approx((377.7495659722221, 417.22981770833337, 1163.2215711805554, 1235.9483506944446))

with pytest.raises(TypeError):
_ = demo_pose18 / 'st'
Binary file modified test/testfile/pose/2girls_pose_0.npy
Binary file not shown.
Binary file modified test/testfile/pose/2girls_pose_1.npy
Binary file not shown.
Binary file modified test/testfile/pose/2girls_visual.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/testfile/pose/tohsaka_rin_pose.npy
Binary file not shown.

0 comments on commit c2c3476

Please sign in to comment.