|
|
|
|
|
|
m_RgbCaptureStream = File.CreateText(m_RgbCaptureFilename); |
|
|
|
|
|
|
|
m_ObjectDetectionFilename = Path.Combine(m_DirectoryName, m_SessionGuid + "_coco_box_annotations.json"); |
|
|
|
m_ObjectDetectionStream = File.CreateText(m_ObjectDetectionFilename); |
|
|
|
if (m_ReportingObjectDetection) |
|
|
|
{ |
|
|
|
m_ObjectDetectionStream = File.CreateText(m_ObjectDetectionFilename); |
|
|
|
m_ObjectDetectionCategoryFilename = Path.Combine(m_DirectoryName, m_SessionGuid + "_coco_obj_detection_categories.json"); |
|
|
|
} |
|
|
|
m_KeypointDetectionStream = File.CreateText(m_KeypointFilename); |
|
|
|
|
|
|
|
m_ObjectDetectionCategoryFilename = Path.Combine(m_DirectoryName, m_SessionGuid + "_coco_obj_detection_categories.json"); |
|
|
|
m_KeypointCategoryFilename = Path.Combine(m_DirectoryName, m_SessionGuid + "_coco_keypoint_categories.json"); |
|
|
|
if (m_ReportingKeypoints) |
|
|
|
{ |
|
|
|
m_KeypointDetectionStream = File.CreateText(m_KeypointFilename); |
|
|
|
m_KeypointCategoryFilename = Path.Combine(m_DirectoryName, m_SessionGuid + "_coco_keypoint_categories.json"); |
|
|
|
} |
|
|
|
|
|
|
|
m_Initialized = true; |
|
|
|
} |
|
|
|
|
|
|
using var sr = new StreamReader(filename); |
|
|
|
var sr = new StreamReader(filename); |
|
|
|
|
|
|
|
var length = (int)sr.BaseStream.Length; |
|
|
|
var start = 0; |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
aggregated.Append(buffer, start, length); |
|
|
|
|
|
|
|
sr.Dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
async Task WriteObjectDetectionFile() |
|
|
|
|
|
|
var filename = Path.Combine(m_DirectoryName, "coco_keypoint_annotations.json"); |
|
|
|
var cocoStream = File.CreateText(filename); |
|
|
|
await cocoStream.WriteAsync(json); |
|
|
|
cocoStream.Close(); |
|
|
|
cocoStream.Dispose(); |
|
|
|
|
|
|
|
Manager.Instance.ConsumerFileProduced(filename); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void OnAnnotationRegistered<TSpec>(Guid annotationId, TSpec[] values) |
|
|
|
{ |
|
|
|
InitializeCaptureFiles(); |
|
|
|
|
|
|
|
if (annotationId.ToString() == BoundingBox2DLabeler.annotationId) |
|
|
|
{ |
|
|
|
m_ReportingObjectDetection = true; |
|
|
|
|
|
|
await m_ObjectDetectionWritingTask; |
|
|
|
|
|
|
|
if (boxJson != string.Empty) |
|
|
|
{ |
|
|
|
InitializeCaptureFiles(); |
|
|
|
} |
|
|
|
{ |
|
|
|
InitializeCaptureFiles(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static Dictionary<int, CocoTypes.ObjectDetectionAnnotation> ProcessBoundingBoxAnnotations(IEnumerable<object> annotations) |
|
|
|