mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
scripts/examples: Simplify blazeface and palm examples.
This commit is contained in:
parent
75e16b5738
commit
3527c4d423
@ -26,11 +26,7 @@ while True:
|
|||||||
img = csi0.snapshot()
|
img = csi0.snapshot()
|
||||||
|
|
||||||
# faces is a list of ((x, y, w, h), score, keypoints) tuples
|
# faces is a list of ((x, y, w, h), score, keypoints) tuples
|
||||||
faces = model.predict([img])
|
for r, score, keypoints in model.predict([img]):
|
||||||
|
|
||||||
# Draw bounding boxes around the detected faces and keypoints.
|
|
||||||
if faces:
|
|
||||||
for r, score, keypoints in faces[0]:
|
|
||||||
ml.utils.draw_predictions(img, [r], ("face",), ((0, 0, 255),), format=None)
|
ml.utils.draw_predictions(img, [r], ("face",), ((0, 0, 255),), format=None)
|
||||||
|
|
||||||
# keypoints is a ndarray of shape (6, 2)
|
# keypoints is a ndarray of shape (6, 2)
|
||||||
|
|||||||
@ -31,11 +31,7 @@ while True:
|
|||||||
img = csi0.snapshot()
|
img = csi0.snapshot()
|
||||||
|
|
||||||
# palms is a list of ((x, y, w, h), score, keypoints) tuples
|
# palms is a list of ((x, y, w, h), score, keypoints) tuples
|
||||||
palms = model.predict([img])
|
for r, score, keypoints in model.predict([img]):
|
||||||
|
|
||||||
# Draw bounding boxes around the detected palms and keypoints.
|
|
||||||
if palms:
|
|
||||||
for r, score, keypoints in palms[0]:
|
|
||||||
ml.utils.draw_predictions(img, [r], ("palm",), ((0, 0, 255),), format=None)
|
ml.utils.draw_predictions(img, [r], ("palm",), ((0, 0, 255),), format=None)
|
||||||
|
|
||||||
# keypoints is a ndarray of shape (7, 2)
|
# keypoints is a ndarray of shape (7, 2)
|
||||||
|
|||||||
@ -39,10 +39,7 @@ while True:
|
|||||||
img = csi0.snapshot()
|
img = csi0.snapshot()
|
||||||
|
|
||||||
# palms is a list of ((x, y, w, h), score, keypoints) tuples
|
# palms is a list of ((x, y, w, h), score, keypoints) tuples
|
||||||
palms = palm_detection.predict([img])
|
for r, score, keypoints in palm_detection.predict([img]):
|
||||||
|
|
||||||
if palms:
|
|
||||||
for r, score, keypoints in palms[0]:
|
|
||||||
# rect is (x, y, w, h) - enlarge by 3x for hand landmarks model
|
# rect is (x, y, w, h) - enlarge by 3x for hand landmarks model
|
||||||
wider_rect = (r[0] - r[2], r[1] - r[3], r[2] * 3, r[3] * 3)
|
wider_rect = (r[0] - r[2], r[1] - r[3], r[2] * 3, r[3] * 3)
|
||||||
# Operate on just the ROI of the detected palm
|
# Operate on just the ROI of the detected palm
|
||||||
|
|||||||
@ -43,10 +43,7 @@ while True:
|
|||||||
|
|
||||||
if n is None:
|
if n is None:
|
||||||
# palms is a list of ((x, y, w, h), score, keypoints) tuples
|
# palms is a list of ((x, y, w, h), score, keypoints) tuples
|
||||||
palms = palm_detection.predict([img])
|
for r, score, keypoints in palm_detection.predict([img]):
|
||||||
|
|
||||||
if palms:
|
|
||||||
for r, score, keypoints in palms[0]:
|
|
||||||
# rect is (x, y, w, h) - enlarge by 3x for hand landmarks model
|
# rect is (x, y, w, h) - enlarge by 3x for hand landmarks model
|
||||||
wider_rect = (r[0] - r[2], r[1] - r[3], r[2] * 3, r[3] * 3)
|
wider_rect = (r[0] - r[2], r[1] - r[3], r[2] * 3, r[3] * 3)
|
||||||
# Operate on just the ROI of the detected palm
|
# Operate on just the ROI of the detected palm
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user