예제 #1
0
        private static async Task <OnnxModel> CreateFromStreamAsyncHelper(IRandomAccessStreamReference stream)
        {
            OnnxModel onnxModel = new OnnxModel();

            onnxModel.learningModel = await LearningModel.LoadFromStreamAsync(stream);

            onnxModel.session = new LearningModelSession(onnxModel.learningModel);
            onnxModel.binding = new LearningModelBinding(onnxModel.session);
            return(onnxModel);
        }
예제 #2
0
        private async Task LoadModelAsync()
        {
            try
            {
                var modelFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Model/{_ourOnnxFileName}"));

                _model = await OnnxModel.CreateFromStreamAsync(modelFile);

                _misty.SkillLogger.Log($"Loaded {_ourOnnxFileName}");
                _misty.SendDebugMessage($"Loaded {_ourOnnxFileName}", null);
            }
            catch (Exception ex)
            {
                _misty.SendDebugMessage($"error: {ex.Message}", null);
                _model = null;
            }
        }
예제 #3
0
        /// <summary>
        /// This event handler is called when the cancel command is issued from the robot/user
        /// You currently have a few seconds to do cleanup and robot resets before the skill is shut down...
        /// Events will be unregistered for you
        /// </summary>
        public void OnCancel(object sender, IDictionary <string, object> parameters)
        {
            yaw.YawReached -= HandleYawReached;
            yaw.YawReached -= HandleReturnYawReached;
            yaw.YawReached -= FinalYaw;

            tof.DistanceReached -= HandleOreReached;
            tof.DistanceReached -= HandleReturnReached;

            arm.ArmPosReached -= ArmDown;
            arm.ArmPosReached -= ArmUp;

            yaw = null;
            tof = null;
            arm = null;

            celebrationCount = 0;

            _model = null;
            //TODO Put your code here and update the summary above
        }