浏览代码

Fix for timestamps

/main
Steven Borkman 4 年前
当前提交
3a765b4f
共有 3 个文件被更改,包括 9 次插入11 次删除
  1. 16
      com.unity.perception/Runtime/GroundTruth/Labelers/AnimationPoseLabel.cs
  2. 2
      com.unity.perception/Runtime/GroundTruth/Labelers/KeyPointLabeler.cs
  3. 2
      com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Randomizers/AnimationRandomizer.cs

16
com.unity.perception/Runtime/GroundTruth/Labelers/AnimationPoseLabel.cs


public class PoseTimestampRecord
{
/// <summary>
/// The duration to use for this timestamp in seconds
/// The point in the clip that the pose starts, a value from 0 (beginning) to 1 (end)
public float duration;
public float startOffset;
/// <summary>
/// The label to use for any captures inside of this time period
/// </summary>

/// <returns>The pose for the passed in time</returns>
public string GetPoseAtTime(float time)
{
var totalTime = 0f;
if (time < 0 || time > 1) return "unset";
// The amount of timestamps are expected to be small, so at the current time
// no performance improvements are deemed necesssary
foreach (var t in timestamps)
var i = 1;
for (i = 1; i < timestamps.Count; i++)
totalTime += t.duration;
if (time < totalTime) return t.poseLabel;
if (timestamps[i].startOffset > time) break;
return timestamps.Last().poseLabel;
return timestamps[i - 1].poseLabel;
}
}
}

2
com.unity.perception/Runtime/GroundTruth/Labelers/KeyPointLabeler.cs


{
if (p.animationClip == clip)
{
var time = clip.length * timeOffset;
var time = timeOffset;
var label = p.GetPoseAtTime(time);
return label;
}

2
com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Randomizers/AnimationRandomizer.cs


animator.applyRootMotion = tag.applyRootMotion;
var overrider = tag.animatorOverrideController;
if (overrider != null)
if (overrider != null && tag.animationClips.GetCategoryCount() > 0)
{
overrider[clipName] = tag.animationClips.Sample();
animator.Play(stateName, 0, m_FloatParameter.Sample());

正在加载...
取消
保存