比较提交

...
此合并请求有变更与目标分支冲突。
/com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml
/com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs
/com.unity.perception/Runtime/Randomization/Randomizers/Randomizer.cs
/com.unity.perception/Runtime/Randomization/Scenarios/UnitySimulationScenario.cs
/com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs
/com.unity.perception/Runtime/GroundTruth/DatasetCapture.cs
/com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs
/com.unity.perception/Runtime/GroundTruth/SimulationState.cs

5 次代码提交

作者 SHA1 备注 提交日期
Steven Borkman 3519b058 Fix problem with normal sampler 4 年前
Steven Borkman 3c3df890 Fixed merge issue 4 年前
Steven Borkman a0db5c1b Some small fixes post merge 4 年前
Steven Borkman b45e3ea8 Merge branch 'master' into fod_generator_randomization_changes 4 年前
Steven Borkman 6f2d79a2 A couple of changes to scenario 4 年前
共有 12 个文件被更改,包括 69 次插入5 次删除
  1. 2
      com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml
  2. 7
      com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs
  3. 5
      com.unity.perception/Runtime/GroundTruth/DatasetCapture.cs
  4. 10
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs
  5. 19
      com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs
  6. 8
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs
  7. 1
      com.unity.perception/Runtime/Randomization/Randomizers/Randomizer.cs
  8. 2
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioConstants.cs
  9. 9
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs
  10. 3
      com.unity.perception/Runtime/Randomization/Scenarios/UnitySimulationScenario.cs
  11. 6
      com.unity.perception/Runtime/Randomization/Samplers/SamplerTypes/UniformSampler.cs
  12. 2
      com.unity.perception/Runtime/Randomization/Samplers/SamplerUtility.cs

2
com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml


<Foldout style="padding-left: 16px" text="Constants" name="constants-list" tooltip="A list of parameters for this scenario that will be JSON serialized in the configuration file."/>
<editor:PropertyField name="configuration-file-name" label="Constants File Name" binding-path="serializedConstantsFileName"/>
<VisualElement style="flex-direction: row;">
<Button name="random" text="Generate Random Seed" style="flex-grow: 1;"
tooltip="Creates a new random seed"/>
<Button name="generate-json-config" text="Generate JSON Config" style="flex-grow: 1;"
tooltip="Serializes scenario constants and randomizer settings to a JSON configuration file"/>
<Button name="import-json-config" text="Import JSON Config" style="flex-grow: 1;"

7
com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs


using UnityEngine;
using UnityEngine.Perception.Randomization.Scenarios;
using UnityEngine.UIElements;
using Random = UnityEngine.Random;
namespace UnityEditor.Perception.Randomization
{

CreatePropertyFields();
CheckIfConstantsExist();
var randomSeedButton = m_Root.Q<Button>("random");
randomSeedButton.clicked += () =>
{
m_Scenario.genericConstants.randomSeed = (uint)Random.Range(int.MinValue, int.MaxValue);
};
var generateConfigButton = m_Root.Q<Button>("generate-json-config");
generateConfigButton.clicked += () =>

5
com.unity.perception/Runtime/GroundTruth/DatasetCapture.cs


return ego;
}
public static void AddMetadata(string key, object value)
{
SimulationState.AddMetadata(key, value);
}
/// <summary>
/// Register a new sensor under the given ego.
/// </summary>

10
com.unity.perception/Runtime/GroundTruth/SimulationState.cs


Dictionary<SensorHandle, SensorData> m_Sensors = new Dictionary<SensorHandle, SensorData>();
HashSet<EgoHandle> m_Egos = new HashSet<EgoHandle>();
HashSet<Guid> m_Ids = new HashSet<Guid>();
Dictionary<string, object> m_Metadata = new Dictionary<string, object>();
Guid m_SequenceId = Guid.NewGuid();
//Always use the property SequenceTimeMs instead

m_Ids.Add(egoHandle.Id);
}
public void AddMetadata(string key, object value)
{
if (!m_Metadata.ContainsKey(key)) m_Metadata[key] = null;
m_Metadata[key] = value;
}
public bool IsEnabled(SensorHandle sensorHandle) => m_ActiveSensors.Contains(sensorHandle);

Debug.LogError($"Simulation ended with pending metrics: {string.Join(", ", m_PendingMetrics.Select(c => $"id:{c.MetricId} step:{c.Step}"))}");
WriteReferences();
// TODO write metadata here
WriteMetadata();
Time.captureDeltaTime = 0;
IsRunning = false;
}

19
com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs


{
const Formatting k_Formatting = Formatting.Indented;
public void WriteMetadata()
{
var metadata = new JObject();
metadata["version"] = DatasetCapture.SchemaVersion;
metadata["per_file_size"] = k_MinPendingMetricsBeforeWrite;
foreach (var md in m_Metadata)
{
metadata[md.Key] = JToken.FromObject(md.Value);
}
//metadata["dataset_size"] = 500;
//metadata["per_file_size"] = 150;
//metadata["image_width"] = 1024;
//metadata["image_height"] = 768;
WriteJObjectToFile(metadata, "metadata.json");
}
/// <summary>
/// Writes sensors.json, egos.json, metric_definitions.json, and annotation_definitions.json
/// </summary>

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


inMatrix[2,0],inMatrix[2,1], inMatrix[2,2]);
}
int m_CaptureCount = 0;
void CaptureRgbData(Camera cam)
{
if (!captureRgbImages)

#else
CaptureCamera.Capture(cam, colorFunctor, flipY: flipY);
#endif
DatasetCapture.AddMetadata("image_width", attachedCamera.pixelWidth);
DatasetCapture.AddMetadata("image_height", attachedCamera.pixelHeight);
DatasetCapture.AddMetadata("dataset_size", ++m_CaptureCount);
Profiler.EndSample();
}

action(labeler);
}
}
private bool ShouldCallLabelers(Camera cam, int lastFrameCalledThisCallback)

1
com.unity.perception/Runtime/Randomization/Randomizers/Randomizer.cs


/// </summary>
protected virtual void OnUpdate() { }
public virtual void OnDrawGizmos() { }
#region InternalScenarioMethods
internal void Awake() => OnAwake();

2
com.unity.perception/Runtime/Randomization/Scenarios/ScenarioConstants.cs


/// </summary>
[Tooltip("The starting value initializing all random value sequences generated through Samplers, Parameters, and Randomizers attached to a Scenario")]
public uint randomSeed = SamplerUtility.largePrime;
public uint startFrame = 0;
}
}

9
com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs


protected virtual void OnEnable()
{
activeScenario = this;
currentIteration = (int)genericConstants.startFrame;
}
/// <summary>

// Iterate scenario frame count
currentIterationFrame++;
framesSinceInitialization++;
}
void OnDrawGizmos()
{
foreach (var randomizer in activeRandomizers)
{
randomizer.OnDrawGizmos();
}
}
/// <summary>

3
com.unity.perception/Runtime/Randomization/Scenarios/UnitySimulationScenario.cs


}
else
base.OnConfigurationImport();
currentIteration = constants.instanceIndex;
currentIteration = (int)constants.startFrame;
}
/// <inheritdoc/>

6
com.unity.perception/Runtime/Randomization/Samplers/SamplerTypes/UniformSampler.cs


}
/// <summary>
/// Constructs a new uniform distribution sampler
/// Constructs a new uniform distribution sampler with the interval [min, max)
/// <param name="min">The smallest value contained within the range</param>
/// <param name="max">The largest value contained within the range</param>
/// <param name="min">The smallest value contained within the range (inclusive)</param>
/// <param name="max">The largest value contained within the range (exclusive)</param>
public UniformSampler(float min, float max)
{
range = new FloatRange(min, max);

2
com.unity.perception/Runtime/Randomization/Samplers/SamplerUtility.cs


return min;
var stdTruncNorm = NormalCdfInverse(c);
return stdTruncNorm * stdDev + mean;
return math.clamp(stdTruncNorm * stdDev + mean, min, max);
}
/// <summary>

正在加载...
取消
保存