MGT-python 1.11.0
Fixed
-
pose()on OpenCV 5 fails with a message instead of anAttributeError. OpenCV removed its
Caffe importer in 5.0:cv2.dnn.readNetFromCaffeno longer exists andcv2.dnn.readNetrefuses
the format rather than falling back. The OpenPose backends here — BODY_25, COCO and MPI — are
Caffe models, so on such a build they cannot run at all. The failure used to surface as
AttributeError: module 'cv2.dnn' has no attribute 'readNetFromCaffe'from deep inside the run,
and only after offering to download 200 MB of weights that the environment could never load.The check now happens before the weights are looked for, and names both ways out:
pose(model= 'mediapipe')withpip install musicalgestures[pose], orpip install 'opencv-python<5'to
keep the OpenPose skeletons. It is deliberately not an automatic switch to MediaPipe — its 33
landmarks are a different skeleton from BODY_25's 25, so a silent substitution would return data
that looks like what was asked for and is not. -
The MediaPipe fallback no longer falls back into a wall. With MediaPipe missing,
pose()
announced a fallback to BODY_25 and then failed on it, because that fallback assumed OpenCV could
always load a Caffe model. Where it cannot, there is nowhere to fall back to, and the error now
says so and names the one install that would work. -
Test_pose_gpuskips where OpenPose cannot run. Its two cases had been failing with the bare
AttributeErrorabove on any OpenCV 5 machine, which is what made the incompatibility read as a
fault in the pose code rather than in the environment. They test device selection on the OpenPose
path, so where that path does not exist there is nothing to select and the tests skip with the
reason stated.
Documentation
- What the visualisation threshold costs a measurement is now measured, not
just flagged._motionvideo's header said there was "no reason to think
the value that looks best is the value that measures best". On 83 clips of a
corpus of everyday sound-producing actions, scored by how far the action
stands above the lead-in it interrupts: no threshold improves the
separation, more clips lose contrast than gain it at every step (55 of 83 at
threshold=0.05, sign test p = 0.004), and the median cost at the default is
0.4 % against a per-clip spread of 0.39 to 2.66. The default is very nearly
free for machine analysis of this material. Two cautions are recorded with
it: one criterion was scored, and smaller samples of the same code gave 1.2 %
at 23 clips and no effect at 6. - Also recorded: a threshold moves any landmark computed from the same series,
so a statistic measured across that landmark shows a much larger apparent
effect than the signal loss --- 23 % against 9 % here.
MediaPipe is unaffected by any of this and remains the default backend; it carries its own weights
and never touches cv2.dnn. Verified end to end on OpenCV 5.0.0 with MediaPipe 1.0.0: 163 frames
of 33 landmarks off a real clip, a person found in 44 % of them.