def test_occupancy_11(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/occupancy11.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.ENTER) self.assertEqual(human_centroid_dict[1].direction, Direction.ENTER) self.assertEqual( SendReceiveMessages().get_face_detected_count_locally(), 2) human_detector_inst.clean_up() self.__cleanup()
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()
def test_four_persons_entering(self): """ This method validates if occupancy detector can actually detect four persons entering the premises. :return: """ human_detector_inst = HumanDetector( find_humans_from_video_file_name='videos/4_persons_entering.mov', 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()