浏览代码

Model based occludder distance overrides

/keypoint_self_occlusion
Steve Borkman 3 年前
当前提交
ea4d3b1d
共有 4 个文件被更改,包括 100 次插入9 次删除
  1. 19
      com.unity.perception/Runtime/GroundTruth/Labelers/CocoKeypointTemplate.asset
  2. 49
      com.unity.perception/Runtime/GroundTruth/Labelers/KeypointLabeler.cs
  3. 30
      com.unity.perception/Runtime/GroundTruth/Labelers/KeypointOcclusionOverrides.cs
  4. 11
      com.unity.perception/Runtime/GroundTruth/Labelers/KeypointOcclusionOverrides.cs.meta

19
com.unity.perception/Runtime/GroundTruth/Labelers/CocoKeypointTemplate.asset


m_Script: {fileID: 11500000, guid: 37a7d6f1a40c45a2981a6291f0d03337, type: 3}
m_Name: CocoKeypointTemplate
m_EditorClassIdentifier:
templateID: 4a7b253a-334e-460c-bc81-3f4e2c4871c0
templateName: Coco
jointTexture: {fileID: 2800000, guid: e381cbaaf29614168bafc8f7ec5dbfe9, type: 3}
skeletonTexture: {fileID: 2800000, guid: e381cbaaf29614168bafc8f7ec5dbfe9, type: 3}

rigLabel: 0
color: {r: 1, g: 0, b: 0, a: 1}
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.2
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.3
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.15
selfOcclusionDistance: 0.033
selfOcclusionDistance: 0.033
selfOcclusionDistance: 0.05
selfOcclusionDistance: 0.05
skeleton:
- joint1: 0
joint2: 1

49
com.unity.perception/Runtime/GroundTruth/Labelers/KeypointLabeler.cs


/// </summary>
public IdLabelConfig idLabelConfig;
public float visThickness = 6;
public bool drawBones = true;
/// <summary>
/// Controls which objects will have keypoints recorded in the dataset.
/// <see cref="KeypointObjectFilter"/>

public Animator animator;
public KeypointEntry keypoints;
public List<(JointLabel, int)> overrides;
public float occlusionScalar;
}
Dictionary<uint, CachedData> m_KnownStatus;

status = false,
animator = null,
keypoints = new KeypointEntry(),
overrides = new List<(JointLabel, int)>()
overrides = new List<(JointLabel, int)>(),
occlusionScalar = 1.0f
};
var entityGameObject = labeledEntity.gameObject;

}
}
var occlusionOverrider = labeledEntity.GetComponent<KeypointOcclusionOverrides>();
if (occlusionOverrider != null)
{
cached.occlusionScalar = occlusionOverrider.overrideDistanceScale;
}
m_KnownStatus[labeledEntity.instanceId] = cached;
}

if (bone != null)
{
var bonePosition = bone.position;
var jointSelfOcclusionDistance = JointSelfOcclusionDistance(bone, bonePosition, cameraPosition, cameraforward, pt.selfOcclusionDistance);
// Check to see if
var occlusionDistance = pt.selfOcclusionDistance * cachedData.occlusionScalar;
var jointSelfOcclusionDistance = JointSelfOcclusionDistance(bone, bonePosition, cameraPosition, cameraforward, occlusionDistance);
InitKeypoint(bonePosition, cachedData, checkLocationsSlice, i, jointSelfOcclusionDistance);
}
}

/// <inheritdoc/>
protected override void OnVisualize()
{
// TODO - remove this, it is just for debugging
hudPanel.UpdateEntry(this, "frame", m_CurrentFrame.ToString());
// END OF TODO
if (m_KeypointEntriesToReport == null) return;
using (k_OnVisualizeMarker.Auto())
{

foreach (var entry in m_KeypointEntriesToReport)
{
foreach (var bone in activeTemplate.skeleton)
if (drawBones)
var joint1 = GetKeypointForJoint(entry, bone.joint1);
var joint2 = GetKeypointForJoint(entry, bone.joint2);
foreach (var bone in activeTemplate.skeleton)
{
var joint1 = GetKeypointForJoint(entry, bone.joint1);
var joint2 = GetKeypointForJoint(entry, bone.joint2);
if (joint1 != null && joint1.Value.state == 2 && joint2 != null && joint2.Value.state == 2)
{
VisualizationHelper.DrawLine(joint1.Value.x, joint1.Value.y, joint2.Value.x, joint2.Value.y, bone.color, 8, skeletonTexture);
if (joint1 != null && joint1.Value.state == 2 && joint2 != null && joint2.Value.state == 2)
{
VisualizationHelper.DrawLine(joint1.Value.x, joint1.Value.y, joint2.Value.x, joint2.Value.y, bone.color, visThickness, skeletonTexture);
}
#if false
var color = keypoint.state == 1 ? Color.black : activeTemplate.keypoints[keypoint.index].color;
if (keypoint.state > 0)
VisualizationHelper.DrawPoint(keypoint.x, keypoint.y, color, visualizationBaseSize * activeTemplate.keypoints[keypoint.index].selfOcclusionDistance, jointTexture);
#else
VisualizationHelper.DrawPoint(keypoint.x, keypoint.y, activeTemplate.keypoints[keypoint.index].color, 8, jointTexture);
VisualizationHelper.DrawPoint(keypoint.x, keypoint.y, activeTemplate.keypoints[keypoint.index].color, visThickness, jointTexture);
#endif
}
}
}

30
com.unity.perception/Runtime/GroundTruth/Labelers/KeypointOcclusionOverrides.cs


using System;
using System.Collections.Generic;
namespace UnityEngine.Perception.GroundTruth
{
[Serializable]
public struct KeypointOcclusionOverride
{
public string label;
public float distance;
}
public class KeypointOcclusionOverrides : MonoBehaviour
{
public float overrideDistanceScale = 1.0f;
#if false
public Dictionary<string, float> overridesMap { get; private set; }
public List<KeypointOcclusionOverride> keypointOcclusionOverrides;
void Start()
{
overridesMap = new Dictionary<string, float>(keypointOcclusionOverrides.Count);
foreach (var kpOverride in keypointOcclusionOverrides)
{
overridesMap[kpOverride.label] = kpOverride.distance;
}
}
#endif
}
}

11
com.unity.perception/Runtime/GroundTruth/Labelers/KeypointOcclusionOverrides.cs.meta


fileFormatVersion: 2
guid: e489de1fb596113408b951f93430150b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存