浏览代码

First release of writing out COCO and perception format in parallel

/coco_perception_output_hybrid
Steve Borkman 3 年前
当前提交
8eaa1a4f
共有 5 个文件被更改,包括 75 次插入1 次删除
  1. 4
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs
  2. 8
      com.unity.perception/Runtime/GroundTruth/Exporters/CocoHybrid.meta
  3. 53
      com.unity.perception/Runtime/GroundTruth/Exporters/CocoHybrid/CocoHybridExporter.cs
  4. 11
      com.unity.perception/Runtime/GroundTruth/Exporters/CocoHybrid/CocoHybridExporter.cs.meta

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


using UnityEngine;
using UnityEngine.Perception.GroundTruth.Exporters;
using UnityEngine.Perception.GroundTruth.Exporters.Coco;
using UnityEngine.Perception.GroundTruth.Exporters.CocoHybrid;
using UnityEngine.Perception.GroundTruth.Exporters.PerceptionFormat;
using UnityEngine.Perception.GroundTruth.Exporters.PerceptionNew;
using UnityEngine.Profiling;

_ActiveReporter = new PerceptionExporter();
break;
case nameof(CocoExporter):
_ActiveReporter = new CocoExporter();
//_ActiveReporter = new CocoExporter();
_ActiveReporter = new CocoHybridExporter();
break;
case nameof(PerceptionNewExporter):
_ActiveReporter = new PerceptionNewExporter();

8
com.unity.perception/Runtime/GroundTruth/Exporters/CocoHybrid.meta


fileFormatVersion: 2
guid: 71de1979b5988b34d8d7e41110c57c56
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

53
com.unity.perception/Runtime/GroundTruth/Exporters/CocoHybrid/CocoHybridExporter.cs


using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine.Perception.GroundTruth.Exporters.Coco;
using UnityEngine.Perception.GroundTruth.Exporters.PerceptionFormat;
namespace UnityEngine.Perception.GroundTruth.Exporters.CocoHybrid
{
public class CocoHybridExporter : IDatasetExporter
{
CocoExporter m_Coco = new CocoExporter();
PerceptionExporter m_Perception = new PerceptionExporter();
public string GetRgbCaptureFilename(params (string, object)[] additionalSensorValues)
{
return m_Coco.GetRgbCaptureFilename(additionalSensorValues) + m_Perception.GetRgbCaptureFilename(additionalSensorValues);
}
public void OnSimulationBegin(string directoryName)
{
m_Coco.OnSimulationBegin(directoryName + "_coco");
m_Perception.OnSimulationBegin(directoryName);
}
public void OnSimulationEnd()
{
m_Coco.OnSimulationEnd();
m_Perception.OnSimulationEnd();
}
public void OnAnnotationRegistered<TSpec>(Guid annotationId, TSpec[] values)
{
m_Coco.OnAnnotationRegistered(annotationId, values);
m_Perception.OnAnnotationRegistered(annotationId, values);
}
public async Task ProcessPendingCaptures(List<SimulationState.PendingCapture> pendingCaptures, SimulationState simState)
{
var cocoTask = m_Coco.ProcessPendingCaptures(pendingCaptures, simState);
var perceptionTask = m_Perception.ProcessPendingCaptures(pendingCaptures, simState);
await cocoTask;
await perceptionTask;
}
public async Task OnCaptureReported(int frame, int width, int height, string filename)
{
var cocoTask = m_Coco.OnCaptureReported(frame, width, height, filename);
var perceptionTask = m_Perception.OnCaptureReported(frame, width, height, filename);
await cocoTask;
await perceptionTask;
}
}
}

11
com.unity.perception/Runtime/GroundTruth/Exporters/CocoHybrid/CocoHybridExporter.cs.meta


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