浏览代码

WIP mock of labelers list under PerceptionCamera

/labeler_mock_mb
Jon Hogins 4 年前
当前提交
b40f4cf3
共有 6 个文件被更改,包括 36 次插入24 次删除
  1. 28
      com.unity.perception/Editor/GroundTruth/PerceptionCameraEditor.cs
  2. 6
      com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBoxLabeler.cs
  3. 5
      com.unity.perception/Runtime/GroundTruth/Labelers/InstanceSegmentationLabeler.cs
  4. 5
      com.unity.perception/Runtime/GroundTruth/Labelers/RenderedObjectInfoLabeler.cs
  5. 5
      com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs
  6. 11
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs

28
com.unity.perception/Editor/GroundTruth/PerceptionCameraEditor.cs


public void OnEnable()
{
// m_LabelersList = new ReorderableList(this.serializedObject, this.serializedObject.FindProperty(nameof(PerceptionCamera.labelers)), true, false, true, true);
// m_LabelersList.elementHeightCallback = GetElementHeight;
// m_LabelersList.drawElementCallback = DrawElement;
// m_LabelersList.onAddCallback += OnAdd;
// m_LabelersList.onRemoveCallback += OnRemove;
m_LabelersList = new ReorderableList(this.serializedObject, this.serializedObject.FindProperty(nameof(PerceptionCamera.labelers)), true, false, true, true);
m_LabelersList.elementHeightCallback = GetElementHeight;
m_LabelersList.drawElementCallback = DrawElement;
m_LabelersList.onAddCallback += OnAdd;
m_LabelersList.onRemoveCallback += OnRemove;
throw new System.NotImplementedException();
var serializedProperty = this.serializedObject.FindProperty(nameof(PerceptionCamera.labelers));
var element = serializedProperty.GetArrayElementAtIndex(index);
var editor = Editor.CreateEditor(element.managedReferenceValue);
return 10;
throw new NotImplementedException();
var element = this.serializedObject.FindProperty(nameof(PerceptionCamera.labelers)).GetArrayElementAtIndex(index);
var editor = Editor.CreateEditor(element.managedReferenceValue);
editor.OnInspectorGUI();
}
void OnRemove(ReorderableList list)

void OnAdd(ReorderableList list)
{
throw new System.NotImplementedException();
var labelers = this.serializedObject.FindProperty(nameof(PerceptionCamera.labelers));
labelers.InsertArrayElementAtIndex(0);
var element = labelers.GetArrayElementAtIndex(0);
element.managedReferenceValue = new BoundingBoxLabeler();
serializedObject.ApplyModifiedProperties();
}
public override void OnInspectorGUI()

EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(PerceptionCamera.startTime)));
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(PerceptionCamera.captureRgbImages)));
//m_LabelersList.DoLayoutList();
//EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(PerceptionCamera.labelers)));
m_LabelersList.DoLayoutList();
}
}
}

6
com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBoxLabeler.cs


namespace UnityEngine.Perception.GroundTruth
{
[AddComponentMenu("Perception/Labelers/BoundingBoxLabeler")]
[RequireComponent(typeof(PerceptionCamera))]
[RequireComponent(typeof(RenderedObjectInfoLabeler))]
public class BoundingBoxLabeler : MonoBehaviour
[Serializable]
public class BoundingBoxLabeler : CameraLabeler
{
public string annotationId = "F9F22E05-443F-4602-A422-EBE4EA9B55CB";

5
com.unity.perception/Runtime/GroundTruth/Labelers/InstanceSegmentationLabeler.cs


#endif
namespace UnityEngine.Perception.GroundTruth {
[AddComponentMenu("Perception/Labelers/InstanceSegmentationLabeler")]
[RequireComponent(typeof(Camera))]
[RequireComponent(typeof(PerceptionCamera))]
public class InstanceSegmentationLabeler : MonoBehaviour
public class InstanceSegmentationLabeler : CameraLabeler
{
//Uncomment when we support saving instance segmentation labels
//public bool saveImages = false;

5
com.unity.perception/Runtime/GroundTruth/Labelers/RenderedObjectInfoLabeler.cs


namespace UnityEngine.Perception.GroundTruth
{
[AddComponentMenu("Perception/Labelers/RenderedObjectInfoLabeler")]
[RequireComponent(typeof(InstanceSegmentationLabeler))]
public class RenderedObjectInfoLabeler : MonoBehaviour
[Serializable]
public class RenderedObjectInfoLabeler : CameraLabeler
{
public bool produceObjectInfoMetrics = true;
/// <summary>

5
com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs


#endif
namespace UnityEngine.Perception.GroundTruth {
[AddComponentMenu("Perception/Labelers/SemanticSegmentationLabeler")]
[RequireComponent(typeof(InstanceSegmentationLabeler))]
public class SemanticSegmentationLabeler : MonoBehaviour
[Serializable]
public class SemanticSegmentationLabeler : CameraLabeler
{
const string k_SemanticSegmentationDirectory = "SemanticSegmentation";
const string k_SegmentationFilePrefix = "segmentation_";

11
com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs


/// <summary>
/// Event invoked after the camera finishes rendering during a frame.
/// </summary>
public event Action BeginRendering;
[SerializeReference]
public List<CameraLabeler> labelers = new List<CameraLabeler>();
Dictionary<string, object> m_PersistentSensorData = new Dictionary<string, object>();
#if URP_PRESENT

SensorHandle = default;
}
}
[Serializable]
public abstract class CameraLabeler
{
}
}
正在加载...
取消
保存