예제 #1
0
 public AnalysisController(AnalysisService _service, IDataFromFile dataFromFile, DataTools model
                           , SequentialDataTools sTools, FallDetection d)
 {
     this._service = _service;
     _dataFromFile = dataFromFile;
     _model        = model;
     _sTools       = sTools;
     _d            = d;
 }
        public void TestFallDetection()
        {
            //Test null
            FallDetection fallDetection = new FallDetection(null, null, null);

            fallDetection.DoFallDetection(new ModelOutput(), null);

            fallDetection = new FallDetection(FallWarning, FallDetected, FallNotDetected);
            ModelOutput modelOutput = new ModelOutput();

            Assert.IsFalse(fallWarningSet);

            var movD1 = new int[32] {
                0, -1, -2, -9, 0, -1, 0, -1, -1, -2, -12, -22, 0, 0, 0, 0, 0, 0, -6, 3, 5, 1, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0,
            };

            modelOutput.Score = new float[5] {
                0.0F, 0.2F, 0.3F, 0.0F, 0.6F
            };
            //Fall detected as we are moving down and fall detection is detected
            fallDetection.DoFallDetection(modelOutput, movD1);

            Assert.IsTrue(fallWarningSet);
            Assert.IsFalse(fallDetectedSet);

            for (int i = 0; i < 10; i++)
            {
                fallDetection.DoFallDetection(modelOutput, movD1);
            }
            Assert.IsTrue(fallDetectedSet);

            fallWarningSet  = false;
            fallDetectedSet = false;

            modelOutput.Score = new float[5] {
                0.0F, 0.2F, 0.3F, 0.0F, 0.4F
            };
            //Below 50% fall detection
            fallDetection.DoFallDetection(modelOutput, movD1);

            var notD3 = new int[32] {
                0, 0, 0, 1, 12, 24, 2, 1, 1, 0, 0, 3, -20, 29, 4, 1, 0, 0, -3, 3, -10, 9, 2, 1, 0, 0, 0, 0, 0, 1, 1, 0
            };

            modelOutput.Score = new float[5] {
                0.0F, 0.2F, 0.3F, 0.0F, 0.7F
            };
            //Not moving down
            fallDetection.DoFallDetection(modelOutput, notD3);

            Assert.IsFalse(fallWarningSet);
            Assert.IsFalse(fallDetectedSet);
        }
예제 #3
0
 public AnalysisService(
     IHubContext <SignalRHub> hubContext,
     GPSService gpsService,
     AccelerometerServicecs acService,
     BatchService batchService,
     GyroscopeService gyroService,
     SequentialDataTools stools,
     FallDetection det,
     HubImpl hubImpl
     )
 {
     this.hubContext   = hubContext;
     this.gpsService   = gpsService;
     this.acService    = acService;
     this.batchService = batchService;
     this.gyroService  = gyroService;
     this._stools      = stools;
     this._det         = det;
     this._hubImpl     = hubImpl;
 }