Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Descriptor rework, counterexamples, and bug fixes #7

Merged

Conversation

syntheticmagus
Copy link
Contributor

@syntheticmagus syntheticmagus commented Oct 26, 2023

Significant rework of descriptors, changing the distance arithmetic to have consistent practices across descriptors. The also brings in support for counterexamples, numerous bug fixes, and implementation changes/cleanup affecting issues including improved resampling and better support for framerate independence.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 26, 2023
@syntheticmagus syntheticmagus mentioned this pull request Oct 26, 2023
@syntheticmagus syntheticmagus changed the title Descriptor rework Descriptor rework, counterexamples, and bug fixes Oct 26, 2023
@syntheticmagus syntheticmagus marked this pull request as ready for review October 26, 2023 23:43
Comment on lines -378 to +384
auto ets = EgocentricTemporalSpace::getPose(priorWristPosition, priorHmdPose);
auto ets = EgocentricTemporalSpace::getPose(wristPosition, hmdPose);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change switches the egocentric temporal space from being that of the prior frame to that of the current frame. This prevents this descriptor from being framerate-dependent.

Comment on lines -94 to +102
if (currentRow[idx] < minimum)
size_t connectionsCount = std::max(idx, b.size());
if (currentRow[idx] / connectionsCount < minimum)
{
minimumIdx = idx;
minimum = currentRow[minimumIdx];
minimum = currentRow[minimumIdx] / connectionsCount;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug fixed by this --- that injective distance, with its inherent ability to accept matches with varying numbers of pairings, will overwhelmingly bias toward short projections unless normalization is considered --- had been affecting CARL since injective DTW was introduced at the very beginning.

static_cast<size_t>(
(original.getEndTimestamp() - original.getStartTimestamp()) / frameDuration),
1);
size_t newSamplesCount = std::max<size_t>(static_cast<size_t>(std::ceil((endTimestamp - startTimestamp) / frameDuration)), 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's subtle, but the inclusion of std::ceil in this equation is also a significant bug fix. Without that, the last sample of a resampling will typically be from before endTimestamp, which in very short actions at slow framerates can cause the final pose of the action to be "sampled out." By adding ceil, an additionally sample is typically introduced, ensuring that the final pose of the example is represented in the resampling.

Comment on lines -65 to -66
double t = (timestamp - original.getStartTimestamp()) /
(original.getEndTimestamp() - original.getStartTimestamp());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the kind of bug that makes me question whether the bug knows something I no longer remember. It's unsurprising that this wouldn't have caused much of a problem since it would have simply done the wrong interpolation between two sequential samples, which should vary timing by only a very tiny amount. However, with the introduction of std::ceil mentioned above, timestamp can sometimes have values larger than endTimestamp, which could theoretically extrapolate samples that were never implied by the original recording.

@@ -134,104 +143,136 @@ namespace carl::action
using SignalT = Signal<gsl::span<const InputSample>>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a few bug fixes here; this method was basically rewritten because it didn't work at all before, which makes sense as it was all but untested without a usable integration.

Comment on lines +298 to +299
m_tuning[idx] = 1;/*t * DescriptorT::DEFAULT_TUNING[idx] +
(1. - t) * (1. / std::max(averageDistances[idx], kAverageDistanceEpsilon));*/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-tuning is essentially disabled at the moment. This situation will not last, but it remains to be explored whether tuning should be adapted to a new meaning ("leniency" or something like that) or eliminated entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8

@syntheticmagus syntheticmagus merged commit d955304 into facebookexperimental:main Oct 27, 2023
1 check passed
@syntheticmagus syntheticmagus deleted the descriptorRework branch October 27, 2023 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants