Skip to content

Commit d79ea4c

Browse files
yutingyefacebook-github-bot
authored andcommitted
More detailed error report in marker tracking (#594)
Summary: Pull Request resolved: #594 Report the marker name and frame number with the max error for debugging. Fixed a bug in computing error statistics when the tracked motion is a sub-sequence of the input. Reviewed By: jeongseok-meta Differential Revision: D78504120 fbshipit-source-id: c4e8f7613076f014759dc8f8ae0bd7c327551e95
1 parent 894b7fb commit d79ea4c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

momentum/marker_tracking/marker_tracker.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,8 @@ std::pair<float, float> getLocatorError(
12331233
// go over all frames and pose the locators and compute the error
12341234
double error = 0.0;
12351235
double maxError = 0.0;
1236+
size_t frameNum = 0.0;
1237+
std::string markerName = "";
12361238
for (size_t iFrame = 0; iFrame < numFrames; ++iFrame) {
12371239
const auto jointParams = pt.apply(motion.col(iFrame));
12381240
state.set(jointParams, character.skeleton, false);
@@ -1261,14 +1263,19 @@ std::pair<float, float> getLocatorError(
12611263
const Vector3f diff = locatorPos - jMarker.pos.cast<float>();
12621264
const float markerError = diff.norm();
12631265
frameError += markerError;
1264-
maxError = std::max(maxError, static_cast<double>(markerError));
1266+
if (markerError > maxError) {
1267+
maxError = markerError;
1268+
frameNum = iFrame;
1269+
markerName = jMarker.name;
1270+
}
12651271
validMarkers++;
12661272
}
12671273

12681274
if (validMarkers > 0) {
12691275
error += frameError / validMarkers;
12701276
}
12711277
}
1278+
MT_LOGI("Max marker error: {} at frame {} for marker {}", maxError, frameNum, markerName);
12721279
return {static_cast<float>(error / numFrames), static_cast<float>(maxError)};
12731280
}
12741281

momentum/marker_tracking/process_markers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Eigen::MatrixXf processMarkers(
5858
Eigen::MatrixXf finalMotion = trackPosesPerframe(inputData, character, identity, trackingConfig);
5959

6060
if (trackingConfig.debug) {
61-
auto errors = getLocatorError(markerData, finalMotion, character);
61+
auto errors = getLocatorError(inputData, finalMotion, character);
6262
MT_LOGI("Average marker error: {}", errors.first);
6363
MT_LOGI("Max marker error: {}", errors.second);
6464
}

0 commit comments

Comments
 (0)