Wave back to back, introduce once per person and pace queued swings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+20
-1
@@ -2,6 +2,7 @@
|
||||
wave greeting is tuned and tested on. Moves nothing; Lumi only speaks (POST /say).
|
||||
|
||||
python vision/wave_record.py [first_step] # writes tests/data/waves/<label>.jsonl and <label>/<n>.jpg
|
||||
python vision/wave_record.py more # the second set: hands at the head, a phone from the pocket
|
||||
|
||||
One line per frame: {t, n, people: [{box, kp (17 x [x, y, conf]), dist_m}]}; frame n at half size (640 x 360), for the
|
||||
hand's own motion (the keypoints have no fingers: a wave from the wrist hardly moves the wrist keypoint). People in
|
||||
@@ -47,6 +48,24 @@ STEPS = [
|
||||
("no_still", "Just stand still.", 6),
|
||||
]
|
||||
|
||||
# second set: what started a wave greeting live although it is no wave
|
||||
MORE = [
|
||||
("no_hold_head", "Two metres in front of me. Hold your head with one hand.", 6),
|
||||
("no_hold_head2", "Now with both hands, on top of your head.", 6),
|
||||
("no_back_head", "Put a hand on the back of your head.", 6),
|
||||
("no_scratch_top", "Scratch the top of your head, hard.", 6),
|
||||
("no_scratch_side", "Scratch the side of your head, behind the ear.", 6),
|
||||
("no_pocket_phone", "Take your phone out of your pocket and hold it to your ear.", 8),
|
||||
("no_pocket_phone2", "Once more: phone from the pocket to the ear, then back.", 8),
|
||||
("no_phone_look", "Hold your phone up in front of your face and look at it.", 6),
|
||||
("no_hair", "Fix your hair with one hand.", 6),
|
||||
("no_stretch", "Stretch both arms up over your head.", 6),
|
||||
("no_rub_eyes", "Rub your eyes.", 6),
|
||||
("no_talk_hands", "Talk with your hands, as if explaining something.", 8),
|
||||
("wave_near_face", "Now a real wave, with your hand close to your face.", 8),
|
||||
("wave_small", "Now a small wave, only the hand moves.", 8),
|
||||
]
|
||||
|
||||
|
||||
def say(text):
|
||||
req = urllib.request.Request("http://localhost:8100/say", json.dumps({"text": text}).encode(),
|
||||
@@ -103,7 +122,7 @@ if __name__ == "__main__":
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
pose.load()
|
||||
first = sys.argv[1] if len(sys.argv) > 1 else STEPS[0][0]
|
||||
steps = STEPS[[s[0] for s in STEPS].index(first):]
|
||||
steps = MORE if first == "more" else STEPS[[s[0] for s in STEPS].index(first):]
|
||||
say("Let's record waves. Do what I say after I say go.")
|
||||
for label, text, seconds in steps:
|
||||
print(f"-- {label}", flush=True)
|
||||
|
||||
+11
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
The pose keypoints have no fingers, and a wave from the wrist hardly moves the wrist keypoint (a few px), so the hand
|
||||
itself is measured: the sideways optical flow in a box over the palm (past the wrist, along the forearm), frame to
|
||||
frame. A wave is that flow changing direction MIN_FLIPS times within WINDOW_S with the hand above the shoulder and
|
||||
away from the head. A hand held up still, pointing or arms swinging while walking give no flips; a scratch, a phone
|
||||
frame. A wave is that flow changing direction MIN_FLIPS times within WINDOW_S with the hand above the shoulder, the forearm
|
||||
pointing up and the palm away from the head. A hand held up still, pointing or arms swinging while walking give no flips; a scratch, a phone
|
||||
at the ear or a hand at the face move at the head (AT_HEAD) and do not count.
|
||||
|
||||
python vision/waving.py tests/data/waves/right_2m # a recording of vision/wave_record.py, frame by frame
|
||||
@@ -26,6 +26,10 @@ MIN_MOVING = 20 # flow pixels in the hand box needed to measure the
|
||||
PALM = 0.5 # the palm's centre: this much of the forearm past the wrist
|
||||
BOX = 0.6 # half the hand box's side, in forearm lengths
|
||||
MIN_BOX_PX = 8 # ... at least (half size)
|
||||
OVER_HEAD = 0.45 # shoulder widths; a palm this near the nose sideways is over or on the head (holding it,
|
||||
# fixing hair, stretching: recorded mostly 0.0-0.4), not waving (recorded waves 0.52 and more)
|
||||
FOREARM_UP_DEG = 40.0 # deg the forearm points up from level at least (recorded waves 52 and more; talking with
|
||||
# the hands, pointing 22-27; most hands at the head 30-50)
|
||||
AT_HEAD = 0.3 # shoulder widths: a palm this near the face or ears is at the head (scratching, a phone,
|
||||
# glasses, hair; recorded 0.07-0.32), not waving (recorded waves 0.36 and more)
|
||||
TRACK_PX = 120 # px (full size); a person's shoulder centre moves less than this between frames
|
||||
@@ -46,9 +50,14 @@ def _hand(kp):
|
||||
if not (w and e and s) or w[1] >= s[1]:
|
||||
continue
|
||||
fx, fy = w[0] - e[0], w[1] - e[1]
|
||||
if np.degrees(np.arctan2(-fy, abs(fx))) < FOREARM_UP_DEG:
|
||||
continue
|
||||
palm = (w[0] + PALM * fx, w[1] + PALM * fy)
|
||||
if any(np.hypot(palm[0] - f[0], palm[1] - f[1]) < near for f in face):
|
||||
continue
|
||||
nose = pose.seen(kp, "nose")
|
||||
if nose and abs(palm[0] - nose[0]) < OVER_HEAD * near / AT_HEAD:
|
||||
continue
|
||||
c = (palm[0] * SCALE, palm[1] * SCALE)
|
||||
r = max(MIN_BOX_PX, BOX * np.hypot(fx, fy) * SCALE)
|
||||
if best is None or c[1] < best[0][1]:
|
||||
|
||||
Reference in New Issue
Block a user