From 806ea463489b1d1240638ed1471430d5136597eb Mon Sep 17 00:00:00 2001 From: Junrou Nishida Date: Sat, 2 Sep 2023 09:46:45 +0900 Subject: [PATCH] refactor(sample): more kind logging in the sample app (#1018) * call Debug.Log in the sample app * make Bootstrap error message more suggestive * update README --- .../Samples/Common/Scripts/AssetLoader.cs | 15 +++++---------- .../Samples/Common/Scripts/Bootstrap.cs | 4 +++- .../Samples/Common/Scripts/GraphRunner.cs | 16 ++++++++-------- .../Common/Scripts/ImageSource/TextureFrame.cs | 8 ++++---- .../Scripts/ImageSource/TextureFramePool.cs | 2 +- .../Common/Scripts/ImageSource/WebCamSource.cs | 6 +++--- .../Common/Scripts/ImageSourceSolution.cs | 4 ++-- .../Samples/Scenes/AppSettings.asset | 3 +-- .../Scenes/Face Detection/FaceDetectionGraph.cs | 4 ++-- .../Samples/Scenes/Face Mesh/FaceMeshGraph.cs | 8 ++++---- .../Hair Segmentation/HairSegmentationGraph.cs | 3 ++- .../Scenes/Hand Tracking/HandTrackingGraph.cs | 8 ++++---- .../Scenes/Holistic/HolisticTrackingGraph.cs | 16 ++++++++-------- .../Scenes/Pose Tracking/PoseTrackingGraph.cs | 14 +++++++------- .../SelfieSegmentationGraph.cs | 3 ++- .../Tasks/Face Detection/FaceDetectorRunner.cs | 2 +- .../FaceLandmarkerRunner.cs | 2 +- .../HandLandmarkerRunner.cs | 2 +- README.md | 2 +- 19 files changed, 60 insertions(+), 62 deletions(-) diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/AssetLoader.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/AssetLoader.cs index b5d36508c..7153d80a8 100644 --- a/Assets/MediaPipeUnity/Samples/Common/Scripts/AssetLoader.cs +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/AssetLoader.cs @@ -5,24 +5,22 @@ // https://opensource.org/licenses/MIT. using System.Collections; +using UnityEngine; -namespace Mediapipe.Unity +namespace Mediapipe.Unity.Sample { public static class AssetLoader { private static ResourceManager _ResourceManager; - public static void Provide(ResourceManager manager) - { - _ResourceManager = manager; - } + public static void Provide(ResourceManager manager) => _ResourceManager = manager; public static IEnumerator PrepareAssetAsync(string name, string uniqueKey, bool overwrite = false) { if (_ResourceManager == null) { #if UNITY_EDITOR - Logger.LogWarning("ResourceManager is not provided, so default LocalResourceManager will be used"); + Debug.LogWarning("ResourceManager is not provided, so default LocalResourceManager will be used"); _ResourceManager = new LocalResourceManager(); #else throw new System.InvalidOperationException("ResourceManager is not provided"); @@ -31,9 +29,6 @@ public static IEnumerator PrepareAssetAsync(string name, string uniqueKey, bool return _ResourceManager.PrepareAssetAsync(name, uniqueKey, overwrite); } - public static IEnumerator PrepareAssetAsync(string name, bool overwrite = false) - { - return PrepareAssetAsync(name, name, overwrite); - } + public static IEnumerator PrepareAssetAsync(string name, bool overwrite = false) => PrepareAssetAsync(name, name, overwrite); } } diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/Bootstrap.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/Bootstrap.cs index 3c4182b6d..ed872ce55 100644 --- a/Assets/MediaPipeUnity/Samples/Common/Scripts/Bootstrap.cs +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/Bootstrap.cs @@ -24,6 +24,7 @@ private void OnEnable() private IEnumerator Init() { + Debug.Log("The configuration for the sample app can be modified using AppSettings.asset."); #if !DEBUG && !DEVELOPMENT_BUILD Debug.LogWarning("Logging for the MediaPipeUnityPlugin will be suppressed. To enable logging, please check the 'Development Build' option and build."); #endif @@ -56,7 +57,8 @@ private IEnumerator Init() AssetLoader.Provide(new LocalResourceManager()); break; #else - Debug.LogError("LocalResourceManager is only supported on UnityEditor"); + Debug.LogError("LocalResourceManager is only supported on UnityEditor." + + "To avoid this error, consider switching to the StreamingAssetsResourceManager and copying the required resources under StreamingAssets, for example."); yield break; #endif } diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/GraphRunner.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/GraphRunner.cs index 4c3f3d544..373a51d73 100644 --- a/Assets/MediaPipeUnity/Samples/Common/Scripts/GraphRunner.cs +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/GraphRunner.cs @@ -13,7 +13,7 @@ using Stopwatch = System.Diagnostics.Stopwatch; -namespace Mediapipe.Unity +namespace Mediapipe.Unity.Sample { public abstract class GraphRunner : MonoBehaviour { @@ -113,14 +113,14 @@ public virtual IEnumerator Initialize(RunningMode runningMode) { this.runningMode = runningMode; - Logger.LogInfo(TAG, $"Config Type = {configType}"); - Logger.LogInfo(TAG, $"Running Mode = {runningMode}"); + Debug.Log($"Config Type = {configType}"); + Debug.Log($"Running Mode = {runningMode}"); InitializeCalculatorGraph(); _stopwatch = new Stopwatch(); _stopwatch.Start(); - Logger.LogInfo(TAG, "Loading dependent assets..."); + Debug.Log("Loading dependent assets..."); var assetRequests = RequestDependentAssets(); yield return new WaitWhile(() => assetRequests.Any((request) => request.keepWaiting)); @@ -129,7 +129,7 @@ public virtual IEnumerator Initialize(RunningMode runningMode) { foreach (var error in errors) { - Logger.LogError(TAG, error); + Debug.LogError(error); } throw new InternalException("Failed to prepare dependent assets"); } @@ -155,7 +155,7 @@ public virtual void Stop() } catch (BadStatusException exception) { - Logger.LogError(TAG, exception.Message); + Debug.LogError(exception); } try @@ -164,7 +164,7 @@ public virtual void Stop() } catch (BadStatusException exception) { - Logger.LogError(TAG, exception.Message); + Debug.LogError(exception); } } @@ -278,7 +278,7 @@ protected void SetImageTransformationOptions(PacketMap sidePacket, ImageSource i inputVerticallyFlipped = !inputVerticallyFlipped; } - Logger.LogDebug($"input_rotation = {inputRotation}, input_horizontally_flipped = {inputHorizontallyFlipped}, input_vertically_flipped = {inputVerticallyFlipped}"); + Debug.Log($"input_rotation = {inputRotation}, input_horizontally_flipped = {inputHorizontallyFlipped}, input_vertically_flipped = {inputVerticallyFlipped}"); sidePacket.Emplace("input_rotation", new IntPacket((int)inputRotation)); sidePacket.Emplace("input_horizontally_flipped", new BoolPacket(inputHorizontallyFlipped)); diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFrame.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFrame.cs index 418f8ee15..35255c2c9 100644 --- a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFrame.cs +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFrame.cs @@ -195,7 +195,7 @@ public void SetPixels32(Color32[] pixels) if (!RevokeNativeTexturePtr()) { // If this line was executed, there must be a bug. - Logger.LogError("Failed to revoke the native texture."); + Debug.LogError("Failed to revoke the native texture."); } } @@ -287,7 +287,7 @@ public static void OnReleaseTextureFrame(uint textureName, IntPtr syncTokenPtr) if (!isIdFound) { - Logger.LogError(_TAG, $"nameof (name={textureName}) is released, but the owner TextureFrame is not found"); + Debug.LogError($"nameof (name={textureName}) is released, but the owner TextureFrame is not found"); return; } @@ -295,7 +295,7 @@ public static void OnReleaseTextureFrame(uint textureName, IntPtr syncTokenPtr) if (!isTextureFrameFound) { - Logger.LogWarning(_TAG, $"nameof owner TextureFrame of the released texture (name={textureName}) is already garbage collected"); + Debug.LogWarning($"nameof owner TextureFrame of the released texture (name={textureName}) is already garbage collected"); return; } @@ -318,7 +318,7 @@ private static bool AcquireName(uint name, Guid ownerId) if (ownerId != id && _InstanceTable.TryGetValue(id, out var _)) { // if instance is found, the instance is using the name. - Logger.LogVerbose($"{id} is using {name} now"); + Debug.Log($"{id} is using {name} now"); return false; } var _ = _NameTable.Remove(name); diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFramePool.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFramePool.cs index 82f790101..aa7f098b5 100644 --- a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFramePool.cs +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFramePool.cs @@ -130,7 +130,7 @@ private void OnTextureFrameRelease(TextureFrame textureFrame) if (!_textureFramesInUse.Remove(textureFrame.GetInstanceID())) { // won't be run - Logger.LogWarning(_TAG, "The released texture does not belong to the pool"); + Debug.LogWarning("The released texture does not belong to the pool"); return; } diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/WebCamSource.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/WebCamSource.cs index 264f6f184..260e5f26d 100644 --- a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/WebCamSource.cs +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/WebCamSource.cs @@ -155,12 +155,12 @@ private IEnumerator GetPermission() #if UNITY_ANDROID if (!Permission.HasUserAuthorizedPermission(Permission.Camera)) { - Logger.LogWarning(_TAG, "Not permitted to use Camera"); + Debug.LogWarning("Not permitted to use Camera"); yield break; } #elif UNITY_IOS if (!Application.HasUserAuthorization(UserAuthorization.WebCam)) { - Logger.LogWarning(_TAG, "Not permitted to use WebCam"); + Debug.LogWarning("Not permitted to use WebCam"); yield break; } #endif @@ -246,7 +246,7 @@ private IEnumerator WaitForWebCamTexture() { const int timeoutFrame = 2000; var count = 0; - Logger.LogVerbose("Waiting for WebCamTexture to start"); + Debug.Log("Waiting for WebCamTexture to start"); yield return new WaitUntil(() => count++ > timeoutFrame || webCamTexture.width > 16); if (webCamTexture.width <= 16) diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSourceSolution.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSourceSolution.cs index ee90db1db..375694782 100644 --- a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSourceSolution.cs +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSourceSolution.cs @@ -64,7 +64,7 @@ private IEnumerator Run() if (!imageSource.isPrepared) { - Logger.LogError(TAG, "Failed to start ImageSource, exiting..."); + Debug.LogError("Failed to start ImageSource, exiting..."); yield break; } @@ -76,7 +76,7 @@ private IEnumerator Run() yield return graphInitRequest; if (graphInitRequest.isError) { - Logger.LogError(TAG, graphInitRequest.error); + Debug.LogError(graphInitRequest.error); yield break; } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset b/Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset index 8b1ca4378..84a9eff3c 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset +++ b/Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset @@ -62,5 +62,4 @@ MonoBehaviour: - width: 1280 height: 720 frameRate: 0 - _availableVideoSources: - - {fileID: 32900000, guid: 56e0345cf6a6fcda3a013db92f9d6c01, type: 3} + _availableVideoSources: [] diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Face Detection/FaceDetectionGraph.cs b/Assets/MediaPipeUnity/Samples/Scenes/Face Detection/FaceDetectionGraph.cs index 58162e90b..2ab7e51ac 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Face Detection/FaceDetectionGraph.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Face Detection/FaceDetectionGraph.cs @@ -89,7 +89,7 @@ protected override void ConfigureCalculatorGraph(CalculatorGraphConfig config) var calculatorOptions = new CalculatorOptions(); calculatorOptions.SetExtension(FaceDetectionOptions.Extensions.Ext, new FaceDetectionOptions { MinScoreThresh = minDetectionConfidence }); calculator.Options = calculatorOptions; - Logger.LogInfo(TAG, $"Min Detection Confidence ({calculator.Calculator}) = {minDetectionConfidence}"); + Debug.Log($"Min Detection Confidence ({calculator.Calculator}) = {minDetectionConfidence}"); } using (var validatedGraphConfig = new ValidatedGraphConfig()) @@ -106,7 +106,7 @@ private PacketMap BuildSidePacket(ImageSource imageSource) SetImageTransformationOptions(sidePacket, imageSource); sidePacket.Emplace("model_type", new IntPacket((int)modelType)); - Logger.LogInfo(TAG, $"Model Selection = {modelType}"); + Debug.Log($"Model Selection = {modelType}"); return sidePacket; } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Face Mesh/FaceMeshGraph.cs b/Assets/MediaPipeUnity/Samples/Scenes/Face Mesh/FaceMeshGraph.cs index da03b9262..374bbc28d 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Face Mesh/FaceMeshGraph.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Face Mesh/FaceMeshGraph.cs @@ -151,7 +151,7 @@ protected override void ConfigureCalculatorGraph(CalculatorGraphConfig config) var calculatorOptions = new CalculatorOptions(); calculatorOptions.SetExtension(TensorsToDetectionsCalculatorOptions.Extensions.Ext, opt); calculator.Options = calculatorOptions; - Logger.LogInfo(TAG, $"Min Detection Confidence = {minDetectionConfidence}"); + Debug.Log($"Min Detection Confidence = {minDetectionConfidence}"); break; } } @@ -163,7 +163,7 @@ protected override void ConfigureCalculatorGraph(CalculatorGraphConfig config) { var options = calculator.Options.GetExtension(ThresholdingCalculatorOptions.Extensions.Ext); options.Threshold = minTrackingConfidence; - Logger.LogInfo(TAG, $"Min Tracking Confidence = {minTrackingConfidence}"); + Debug.Log($"Min Tracking Confidence = {minTrackingConfidence}"); } } calculatorGraph.Initialize(cannonicalizedConfig); @@ -186,8 +186,8 @@ private PacketMap BuildSidePacket(ImageSource imageSource) sidePacket.Emplace("num_faces", new IntPacket(maxNumFaces)); sidePacket.Emplace("with_attention", new BoolPacket(refineLandmarks)); - Logger.LogInfo(TAG, $"Max Num Faces = {maxNumFaces}"); - Logger.LogInfo(TAG, $"Refine Landmarks = {refineLandmarks}"); + Debug.Log($"Max Num Faces = {maxNumFaces}"); + Debug.Log($"Refine Landmarks = {refineLandmarks}"); return sidePacket; } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Hair Segmentation/HairSegmentationGraph.cs b/Assets/MediaPipeUnity/Samples/Scenes/Hair Segmentation/HairSegmentationGraph.cs index 9bf23880d..7d3f27423 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Hair Segmentation/HairSegmentationGraph.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Hair Segmentation/HairSegmentationGraph.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; +using UnityEngine; namespace Mediapipe.Unity.Sample.HairSegmentation { @@ -96,7 +97,7 @@ private PacketMap BuildSidePacket(ImageSource imageSource) sidePacket.Emplace("output_horizontally_flipped", new BoolPacket(outputHorizontallyFlipped)); sidePacket.Emplace("output_vertically_flipped", new BoolPacket(outputVerticallyFlipped)); - Logger.LogDebug($"output_rotation = {outputRotation}, output_horizontally_flipped = {outputHorizontallyFlipped}, output_vertically_flipped = {outputVerticallyFlipped}"); + Debug.Log($"output_rotation = {outputRotation}, output_horizontally_flipped = {outputHorizontallyFlipped}, output_vertically_flipped = {outputVerticallyFlipped}"); return sidePacket; } } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Hand Tracking/HandTrackingGraph.cs b/Assets/MediaPipeUnity/Samples/Scenes/Hand Tracking/HandTrackingGraph.cs index b863759bf..0fa6e66e2 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Hand Tracking/HandTrackingGraph.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Hand Tracking/HandTrackingGraph.cs @@ -190,7 +190,7 @@ protected override void ConfigureCalculatorGraph(CalculatorGraphConfig config) { var options = calculator.Options.GetExtension(TensorsToDetectionsCalculatorOptions.Extensions.Ext); options.MinScoreThresh = minDetectionConfidence; - Logger.LogInfo(TAG, $"Min Detection Confidence = {minDetectionConfidence}"); + Debug.Log($"Min Detection Confidence = {minDetectionConfidence}"); } } @@ -200,7 +200,7 @@ protected override void ConfigureCalculatorGraph(CalculatorGraphConfig config) { var options = calculator.Options.GetExtension(ThresholdingCalculatorOptions.Extensions.Ext); options.Threshold = minTrackingConfidence; - Logger.LogInfo(TAG, $"Min Tracking Confidence = {minTrackingConfidence}"); + Debug.Log($"Min Tracking Confidence = {minTrackingConfidence}"); } } calculatorGraph.Initialize(cannonicalizedConfig); @@ -235,8 +235,8 @@ private PacketMap BuildSidePacket(ImageSource imageSource) sidePacket.Emplace("model_complexity", new IntPacket((int)modelComplexity)); sidePacket.Emplace("num_hands", new IntPacket(maxNumHands)); - Logger.LogInfo(TAG, $"Model Complexity = {modelComplexity}"); - Logger.LogInfo(TAG, $"Max Num Hands = {maxNumHands}"); + Debug.Log($"Model Complexity = {modelComplexity}"); + Debug.Log($"Max Num Hands = {maxNumHands}"); return sidePacket; } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Holistic/HolisticTrackingGraph.cs b/Assets/MediaPipeUnity/Samples/Scenes/Holistic/HolisticTrackingGraph.cs index 1008843a9..08584e160 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Holistic/HolisticTrackingGraph.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Holistic/HolisticTrackingGraph.cs @@ -246,7 +246,7 @@ protected override void ConfigureCalculatorGraph(CalculatorGraphConfig config) { var options = calculator.Options.GetExtension(TensorsToDetectionsCalculatorOptions.Extensions.Ext); options.MinScoreThresh = minDetectionConfidence; - Logger.LogInfo(TAG, $"Min Detection Confidence = {minDetectionConfidence}"); + Debug.Log($"Min Detection Confidence = {minDetectionConfidence}"); } } @@ -256,7 +256,7 @@ protected override void ConfigureCalculatorGraph(CalculatorGraphConfig config) { var options = calculator.Options.GetExtension(ThresholdingCalculatorOptions.Extensions.Ext); options.Threshold = minTrackingConfidence; - Logger.LogInfo(TAG, $"Min Tracking Confidence = {minTrackingConfidence}"); + Debug.Log($"Min Tracking Confidence = {minTrackingConfidence}"); } } calculatorGraph.Initialize(cannonicalizedConfig); @@ -287,7 +287,7 @@ private PacketMap BuildSidePacket(ImageSource imageSource) sidePacket.Emplace("output_horizontally_flipped", new BoolPacket(outputHorizontallyFlipped)); sidePacket.Emplace("output_vertically_flipped", new BoolPacket(outputVerticallyFlipped)); - Logger.LogDebug($"output_rotation = {outputRotation}, output_horizontally_flipped = {outputHorizontallyFlipped}, output_vertically_flipped = {outputVerticallyFlipped}"); + Debug.Log($"outtput_rotation = {outputRotation}, output_horizontally_flipped = {outputHorizontallyFlipped}, output_vertically_flipped = {outputVerticallyFlipped}"); sidePacket.Emplace("refine_face_landmarks", new BoolPacket(refineFaceLandmarks)); sidePacket.Emplace("model_complexity", new IntPacket((int)modelComplexity)); @@ -295,11 +295,11 @@ private PacketMap BuildSidePacket(ImageSource imageSource) sidePacket.Emplace("enable_segmentation", new BoolPacket(enableSegmentation)); sidePacket.Emplace("smooth_segmentation", new BoolPacket(smoothSegmentation)); - Logger.LogInfo(TAG, $"Refine Face Landmarks = {refineFaceLandmarks}"); - Logger.LogInfo(TAG, $"Model Complexity = {modelComplexity}"); - Logger.LogInfo(TAG, $"Smooth Landmarks = {smoothLandmarks}"); - Logger.LogInfo(TAG, $"Enable Segmentation = {enableSegmentation}"); - Logger.LogInfo(TAG, $"Smooth Segmentation = {smoothSegmentation}"); + Debug.Log($"Refine Face Landmarks = {refineFaceLandmarks}"); + Debug.Log($"Model Complexity = {modelComplexity}"); + Debug.Log($"Smooth Landmarks = {smoothLandmarks}"); + Debug.Log($"Enable Segmentation = {enableSegmentation}"); + Debug.Log($"Smooth Segmentation = {smoothSegmentation}"); return sidePacket; } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Pose Tracking/PoseTrackingGraph.cs b/Assets/MediaPipeUnity/Samples/Scenes/Pose Tracking/PoseTrackingGraph.cs index 8eeea72db..a7d7fa5f1 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Pose Tracking/PoseTrackingGraph.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Pose Tracking/PoseTrackingGraph.cs @@ -176,7 +176,7 @@ protected override void ConfigureCalculatorGraph(CalculatorGraphConfig config) { var options = calculator.Options.GetExtension(TensorsToDetectionsCalculatorOptions.Extensions.Ext); options.MinScoreThresh = minDetectionConfidence; - Logger.LogInfo(TAG, $"Min Detection Confidence = {minDetectionConfidence}"); + Debug.Log($"Min Detection Confidence = {minDetectionConfidence}"); } } @@ -186,7 +186,7 @@ protected override void ConfigureCalculatorGraph(CalculatorGraphConfig config) { var options = calculator.Options.GetExtension(ThresholdingCalculatorOptions.Extensions.Ext); options.Threshold = minTrackingConfidence; - Logger.LogInfo(TAG, $"Min Tracking Confidence = {minTrackingConfidence}"); + Debug.Log($"Min Tracking Confidence = {minTrackingConfidence}"); } } calculatorGraph.Initialize(cannonicalizedConfig); @@ -228,17 +228,17 @@ private PacketMap BuildSidePacket(ImageSource imageSource) sidePacket.Emplace("output_horizontally_flipped", new BoolPacket(outputHorizontallyFlipped)); sidePacket.Emplace("output_vertically_flipped", new BoolPacket(outputVerticallyFlipped)); - Logger.LogDebug($"output_rotation = {outputRotation}, output_horizontally_flipped = {outputHorizontallyFlipped}, output_vertically_flipped = {outputVerticallyFlipped}"); + Debug.Log($"output_rotation = {outputRotation}, output_horizontally_flipped = {outputHorizontallyFlipped}, output_vertically_flipped = {outputVerticallyFlipped}"); sidePacket.Emplace("model_complexity", new IntPacket((int)modelComplexity)); sidePacket.Emplace("smooth_landmarks", new BoolPacket(smoothLandmarks)); sidePacket.Emplace("enable_segmentation", new BoolPacket(enableSegmentation)); sidePacket.Emplace("smooth_segmentation", new BoolPacket(smoothSegmentation)); - Logger.LogInfo(TAG, $"Model Complexity = {modelComplexity}"); - Logger.LogInfo(TAG, $"Smooth Landmarks = {smoothLandmarks}"); - Logger.LogInfo(TAG, $"Enable Segmentation = {enableSegmentation}"); - Logger.LogInfo(TAG, $"Smooth Segmentation = {smoothSegmentation}"); + Debug.Log($"Model Complexity = {modelComplexity}"); + Debug.Log($"Smooth Landmarks = {smoothLandmarks}"); + Debug.Log($"Enable Segmentation = {enableSegmentation}"); + Debug.Log($"Smooth Segmentation = {smoothSegmentation}"); return sidePacket; } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Selfie Segmentation/SelfieSegmentationGraph.cs b/Assets/MediaPipeUnity/Samples/Scenes/Selfie Segmentation/SelfieSegmentationGraph.cs index 02724d9f1..428e3d887 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Selfie Segmentation/SelfieSegmentationGraph.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Selfie Segmentation/SelfieSegmentationGraph.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; +using UnityEngine; namespace Mediapipe.Unity.Sample.SelfieSegmentation { @@ -92,7 +93,7 @@ private PacketMap BuildSidePacket(ImageSource imageSource) sidePacket.Emplace("output_horizontally_flipped", new BoolPacket(outputHorizontallyFlipped)); sidePacket.Emplace("output_vertically_flipped", new BoolPacket(outputVerticallyFlipped)); - Logger.LogDebug($"output_rotation = {outputRotation}, output_horizontally_flipped = {outputHorizontallyFlipped}, output_vertically_flipped = {outputVerticallyFlipped}"); + Debug.Log($"output_rotation = {outputRotation}, output_horizontally_flipped = {outputHorizontallyFlipped}, output_vertically_flipped = {outputVerticallyFlipped}"); return sidePacket; } } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection/FaceDetectorRunner.cs b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection/FaceDetectorRunner.cs index d20b3b44f..28de905e9 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection/FaceDetectorRunner.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection/FaceDetectorRunner.cs @@ -45,7 +45,7 @@ protected override IEnumerator Run() if (!imageSource.isPrepared) { - Logger.LogError(TAG, "Failed to start ImageSource, exiting..."); + Debug.LogError("Failed to start ImageSource, exiting..."); yield break; } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Landmark Detection/FaceLandmarkerRunner.cs b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Landmark Detection/FaceLandmarkerRunner.cs index f0559a660..f9b0845b6 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Landmark Detection/FaceLandmarkerRunner.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Landmark Detection/FaceLandmarkerRunner.cs @@ -49,7 +49,7 @@ protected override IEnumerator Run() if (!imageSource.isPrepared) { - Logger.LogError(TAG, "Failed to start ImageSource, exiting..."); + Debug.LogError("Failed to start ImageSource, exiting..."); yield break; } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Hand Landmark Detection/HandLandmarkerRunner.cs b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Hand Landmark Detection/HandLandmarkerRunner.cs index 87c890b66..f5fe70f33 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Hand Landmark Detection/HandLandmarkerRunner.cs +++ b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Hand Landmark Detection/HandLandmarkerRunner.cs @@ -47,7 +47,7 @@ protected override IEnumerator Run() if (!imageSource.isPrepared) { - Logger.LogError(TAG, "Failed to start ImageSource, exiting..."); + Debug.LogError("Failed to start ImageSource, exiting..."); yield break; } diff --git a/README.md b/README.md index a1ad58031..bcc8fcfd9 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Select any scenes under `Mediapipe/Samples/Scenes` and play. ### Desktop If you've built native libraries for CPU (i.e. `--desktop cpu`), select `CPU` for inference mode from the Inspector Window. -![preferable-inference-mode](https://user-images.githubusercontent.com/4690128/134795568-156f3d41-b46e-477f-a487-d04c99300c33.png) +![preferable-inference-mode](https://github.com/homuler/MediaPipeUnityPlugin/assets/4690128/129d18be-8184-43f7-8ac8-56db4df9f9a7) ### Android, iOS