public override Status StartRun(SidePacket sidePacket) { hairMaskStreamPoller = graph.AddOutputStreamPoller <GpuBuffer>(hairMaskStream).ConsumeValue(); hairMaskPacket = new GpuBufferPacket(); return(graph.StartRun(sidePacket)); }
public Status StartRun(SidePacket sidePacket) { outputStreamPoller = graph.AddOutputStreamPoller <string>(outputStream).ConsumeValue(); outputPacket = new StringPacket(); return(graph.StartRun(sidePacket)); }
public override Status StartRun(Texture texture) { Debug.Log("This graph is for testing official examples. You can customize the graph by editing `official_demo_gpu.txt` (default is `hand_tracking_mobile.pbtxt`)"); #if !UNITY_ANDROID outputStreamPoller = graph.AddOutputStreamPoller <GpuBuffer>(outputStream).ConsumeValueOrDie(); outputPacket = new GpuBufferPacket(); #endif sidePacket = new SidePacket(); sidePacket.Emplace("num_hands", new IntPacket(2)); #if UNITY_ANDROID var glTextureName = texture.GetNativeTexturePtr(); var textureWidth = texture.width; var textureHeight = texture.height; GpuBuffer gpuBuffer = null; gpuHelper.RunInGlContext(() => { var glContext = GlContext.GetCurrent(); var glTextureBuffer = new GlTextureBuffer((UInt32)glTextureName, textureWidth, textureHeight, GpuBufferFormat.kBGRA32, OnReleaseDestinationTexture, glContext); gpuBuffer = new GpuBuffer(glTextureBuffer); return(Status.Ok()); }).AssertOk(); outputPacket = new GpuBufferPacket(gpuBuffer); sidePacket.Emplace(destinationBufferName, outputPacket); #endif return(graph.StartRun(sidePacket)); }
public override Status StartRun(SidePacket sidePacket) { outputDetectionsStreamPoller = graph.AddOutputStreamPoller <List <Detection> >(outputDetectionsStream).ConsumeValue(); outputDetectionsPacket = new DetectionVectorPacket(); return(graph.StartRun(sidePacket)); }
public override Status StartRun() { handLandmarksStreamPoller = graph.AddOutputStreamPoller <List <NormalizedLandmarkList> >(handLandmarksStream).ConsumeValueOrDie(); handLandmarksPacket = new NormalizedLandmarkListVectorPacket(); handednessStreamPoller = graph.AddOutputStreamPoller <List <ClassificationList> >(handednessStream).ConsumeValueOrDie(); handednessPacket = new ClassificationListVectorPacket(); palmDetectionsStreamPoller = graph.AddOutputStreamPoller <List <Detection> >(palmDetectionsStream).ConsumeValueOrDie(); palmDetectionsPacket = new DetectionVectorPacket(); palmRectsStreamPoller = graph.AddOutputStreamPoller <List <NormalizedRect> >(palmRectsStream).ConsumeValueOrDie(); palmRectsPacket = new NormalizedRectVectorPacket(); handLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(handLandmarksPresenceStream).ConsumeValueOrDie(); handLandmarksPresencePacket = new BoolPacket(); palmDetectionsPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(palmDetectionsPresenceStream).ConsumeValueOrDie(); palmDetectionsPresencePacket = new BoolPacket(); sidePacket = new SidePacket(); sidePacket.Emplace("num_hands", new IntPacket(2)); return(graph.StartRun(sidePacket)); }
public Status StartRun() { outputStreamPoller = calculatorGraph.AddOutputStreamPoller <string>(outputStreamName, true).Value(); outputPacket = new StringPacket(); return(calculatorGraph.StartRun()); }
public override Status StartRun() { hairMaskStreamPoller = graph.AddOutputStreamPoller <ImageFrame>(hairMaskStream).ConsumeValueOrDie(); hairMaskPacket = new ImageFramePacket(); return(graph.StartRun()); }
public Status StartRun() { outputStreamPoller = graph.AddOutputStreamPoller <string>(outputStream).Value(); outputPacket = new StringPacket(); return(graph.StartRun()); }
public override Status StartRun() { outputStreamPoller = graph.AddOutputStreamPoller <GpuBuffer>(outputStream).ConsumeValueOrDie(); outputPacket = new GpuBufferPacket(); return(graph.StartRun()); }
public override Status StartRun(SidePacket sidePacket) { outputStreamPoller = graph.AddOutputStreamPoller <ImageFrame>(outputStream).ConsumeValue(); outputPacket = new ImageFramePacket(); return(graph.StartRun(sidePacket)); }
public override Status StartRun(SidePacket sidePacket) { landmarkStreamPoller = graph.AddOutputStreamPoller <List <Landmark[]> >(landmarkStream).ConsumeValue(); landmarkPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(landmarkPresenceStream).ConsumeValue(); landmarkListPacket = new NormalizedLandmarkListVectorPacket(); landmarkPresencePacket = new BoolPacket(); return(graph.StartRun(sidePacket)); }
public override Status StartRun() { faceDetectionsStreamPoller = graph.AddOutputStreamPoller <List <Detection> >(faceDetectionsStream).ConsumeValueOrDie(); faceDetectionsPacket = new DetectionVectorPacket(); faceDetectionsPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(faceDetectionsPresenceStream).ConsumeValueOrDie(); faceDetectionsPresencePacket = new BoolPacket(); return(graph.StartRun()); }
public override Status StartRun() { #if UNITY_IOS // On iOS, it's faster to get output packets synchronously than asynchronously. outputStreamPoller = graph.AddOutputStreamPoller <ImageFrame>(outputStream).ConsumeValueOrDie(); outputPacket = new ImageFramePacket(); #elif UNITY_EDITOR || !UNITY_ANDROID graph.ObserveOutputStream <ImageFramePacket, ImageFrame>(outputStream, OutputVideoCallback, out outputVideoCallbackHandle).AssertOk(); #endif return(graph.StartRun(sidePacket)); }
public override Status StartRun(Texture texture) { Debug.Log("This graph is for testing official examples. You can customize the graph by editing `official_demo_dekstop_gpu.txt` (default is `hand_tracking_mobile.pbtxt`)"); outputStreamPoller = graph.AddOutputStreamPoller <ImageFrame>(outputStream).ConsumeValueOrDie(); outputPacket = new ImageFramePacket(); sidePacket = new SidePacket(); sidePacket.Emplace("num_hands", new IntPacket(2)); return(graph.StartRun(sidePacket)); }
public override Status StartRun() { if (!IsGpuEnabled()) { return(Status.FailedPrecondition("HairSegmentation is not supported on CPU")); } hairMaskStreamPoller = graph.AddOutputStreamPoller <ImageFrame>(hairMaskStream).Value(); hairMaskPacket = new ImageFramePacket(); return(graph.StartRun()); }
/// <summary> /// Fetch next value from <paramref name="poller" />. /// Note that this method blocks the thread till the next value is fetched. /// If the next value is empty, this method never returns. /// </summary> public T FetchNext <T>(OutputStreamPoller <T> poller, Packet <T> packet, string streamName = null, T failedValue = default(T)) { if (!poller.Next(packet)) // blocks { if (streamName != null) { Debug.LogWarning($"Failed to fetch next packet from {streamName}"); } return(failedValue); } return(packet.Get()); }
public override Status StartRun(SidePacket sidePacket) { multiHandLandmarksStreamPoller = graph.AddOutputStreamPoller <List <NormalizedLandmarkList> >(multiHandLandmarksStream).ConsumeValue(); multiHandLandmarksPacket = new NormalizedLandmarkListVectorPacket(); multiPalmDetectionsStreamPoller = graph.AddOutputStreamPoller <List <Detection> >(multiPalmDetectionsStream).ConsumeValue(); multiPalmDetectionsPacket = new DetectionVectorPacket(); multiPalmRectsStreamPoller = graph.AddOutputStreamPoller <List <NormalizedRect> >(multiPalmRectsStream).ConsumeValue(); multiPalmRectsPacket = new NormalizedRectVectorPacket(); multiPalmDetectionsPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(multiPalmDetectionsPresenceStream).ConsumeValue(); multiPalmDetectionsPresencePacket = new BoolPacket(); return(graph.StartRun(sidePacket)); }
public override Status StartRun() { poseLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(poseLandmarksStream).ConsumeValueOrDie(); poseLandmarksPacket = new NormalizedLandmarkListPacket(); poseDetectionStreamPoller = graph.AddOutputStreamPoller <Detection>(poseDetectionStream).ConsumeValueOrDie(); poseDetectionPacket = new DetectionPacket(); poseLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(poseLandmarksPresenceStream).ConsumeValueOrDie(); poseLandmarksPresencePacket = new BoolPacket(); poseDetectionPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(poseDetectionPresenceStream).ConsumeValueOrDie(); poseDetectionPresencePacket = new BoolPacket(); return(graph.StartRun()); }
public override Status StartRun() { poseLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(poseLandmarksStream).ConsumeValueOrDie(); poseLandmarksPacket = new NormalizedLandmarkListPacket(); poseRoiStreamPoller = graph.AddOutputStreamPoller <NormalizedRect>(poseRoiStream).ConsumeValueOrDie(); poseRoiPacket = new NormalizedRectPacket(); poseDetectionStreamPoller = graph.AddOutputStreamPoller <Detection>(poseDetectionStream).ConsumeValueOrDie(); poseDetectionPacket = new DetectionPacket(); faceLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(faceLandmarksStream).ConsumeValueOrDie(); faceLandmarksPacket = new NormalizedLandmarkListPacket(); leftHandLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(leftHandLandmarksStream).ConsumeValueOrDie(); leftHandLandmarksPacket = new NormalizedLandmarkListPacket(); rightHandLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(rightHandLandmarksStream).ConsumeValueOrDie(); rightHandLandmarksPacket = new NormalizedLandmarkListPacket(); poseLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(poseLandmarksPresenceStream).ConsumeValueOrDie(); poseLandmarksPresencePacket = new BoolPacket(); poseRoiPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(poseRoiPresenceStream).ConsumeValueOrDie(); poseRoiPresencePacket = new BoolPacket(); poseDetectionPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(poseDetectionPresenceStream).ConsumeValueOrDie(); poseDetectionPresencePacket = new BoolPacket(); faceLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(faceLandmarksPresenceStream).ConsumeValueOrDie(); faceLandmarksPresencePacket = new BoolPacket(); leftHandLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(leftHandLandmarksPresenceStream).ConsumeValueOrDie(); leftHandLandmarksPresencePacket = new BoolPacket(); rightHandLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(rightHandLandmarksPresenceStream).ConsumeValueOrDie(); rightHandLandmarksPresencePacket = new BoolPacket(); sidePacket = new SidePacket(); var irisFlag = new BoolPacket(detectIris); sidePacket.Emplace("enable_iris_detection", irisFlag); return(graph.StartRun(sidePacket)); }
public override Status StartRun() { poseLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(poseLandmarksStream).Value(); poseLandmarksPacket = new NormalizedLandmarkListPacket(); poseRoiStreamPoller = graph.AddOutputStreamPoller <NormalizedRect>(poseRoiStream).Value(); poseRoiPacket = new NormalizedRectPacket(); poseDetectionStreamPoller = graph.AddOutputStreamPoller <Detection>(poseDetectionStream).Value(); poseDetectionPacket = new DetectionPacket(); faceLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(faceLandmarksStream).Value(); faceLandmarksPacket = new NormalizedLandmarkListPacket(); leftHandLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(leftHandLandmarksStream).Value(); leftHandLandmarksPacket = new NormalizedLandmarkListPacket(); rightHandLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(rightHandLandmarksStream).Value(); rightHandLandmarksPacket = new NormalizedLandmarkListPacket(); poseLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(poseLandmarksPresenceStream).Value(); poseLandmarksPresencePacket = new BoolPacket(); poseRoiPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(poseRoiPresenceStream).Value(); poseRoiPresencePacket = new BoolPacket(); poseDetectionPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(poseDetectionPresenceStream).Value(); poseDetectionPresencePacket = new BoolPacket(); faceLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(faceLandmarksPresenceStream).Value(); faceLandmarksPresencePacket = new BoolPacket(); leftHandLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(leftHandLandmarksPresenceStream).Value(); leftHandLandmarksPresencePacket = new BoolPacket(); rightHandLandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(rightHandLandmarksPresenceStream).Value(); rightHandLandmarksPresencePacket = new BoolPacket(); sidePacket = new SidePacket(); sidePacket.Emplace("enable_iris_detection", new BoolPacket(detectIris)); sidePacket.Emplace("model_complexity", new IntPacket((int)modelComplexity)); sidePacket.Emplace("smooth_landmarks", new BoolPacket(smoothLandmarks)); return(graph.StartRun(sidePacket)); }
public override Status StartRun(SidePacket sidePacket) { faceLandmarksWithIrisStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(faceLandmarksWithIrisStream).ConsumeValue(); faceLandmarksWithIrisPacket = new NormalizedLandmarkListPacket(); faceRectStreamPoller = graph.AddOutputStreamPoller <NormalizedRect>(faceRectStream).ConsumeValue(); faceRectPacket = new NormalizedRectPacket(); faceDetectionsStreamPoller = graph.AddOutputStreamPoller <List <Detection> >(faceDetectionsStream).ConsumeValue(); faceDetectionsPacket = new DetectionVectorPacket(); faceLandmarksWithIrisPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(faceLandmarksWithIrisPresenceStream).ConsumeValue(); faceLandmarksWithIrisPresencePacket = new BoolPacket(); faceDetectionsPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(faceDetectionsPresenceStream).ConsumeValue(); faceDetectionsPresencePacket = new BoolPacket(); return(graph.StartRun(sidePacket)); }
public override Status StartRun(SidePacket sidePacket) { handednessStreamPoller = graph.AddOutputStreamPoller <ClassificationList>(handednessStream).ConsumeValue(); handednessPacket = new ClassificationListPacket(); handRectStreamPoller = graph.AddOutputStreamPoller <NormalizedRect>(handRectStream).ConsumeValue(); handRectPacket = new NormalizedRectPacket(); handLandmarksStreamPoller = graph.AddOutputStreamPoller <NormalizedLandmarkList>(handLandmarksStream).ConsumeValue(); handLandmarksPacket = new NormalizedLandmarkListPacket(); palmDetectionsStreamPoller = graph.AddOutputStreamPoller <List <Detection> >(palmDetectionsStream).ConsumeValue(); palmDetectionsPacket = new DetectionVectorPacket(); palmDetectionsPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(palmDetectionsPresenceStream).ConsumeValue(); palmDetectionsPresencePacket = new BoolPacket(); return(graph.StartRun(sidePacket)); }
public override Status StartRun() { multiFaceLandmarksStreamPoller = graph.AddOutputStreamPoller <List <NormalizedLandmarkList> >(multiFaceLandmarksStream).ConsumeValueOrDie(); multiFaceLandmarksPacket = new NormalizedLandmarkListVectorPacket(); faceRectsFromLandmarksStreamPoller = graph.AddOutputStreamPoller <List <NormalizedRect> >(faceRectsFromLandmarksStream).ConsumeValueOrDie(); faceRectsFromLandmarksPacket = new NormalizedRectVectorPacket(); faceDetectionsStreamPoller = graph.AddOutputStreamPoller <List <Detection> >(faceDetectionsStream).ConsumeValueOrDie(); faceDetectionsPacket = new DetectionVectorPacket(); multiFacelandmarksPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(multiFaceLandmarksPresenceStream).ConsumeValueOrDie(); multiFaceLandmarksPresencePacket = new BoolPacket(); faceDetectionsPresenceStreamPoller = graph.AddOutputStreamPoller <bool>(faceDetectionsPresenceStream).ConsumeValueOrDie(); faceDetectionsPresencePacket = new BoolPacket(); sidePacket = new SidePacket(); sidePacket.Emplace("num_faces", new IntPacket(numFaces)); return(graph.StartRun(sidePacket)); }
public void InitOutputStreamPoller() { outputStreamPoller = AddOutputStreamPoller <string>(outputStream).ConsumeValue(); }
/// <summary> /// Fetch next vector value from <paramref name="poller" />. /// </summary> /// <returns> /// Fetched vector or an empty List when failed. /// </returns> /// <seealso cref="FetchNext" /> public List <T> FetchNextVector <T>(OutputStreamPoller <List <T> > poller, Packet <List <T> > packet, string streamName = null) { var nextValue = FetchNext <List <T> >(poller, packet, streamName); return(nextValue == null ? new List <T>() : nextValue); }
public override Status StartRun(SidePacket sidePacket) { outputStreamPoller = graph.AddOutputStreamPoller<GpuBuffer>(outputStream).ConsumeValue(); outputPacket = new GpuBufferPacket(); return graph.StartRun(sidePacket); }