예제 #1
0
 def test_two_persons_exiting(self):
     """
     This method validates if occupancy detector can actually detect two persons exiting the premises.
     :return:
     """
     human_detector_inst = HumanDetector(
         find_humans_from_video_file_name='videos/two_persons_exiting.mp4',
         use_pi_camera=False,
         open_display=False)
     self.assertEqual(human_detector_inst.perform_job(), None)
     human_centroid_dict = human_detector_inst.get_human_centroid_dict()
     self.assertEqual(len(human_centroid_dict), 2)
     self.assertEqual(human_centroid_dict[0].direction, Direction.EXIT)
     self.assertEqual(human_centroid_dict[1].direction, Direction.EXIT)
     self.assertEqual(
         SendReceiveMessages().get_face_detected_count_locally(), -2)
     # human_detector_inst.clean_up()
     self.__cleanup()
예제 #2
0
 def test_occupancy_10(self):
     """
     This method validates if occupancy detector can actually correctly calculate the number of people entering the premises on a typical temple day.
     :return:
     """
     human_detector_inst = HumanDetector(
         find_humans_from_video_file_name=
         'videos/occupancy_test_videos/occupancy10.mp4',
         use_pi_camera=False,
         open_display=True)
     self.assertEqual(human_detector_inst.perform_job(), None)
     human_centroid_dict = human_detector_inst.get_human_centroid_dict()
     self.assertEqual(len(human_centroid_dict), 12)
     self.assertEqual(human_centroid_dict[0].direction, Direction.EXIT)
     self.assertEqual(human_centroid_dict[1].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[2].direction, Direction.EXIT)
     self.assertEqual(human_centroid_dict[3].direction, Direction.EXIT)
     self.assertEqual(human_centroid_dict[4].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[5].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[6].direction, Direction.EXIT)
     self.assertEqual(human_centroid_dict[7].direction, Direction.EXIT)
     self.assertEqual(human_centroid_dict[8].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[9].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[10].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[11].direction, Direction.ENTER)
     self.assertEqual(
         SendReceiveMessages().get_face_detected_count_locally(), 2)
     human_detector_inst.clean_up()
     self.__cleanup()
예제 #3
0
 def test_one_by_one_crossAbhiSrini(self):
     """
     This method validates if occupancy detector can actually detect 1 person entering and teh other exiting the premises.
     :return:
     """
     human_detector_inst = HumanDetector(
         find_humans_from_video_file_name=
         'videos/TempleVideos/one_by_one_cross_AbhiSrini.mp4',
         use_pi_camera=False,
         open_display=True)
     self.assertEqual(human_detector_inst.perform_job(), None)
     human_centroid_dict = human_detector_inst.get_human_centroid_dict()
     self.assertEqual(len(human_centroid_dict), 2)
     self.assertEqual(human_centroid_dict[0].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[1].direction, Direction.EXIT)
     self.assertEqual(
         SendReceiveMessages().get_face_detected_count_locally(), 0)
     human_detector_inst.clean_up()
     self.__cleanup()
예제 #4
0
 def test_grouped_enter(self):
     """
     This method validates if occupancy detector can actually detect four persons grouped together entering the premises.
     :return:
     """
     human_detector_inst = HumanDetector(
         find_humans_from_video_file_name=
         'videos/TempleVideos/grouped_Enter.mp4',
         use_pi_camera=False,
         open_display=False)
     self.assertEqual(human_detector_inst.perform_job(), None)
     human_centroid_dict = human_detector_inst.get_human_centroid_dict()
     self.assertEqual(len(human_centroid_dict), 4)
     self.assertEqual(human_centroid_dict[0].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[1].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[2].direction, Direction.ENTER)
     self.assertEqual(human_centroid_dict[3].direction, Direction.ENTER)
     self.assertEqual(
         SendReceiveMessages().get_face_detected_count_locally(), 4)
     human_detector_inst.clean_up()
     self.__cleanup()