Пример #1
0
        public async Task InitModelAsync(NeuroModel model)
        {
            WebsocketData dataModel = new WebsocketData()
            {
                MsgType = "init",
                Model   = model
            };


            await SendDataAsync(WS, dataModel);
        }
Пример #2
0
        private async void UpdateModel()
        {
            Status = new AppStatusInfo()
            {
                Status       = Enums.Status.Working,
                StringStatus = $"Working | updating model..."
            };

            if (_model == null)
            {
                _model = new NeuroModel();
            }

            await _model.UpdateModel();

            Status = new AppStatusInfo()
            {
                Status = Enums.Status.Ready
            };
        }
Пример #3
0
        private async void PredictAll()
        {
            if (Frames == null || Frames.Count < 1)
            {
                return;
            }
            Status = new AppStatusInfo()
            {
                Status       = Enums.Status.Working,
                StringStatus = $"Working | loading model..."
            };

            if (_model == null)
            {
                _model = new NeuroModel();
            }
            var isLoaded = await _model.Load();

            if (!isLoaded)
            {
                Status = new AppStatusInfo()
                {
                    Status       = Enums.Status.Error,
                    StringStatus = $"Error: unable to load model"
                };
                _model.Dispose();
                _model = null;
                return;
            }

            var index = 0;

            Status = new AppStatusInfo()
            {
                Status       = Enums.Status.Working,
                StringStatus = $"Working | processing images: {index} / {Frames.Count}"
            };
            foreach (var frame in Frames)
            {
                index++;
                frame.Rectangles = await _model.Predict(frame);

                if (index < Frames.Count)
                {
                    Status = new AppStatusInfo()
                    {
                        Status       = Enums.Status.Working,
                        StringStatus = $"Working | processing images: {index} / {Frames.Count}"
                    }
                }
                ;
                else
                {
                    Status = new AppStatusInfo()
                    {
                        Status = Enums.Status.Ready
                    };
                }
            }
            UpdateUi();
        }
Пример #4
0
        private async void PredictAll()
        {
            if (Frames == null || Frames.Count < 1)
            {
                return;
            }
            Status = new AppStatusInfo()
            {
                Status       = Enums.Status.Working,
                StringStatus = $"Working | loading model..."
            };

            if (_model == null)
            {
                _model = new NeuroModel();
            }

            var isLoaded = await _model.Run();

            if (!isLoaded)
            {
                Status = new AppStatusInfo()
                {
                    Status       = Enums.Status.Error,
                    StringStatus = $"Error: unable to load model"
                };
                _model.Dispose();
                _model = null;
                return;
            }

            var index = 0;

            Status = new AppStatusInfo()
            {
                Status       = Enums.Status.Working,
                StringStatus = $"Working | processing images: {index} / {Frames.Count}"
            };
            foreach (var frame in Frames)
            {
                index++;
                frame.Rectangles = await _model.Predict(frame);

                if (index < Frames.Count)
                {
                    Status = new AppStatusInfo()
                    {
                        Status       = Enums.Status.Working,
                        StringStatus = $"Working | processing images: {index} / {Frames.Count}"
                    }
                }
                ;

                if (frame.Rectangles.Count > 0)
                {
                    frame.IsVisible = true;
                }
            }
            _frames = new List <Frame>(Frames);
            await _model.Stop();

            SelectedIndex = 0; //Fix bug when application stopped if index > 0
            UpdateUi();
            Status = new AppStatusInfo()
            {
                Status = Enums.Status.Ready
            };
        }
Пример #5
0
 public Task InitModel(NeuroModel model)
 {
     throw new NotImplementedException();
 }