浏览代码

Switched over to newtonsoft json so we can properly write out skeleton info

/coco_export
Steve Borkman 3 年前
当前提交
f7dacddd
共有 2 个文件被更改,包括 41 次插入4 次删除
  1. 27
      com.unity.perception/Runtime/GroundTruth/Exporters/Coco/CocoExporter.cs
  2. 18
      com.unity.perception/Runtime/GroundTruth/Exporters/Coco/CocoTypes.cs

27
com.unity.perception/Runtime/GroundTruth/Exporters/Coco/CocoExporter.cs


}
}
#if false
#else
var builder = new StringBuilder();
var sw = new StringWriter(builder);
var serializer = new JsonSerializer();
using (var writer = new JsonTextWriter(sw))
{
serializer.Serialize(writer, merged);
}
var json = builder.ToString();
#endif
m_KeypointCategoryWritingTask = m_KeypointCategoryStream.WriteAsync(json);
}
}

else
keypointJson += ",";
keypointJson += JsonUtility.ToJson(kp);
var builder = new StringBuilder();
var stringWriter = new StringWriter(builder);
var serializer = new JsonSerializer();
using (var writer = new JsonTextWriter(stringWriter))
{
serializer.Serialize(writer, kp);
}
keypointJson += builder.ToString();
}
}
}

18
com.unity.perception/Runtime/GroundTruth/Exporters/Coco/CocoTypes.cs


using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace UnityEngine.Perception.GroundTruth.Exporters.Coco
{

[Serializable]
public class ObjectDetectionAnnotation
{
[JsonProperty(Order = -2)]
[JsonProperty(Order = -2)]
[JsonProperty(Order = -2)]
[JsonProperty(Order = -2)]
[JsonProperty(Order = -2)]
[JsonProperty(Order = -2)]
[JsonProperty(Order = -2)]
public int iscrowd;
public static ObjectDetectionAnnotation FromBoundingBoxValue(BoundingBox2DLabeler.BoundingBoxValue bbox)

[Serializable]
public class ObjectDetectionCategory
{
[JsonProperty(Order = -2)]
public string name;
public string supercategory;
[JsonProperty(Order = -2)]
public string name = string.Empty;
[JsonProperty(Order = -2)]
public string supercategory = string.Empty;
}
[Serializable]

public class KeypointAnnotation : ObjectDetectionAnnotation
{
public int num_keypoints;
public int num_keypoints;
public void CopyObjectDetectionData(ObjectDetectionAnnotation objDetection)
{

正在加载...
取消
保存