class_docstr: This is the object detection class for videos and camera live stream inputs in the ImageAI library. It provides support for RetinaNet,
   YOLOv3 and TinyYOLOv3 object detection networks. After instantiating this class, you can set it's properties and
   make object detections using it's pre-defined functions.
  
   The following functions are required to be called before object detection can be made
   * setModelPath()
   * At least of of the following and it must correspond to the model set in the setModelPath()
    [setModelTypeAsRetinaNet(), setModelTypeAsYOLOv3(), setModelTinyYOLOv3()]
   * loadModel() [This must be called once only before performing object detection]
  
   Once the above functions have been called, you can call the detectObjectsFromVideo() function
   or the detectCustomObjectsFromVideo() of  the object detection instance object at anytime to
   obtain observable objects in any video or camera live stream.
class_docstr_tok: ["This","is","the","object","detection","class","for","videos","and","camera","live","stream","inputs","in","the","ImageAI","library",".","It","provides","support","for","RetinaNet",",","YOLOv3","and","TinyYOLOv3","object","detection","networks",".","After","instantiating","this","class",",","you","can","set","it","'s","properties","and","make","object","detections","using","it","'s","pre-defined","functions",".","The","following","functions","are","required","to","be","called","before","object","detection","can","be","made","*","setModelPath","(",")","*","At","least","of","of","the","following","and","it","must","correspond","to","the","model","set","in","the","setModelPath","(",")","[","setModelTypeAsRetinaNet","(",")",",","setModelTypeAsYOLOv3","(",")",",","setModelTinyYOLOv3","(",")","]","*","loadModel","(",")","[","This","must","be","called","once","only","before","performing","object","detection","]","Once","the","above","functions","have","been","called",",","you","can","call","the","detectObjectsFromVideo","(",")","function","or","the","detectCustomObjectsFromVideo","(",")","of","the","object","detection","instance","object","at","anytime","to","obtain","observable","objects","in","any","video","or","camera","live","stream","."]
docstr:         'detectObjectsFromVideo()' function is used to detect objects observable in the given video path or a camera input:
  * input_file_path , which is the file path to the input video. It is required only if 'camera_input' is not set
  * camera_input , allows you to parse in camera input for live video detections
  * output_file_path , which is the path to the output video. It is required only if 'save_detected_video' is not set to False
  * frames_per_second , which is the number of frames to be used in the output video
  * frame_detection_interval (optional, 1 by default)  , which is the intervals of frames that will be detected.
  * minimum_percentage_probability (optional, 50 by default) , option to set the minimum percentage probability for nominating a detected object for output.
  * log_progress (optional) , which states if the progress of the frame processed is to be logged to console
  * display_percentage_probability (optional), can be used to hide or show probability scores on the detected video frames
  * display_object_name (optional), can be used to show or hide object names on the detected video frames
  * save_save_detected_video (optional, True by default), can be set to or not to save the detected video
  * per_frame_function (optional), this parameter allows you to parse in a function you will want to execute after each frame of the video is detected. If this parameter is set to a function, after every video  frame is detected, the function will be executed with the following values parsed into it:
      -- position number of the frame
      -- an array of dictinaries, with each dictionary corresponding to each object detected. Each dictionary contains 'name', 'percentage_probability' and 'box_points'
      -- a dictionary with with keys being the name of each unique objects and value are the number of instances of the object present
      -- If return_detected_frame is set to True, the numpy array of the detected frame will be parsed as the fourth value into the function
  
  * per_second_function (optional), this parameter allows you to parse in a function you will want to execute after each second of the video is detected. If this parameter is set to a function, after every second of a video is detected, the function will be executed with the following values parsed into it:
      -- position number of the second
      -- an array of dictionaries whose keys are position number of each frame present in the last second , and the value for each key is the array for each frame that contains the dictionaries for each object detected in the frame
      -- an array of dictionaries, with each dictionary corresponding to each frame in the past second, and the keys of each dictionary are the name of the number of unique objects detected in each frame, and the key values are the number of instances of the objects found in the frame
      -- a dictionary with its keys being the name of each unique object detected throughout the past second, and the key values are the average number of instances of the object found in all the frames contained in the past second
      -- If return_detected_frame is set to True, the numpy array of the detected frame will be parsed
                                                          as the fifth value into the function
  
  * per_minute_function (optional), this parameter allows you to parse in a function you will want to execute after each minute of the video is detected. If this parameter is set to a function, after every minute of a video is detected, the function will be executed with the following values parsed into it:
      -- position number of the minute
      -- an array of dictionaries whose keys are position number of each frame present in the last minute , and the value for each key is the array for each frame that contains the dictionaries for each object detected in the frame
  
      -- an array of dictionaries, with each dictionary corresponding to each frame in the past minute, and the keys of each dictionary are the name of the number of unique objects detected in each frame, and the key values are the number of instances of the objects found in the frame
  
      -- a dictionary with its keys being the name of each unique object detected throughout the past minute, and the key values are the average number of instances of the object found in all the frames contained in the past minute
  
      -- If return_detected_frame is set to True, the numpy array of the detected frame will be parsed as the fifth value into the function
  
  * video_complete_function (optional), this parameter allows you to parse in a function you will want to execute after all of the video frames have been detected. If this parameter is set to a function, after all of frames of a video is detected, the function will be executed with the following values parsed into it:
      -- an array of dictionaries whose keys are position number of each frame present in the entire video , and the value for each key is the array for each frame that contains the dictionaries for each object detected in the frame
      -- an array of dictionaries, with each dictionary corresponding to each frame in the entire video, and the keys of each dictionary are the name of the number of unique objects detected in each frame, and the key values are the number of instances of the objects found in the frame
      -- a dictionary with its keys being the name of each unique object detected throughout the entire video, and the key values are the average number of instances of the object found in all the frames contained in the entire video
  
  * return_detected_frame (optionally, False by default), option to obtain the return the last detected video frame into the per_per_frame_function, per_per_second_function or per_per_minute_function
  
  * detection_timeout (optionally, None by default), option to state the number of seconds of a video that should be detected after which the detection function stop processing the video
  * thread_safe (optional, False by default), enforce the loaded detection model works across all threads if set to true, made possible by forcing all Tensorflow inference to run on the default graph.
  
  
          :param input_file_path:
          :param camera_input
          :param output_file_path:
          :param save_detected_video:
          :param frames_per_second:
          :param frame_detection_interval:
          :param minimum_percentage_probability:
          :param log_progress:
          :param display_percentage_probability:
          :param display_object_name:
          :param per_frame_function:
          :param per_second_function:
          :param per_minute_function:
          :param video_complete_function:
          :param return_detected_frame:
          :param detection_timeout:
          :param thread_safe:
          :return output_video_filepath:
          :return counting:
          :return output_objects_array:
          :return output_objects_count:
          :return detected_copy:
          :return this_second_output_object_array:
          :return this_second_counting_array:
          :return this_second_counting:
          :return this_minute_output_object_array:
          :return this_minute_counting_array:
          :return this_minute_counting:
          :return this_video_output_object_array:
          :return this_video_counting_array:
          :return this_video_counting:
      
docstr_tok: ["'detectObjectsFromVideo","(",")","'","function","is","used","to","detect","objects","observable","in","the","given","video","path","or","a","camera","input",":","*","input_file_path",",","which","is","the","file","path","to","the","input","video",".","It","is","required","only","if","'camera_input","'","is","not","set","*","camera_input",",","allows","you","to","parse","in","camera","input","for","live","video","detections","*","output_file_path",",","which","is","the","path","to","the","output","video",".","It","is","required","only","if","'save_detected_video","'","is","not","set","to","False","*","frames_per_second",",","which","is","the","number","of","frames","to","be","used","in","the","output","video","*","frame_detection_interval","(","optional",",","1","by","default",")",",","which","is","the","intervals","of","frames","that","will","be","detected",".","*","minimum_percentage_probability","(","optional",",","50","by","default",")",",","option","to","set","the","minimum","percentage","probability","for","nominating","a","detected","object","for","output",".","*","log_progress","(","optional",")",",","which","states","if","the","progress","of","the","frame","processed","is","to","be","logged","to","console","*","display_percentage_probability","(","optional",")",",","can","be","used","to","hide","or","show","probability","scores","on","the","detected","video","frames","*","display_object_name","(","optional",")",",","can","be","used","to","show","or","hide","object","names","on","the","detected","video","frames","*","save_save_detected_video","(","optional",",","True","by","default",")",",","can","be","set","to","or","not","to","save","the","detected","video","*","per_frame_function","(","optional",")",",","this","parameter","allows","you","to","parse","in","a","function","you","will","want","to","execute","after","each","frame","of","the","video","is","detected",".","If","this","parameter","is","set","to","a","function",",","after","every","video","frame","is","detected",",","the","function","will","be","executed","with","the","following","values","parsed","into","it",":","--","position","number","of","the","frame","--","an","array","of","dictinaries",",","with","each","dictionary","corresponding","to","each","object","detected",".","Each","dictionary","contains","'name","'",",","'percentage_probability","'","and","'box_points'","--","a","dictionary","with","with","keys","being","the","name","of","each","unique","objects","and","value","are","the","number","of","instances","of","the","object","present","--","If","return_detected_frame","is","set","to","True",",","the","numpy","array","of","the","detected","frame","will","be","parsed","as","the","fourth","value","into","the","function","*","per_second_function","(","optional",")",",","this","parameter","allows","you","to","parse","in","a","function","you","will","want","to","execute","after","each","second","of","the","video","is","detected",".","If","this","parameter","is","set","to","a","function",",","after","every","second","of","a","video","is","detected",",","the","function","will","be","executed","with","the","following","values","parsed","into","it",":","--","position","number","of","the","second","--","an","array","of","dictionaries","whose","keys","are","position","number","of","each","frame","present","in","the","last","second",",","and","the","value","for","each","key","is","the","array","for","each","frame","that","contains","the","dictionaries","for","each","object","detected","in","the","frame","--","an","array","of","dictionaries",",","with","each","dictionary","corresponding","to","each","frame","in","the","past","second",",","and","the","keys","of","each","dictionary","are","the","name","of","the","number","of","unique","objects","detected","in","each","frame",",","and","the","key","values","are","the","number","of","instances","of","the","objects","found","in","the","frame","--","a","dictionary","with","its","keys","being","the","name","of","each","unique","object","detected","throughout","the","past","second",",","and","the","key","values","are","the","average","number","of","instances","of","the","object","found","in","all","the","frames","contained","in","the","past","second","--","If","return_detected_frame","is","set","to","True",",","the","numpy","array","of","the","detected","frame","will","be","parsed","as","the","fifth","value","into","the","function","*","per_minute_function","(","optional",")",",","this","parameter","allows","you","to","parse","in","a","function","you","will","want","to","execute","after","each","minute","of","the","video","is","detected",".","If","this","parameter","is","set","to","a","function",",","after","every","minute","of","a","video","is","detected",",","the","function","will","be","executed","with","the","following","values","parsed","into","it",":","--","position","number","of","the","minute","--","an","array","of","dictionaries","whose","keys","are","position","number","of","each","frame","present","in","the","last","minute",",","and","the","value","for","each","key","is","the","array","for","each","frame","that","contains","the","dictionaries","for","each","object","detected","in","the","frame","--","an","array","of","dictionaries",",","with","each","dictionary","corresponding","to","each","frame","in","the","past","minute",",","and","the","keys","of","each","dictionary","are","the","name","of","the","number","of","unique","objects","detected","in","each","frame",",","and","the","key","values","are","the","number","of","instances","of","the","objects","found","in","the","frame","--","a","dictionary","with","its","keys","being","the","name","of","each","unique","object","detected","throughout","the","past","minute",",","and","the","key","values","are","the","average","number","of","instances","of","the","object","found","in","all","the","frames","contained","in","the","past","minute","--","If","return_detected_frame","is","set","to","True",",","the","numpy","array","of","the","detected","frame","will","be","parsed","as","the","fifth","value","into","the","function","*","video_complete_function","(","optional",")",",","this","parameter","allows","you","to","parse","in","a","function","you","will","want","to","execute","after","all","of","the","video","frames","have","been","detected",".","If","this","parameter","is","set","to","a","function",",","after","all","of","frames","of","a","video","is","detected",",","the","function","will","be","executed","with","the","following","values","parsed","into","it",":","--","an","array","of","dictionaries","whose","keys","are","position","number","of","each","frame","present","in","the","entire","video",",","and","the","value","for","each","key","is","the","array","for","each","frame","that","contains","the","dictionaries","for","each","object","detected","in","the","frame","--","an","array","of","dictionaries",",","with","each","dictionary","corresponding","to","each","frame","in","the","entire","video",",","and","the","keys","of","each","dictionary","are","the","name","of","the","number","of","unique","objects","detected","in","each","frame",",","and","the","key","values","are","the","number","of","instances","of","the","objects","found","in","the","frame","--","a","dictionary","with","its","keys","being","the","name","of","each","unique","object","detected","throughout","the","entire","video",",","and","the","key","values","are","the","average","number","of","instances","of","the","object","found","in","all","the","frames","contained","in","the","entire","video","*","return_detected_frame","(","optionally",",","False","by","default",")",",","option","to","obtain","the","return","the","last","detected","video","frame","into","the","per_per_frame_function",",","per_per_second_function","or","per_per_minute_function","*","detection_timeout","(","optionally",",","None","by","default",")",",","option","to","state","the","number","of","seconds","of","a","video","that","should","be","detected","after","which","the","detection","function","stop","processing","the","video","*","thread_safe","(","optional",",","False","by","default",")",",","enforce","the","loaded","detection","model","works","across","all","threads","if","set","to","true",",","made","possible","by","forcing","all","Tensorflow","inference","to","run","on","the","default","graph",".",":","param","input_file_path",":",":","param","camera_input",":","param","output_file_path",":",":","param","save_detected_video",":",":","param","frames_per_second",":",":","param","frame_detection_interval",":",":","param","minimum_percentage_probability",":",":","param","log_progress",":",":","param","display_percentage_probability",":",":","param","display_object_name",":",":","param","per_frame_function",":",":","param","per_second_function",":",":","param","per_minute_function",":",":","param","video_complete_function",":",":","param","return_detected_frame",":",":","param","detection_timeout",":",":","param","thread_safe",":",":","return","output_video_filepath",":",":","return","counting",":",":","return","output_objects_array",":",":","return","output_objects_count",":",":","return","detected_copy",":",":","return","this_second_output_object_array",":",":","return","this_second_counting_array",":",":","return","this_second_counting",":",":","return","this_minute_output_object_array",":",":","return","this_minute_counting_array",":",":","return","this_minute_counting",":",":","return","this_video_output_object_array",":",":","return","this_video_counting_array",":",":","return","this_video_counting",":"]
code: def detectObjectsFromVideo(
      self,
      input_file_path="",
      camera_input=None,
      output_file_path="",
      frames_per_second=20,
      frame_detection_interval=1,
      minimum_percentage_probability=50,
      log_progress=False,
      display_percentage_probability=True,
      display_object_name=True,
      display_box=True,
      save_detected_video=True,
      per_frame_function=None,
      per_second_function=None,
      per_minute_function=None,
      video_complete_function=None,
      return_detected_frame=False,
      detection_timeout=None,
      thread_safe=False,
      custom_objects=None,
  ):
      """
              'detectObjectsFromVideo()' function is used to detect objects observable in the given video path or a camera input:
      * input_file_path , which is the file path to the input video. It is required only if 'camera_input' is not set
      * camera_input , allows you to parse in camera input for live video detections
      * output_file_path , which is the path to the output video. It is required only if 'save_detected_video' is not set to False
      * frames_per_second , which is the number of frames to be used in the output video
      * frame_detection_interval (optional, 1 by default)  , which is the intervals of frames that will be detected.
      * minimum_percentage_probability (optional, 50 by default) , option to set the minimum percentage probability for nominating a detected object for output.
      * log_progress (optional) , which states if the progress of the frame processed is to be logged to console
      * display_percentage_probability (optional), can be used to hide or show probability scores on the detected video frames
      * display_object_name (optional), can be used to show or hide object names on the detected video frames
      * save_save_detected_video (optional, True by default), can be set to or not to save the detected video
      * per_frame_function (optional), this parameter allows you to parse in a function you will want to execute after each frame of the video is detected. If this parameter is set to a function, after every video  frame is detected, the function will be executed with the following values parsed into it:
          -- position number of the frame
          -- an array of dictinaries, with each dictionary corresponding to each object detected. Each dictionary contains 'name', 'percentage_probability' and 'box_points'
          -- a dictionary with with keys being the name of each unique objects and value are the number of instances of the object present
          -- If return_detected_frame is set to True, the numpy array of the detected frame will be parsed as the fourth value into the function
  
      * per_second_function (optional), this parameter allows you to parse in a function you will want to execute after each second of the video is detected. If this parameter is set to a function, after every second of a video is detected, the function will be executed with the following values parsed into it:
          -- position number of the second
          -- an array of dictionaries whose keys are position number of each frame present in the last second , and the value for each key is the array for each frame that contains the dictionaries for each object detected in the frame
          -- an array of dictionaries, with each dictionary corresponding to each frame in the past second, and the keys of each dictionary are the name of the number of unique objects detected in each frame, and the key values are the number of instances of the objects found in the frame
          -- a dictionary with its keys being the name of each unique object detected throughout the past second, and the key values are the average number of instances of the object found in all the frames contained in the past second
          -- If return_detected_frame is set to True, the numpy array of the detected frame will be parsed
                                                              as the fifth value into the function
  
      * per_minute_function (optional), this parameter allows you to parse in a function you will want to execute after each minute of the video is detected. If this parameter is set to a function, after every minute of a video is detected, the function will be executed with the following values parsed into it:
          -- position number of the minute
          -- an array of dictionaries whose keys are position number of each frame present in the last minute , and the value for each key is the array for each frame that contains the dictionaries for each object detected in the frame
  
          -- an array of dictionaries, with each dictionary corresponding to each frame in the past minute, and the keys of each dictionary are the name of the number of unique objects detected in each frame, and the key values are the number of instances of the objects found in the frame
  
          -- a dictionary with its keys being the name of each unique object detected throughout the past minute, and the key values are the average number of instances of the object found in all the frames contained in the past minute
  
          -- If return_detected_frame is set to True, the numpy array of the detected frame will be parsed as the fifth value into the function
  
      * video_complete_function (optional), this parameter allows you to parse in a function you will want to execute after all of the video frames have been detected. If this parameter is set to a function, after all of frames of a video is detected, the function will be executed with the following values parsed into it:
          -- an array of dictionaries whose keys are position number of each frame present in the entire video , and the value for each key is the array for each frame that contains the dictionaries for each object detected in the frame
          -- an array of dictionaries, with each dictionary corresponding to each frame in the entire video, and the keys of each dictionary are the name of the number of unique objects detected in each frame, and the key values are the number of instances of the objects found in the frame
          -- a dictionary with its keys being the name of each unique object detected throughout the entire video, and the key values are the average number of instances of the object found in all the frames contained in the entire video
  
      * return_detected_frame (optionally, False by default), option to obtain the return the last detected video frame into the per_per_frame_function, per_per_second_function or per_per_minute_function
  
      * detection_timeout (optionally, None by default), option to state the number of seconds of a video that should be detected after which the detection function stop processing the video
      * thread_safe (optional, False by default), enforce the loaded detection model works across all threads if set to true, made possible by forcing all Tensorflow inference to run on the default graph.
  
  
              :param input_file_path:
              :param camera_input
              :param output_file_path:
              :param save_detected_video:
              :param frames_per_second:
              :param frame_detection_interval:
              :param minimum_percentage_probability:
              :param log_progress:
              :param display_percentage_probability:
              :param display_object_name:
              :param per_frame_function:
              :param per_second_function:
              :param per_minute_function:
              :param video_complete_function:
              :param return_detected_frame:
              :param detection_timeout:
              :param thread_safe:
              :return output_video_filepath:
              :return counting:
              :return output_objects_array:
              :return output_objects_count:
              :return detected_copy:
              :return this_second_output_object_array:
              :return this_second_counting_array:
              :return this_second_counting:
              :return this_minute_output_object_array:
              :return this_minute_counting_array:
              :return this_minute_counting:
              :return this_video_output_object_array:
              :return this_video_counting_array:
              :return this_video_counting:
      """
  
      if input_file_path == "" and camera_input == None:
          raise ValueError(
              "You must set 'input_file_path' to a valid video file, or set 'camera_input' to a valid camera"
          )
      elif save_detected_video == True and output_file_path == "":
          raise ValueError(
              "You must set 'output_video_filepath' to a valid video file name, in which the detected video will be saved. If you don't intend to save the detected video, set 'save_detected_video=False'"
          )
  
      else:
          try:
              output_frames_dict = {}
              output_frames_count_dict = {}
  
              input_video = cv2.VideoCapture(input_file_path)
              if camera_input != None:
                  input_video = camera_input
  
              output_video_filepath = output_file_path + ".avi"
  
              frame_width = int(input_video.get(3))
              frame_height = int(input_video.get(4))
              output_video = cv2.VideoWriter(
                  output_video_filepath,
                  cv2.VideoWriter_fourcc("M", "J", "P", "G"),
                  frames_per_second,
                  (frame_width, frame_height),
              )
  
              counting = 0
  
              detection_timeout_count = 0
              video_frames_count = 0
  
              while input_video.isOpened():
                  ret, frame = input_video.read()
  
                  if ret == True:
                      video_frames_count += 1
                      if detection_timeout != None:
                          if (
                              video_frames_count % frames_per_second
                          ) == 0:
                              detection_timeout_count += 1
  
                          if (
                              detection_timeout_count
                              >= detection_timeout
                          ):
                              break
  
                      output_objects_array = []
  
                      counting += 1
  
                      if log_progress == True:
                          print("Processing Frame : ", str(counting))
  
                      detected_copy = frame.copy()
  
                      check_frame_interval = (
                          counting % frame_detection_interval
                      )
  
                      if counting == 1 or check_frame_interval == 0:
                          try:
                              (
                                  detected_copy,
                                  output_objects_array,
                              ) = self.__detector.detectObjectsFromImage(
                                  input_image=frame,
                                  input_type="array",
                                  output_type="array",
                                  minimum_percentage_probability=minimum_percentage_probability,
                                  display_percentage_probability=display_percentage_probability,
                                  display_object_name=display_object_name,
                                  display_box=display_box,
                                  custom_objects=custom_objects,
                              )
                          except:
                              None
  
                      output_frames_dict[
                          counting
                      ] = output_objects_array
  
                      output_objects_count = {}
                      for eachItem in output_objects_array:
                          eachItemName = eachItem["name"]
                          try:
                              output_objects_count[eachItemName] = (
                                  output_objects_count[eachItemName] + 1
                              )
                          except:
                              output_objects_count[eachItemName] = 1
  
                      output_frames_count_dict[
                          counting
                      ] = output_objects_count
  
                      if save_detected_video == True:
                          output_video.write(detected_copy)
  
                      if counting == 1 or check_frame_interval == 0:
                          if per_frame_function != None:
                              if return_detected_frame == True:
                                  per_frame_function(
                                      counting,
                                      output_objects_array,
                                      output_objects_count,
                                      detected_copy,
                                  )
                              elif return_detected_frame == False:
                                  per_frame_function(
                                      counting,
                                      output_objects_array,
                                      output_objects_count,
                                  )
  
                      if per_second_function != None:
                          if (
                              counting != 1
                              and (counting % frames_per_second) == 0
                          ):
                              this_second_output_object_array = []
                              this_second_counting_array = []
                              this_second_counting = {}
  
                              for aa in range(counting):
                                  if aa >= (
                                      counting - frames_per_second
                                  ):
                                      this_second_output_object_array.append(
                                          output_frames_dict[aa + 1]
                                      )
                                      this_second_counting_array.append(
                                          output_frames_count_dict[
                                              aa + 1
                                          ]
                                      )
  
                              for (
                                  eachCountingDict
                              ) in this_second_counting_array:
                                  for eachItem in eachCountingDict:
                                      try:
                                          this_second_counting[
                                              eachItem
                                          ] = (
                                              this_second_counting[
                                                  eachItem
                                              ]
                                              + eachCountingDict[
                                                  eachItem
                                              ]
                                          )
                                      except:
                                          this_second_counting[
                                              eachItem
                                          ] = eachCountingDict[eachItem]
  
                              for (
                                  eachCountingItem
                              ) in this_second_counting:
                                  this_second_counting[
                                      eachCountingItem
                                  ] = int(
                                      this_second_counting[
                                          eachCountingItem
                                      ]
                                      / frames_per_second
                                  )
  
                              if return_detected_frame == True:
                                  per_second_function(
                                      int(counting / frames_per_second),
                                      this_second_output_object_array,
                                      this_second_counting_array,
                                      this_second_counting,
                                      detected_copy,
                                  )
  
                              elif return_detected_frame == False:
                                  per_second_function(
                                      int(counting / frames_per_second),
                                      this_second_output_object_array,
                                      this_second_counting_array,
                                      this_second_counting,
                                  )
  
                      if per_minute_function != None:
                          if (
                              counting != 1
                              and (counting % (frames_per_second * 60))
                              == 0
                          ):
                              this_minute_output_object_array = []
                              this_minute_counting_array = []
                              this_minute_counting = {}
  
                              for aa in range(counting):
                                  if aa >= (
                                      counting
                                      - (frames_per_second * 60)
                                  ):
                                      this_minute_output_object_array.append(
                                          output_frames_dict[aa + 1]
                                      )
                                      this_minute_counting_array.append(
                                          output_frames_count_dict[
                                              aa + 1
                                          ]
                                      )
  
                              for (
                                  eachCountingDict
                              ) in this_minute_counting_array:
                                  for eachItem in eachCountingDict:
                                      try:
                                          this_minute_counting[
                                              eachItem
                                          ] = (
                                              this_minute_counting[
                                                  eachItem
                                              ]
                                              + eachCountingDict[
                                                  eachItem
                                              ]
                                          )
                                      except:
                                          this_minute_counting[
                                              eachItem
                                          ] = eachCountingDict[eachItem]
  
                              for (
                                  eachCountingItem
                              ) in this_minute_counting:
                                  this_minute_counting[
                                      eachCountingItem
                                  ] = int(
                                      this_minute_counting[
                                          eachCountingItem
                                      ]
                                      / (frames_per_second * 60)
                                  )
  
                              if return_detected_frame == True:
                                  per_minute_function(
                                      int(
                                          counting
                                          / (frames_per_second * 60)
                                      ),
                                      this_minute_output_object_array,
                                      this_minute_counting_array,
                                      this_minute_counting,
                                      detected_copy,
                                  )
  
                              elif return_detected_frame == False:
                                  per_minute_function(
                                      int(
                                          counting
                                          / (frames_per_second * 60)
                                      ),
                                      this_minute_output_object_array,
                                      this_minute_counting_array,
                                      this_minute_counting,
                                  )
  
                  else:
                      break
  
              if video_complete_function != None:
                  this_video_output_object_array = []
                  this_video_counting_array = []
                  this_video_counting = {}
  
                  for aa in range(counting):
                      this_video_output_object_array.append(
                          output_frames_dict[aa + 1]
                      )
                      this_video_counting_array.append(
                          output_frames_count_dict[aa + 1]
                      )
  
                  for eachCountingDict in this_video_counting_array:
                      for eachItem in eachCountingDict:
                          try:
                              this_video_counting[eachItem] = (
                                  this_video_counting[eachItem]
                                  + eachCountingDict[eachItem]
                              )
                          except:
                              this_video_counting[
                                  eachItem
                              ] = eachCountingDict[eachItem]
  
                  for eachCountingItem in this_video_counting:
                      this_video_counting[eachCountingItem] = int(
                          this_video_counting[eachCountingItem]
                          / counting
                      )
  
                  video_complete_function(
                      this_video_output_object_array,
                      this_video_counting_array,
                      this_video_counting,
                  )
  
              input_video.release()
              output_video.release()
  
              if save_detected_video == True:
                  return output_video_filepath
  
          except:
              raise ValueError(
                  "An error occured. It may be that your input video is invalid. Ensure you specified a proper string value for 'output_file_path' is 'save_detected_video' is not False. "
                  "Also ensure your per_frame, per_second, per_minute or video_complete_analysis function is properly configured to receive the right parameters. "
              )
  
imports: import cv2
  from imageai.Detection.keras_retinanet import models
  from imageai.Detection.keras_retinanet.utils.image import read_image_bgr, preprocess_image, resize_image
  from imageai.Detection.keras_retinanet.utils.visualization import draw_box, draw_caption
  import matplotlib.pyplot
  import matplotlib.image
  import numpy
  import tensorflow
  import os
  from tensorflow.keras import backend
  from tensorflow.keras.layers import Input
  from PIL import Image
  import colorsys
  import warnings
  from imageai.Detection.YOLO.yolov3 import tiny_yolov3_main, yolov3_main
  from imageai.Detection.YOLO.utils import letterbox_image, yolo_eval, preprocess_input, retrieve_yolo_detections, draw_boxes
label_desc: Use image node_id 7 for calling the VideoObjectDetection obj's underlying member method code with example usage: obj.detectObjectsFromVideo(input_file_path, camera_input, output_file_path, frames_per_second, frame_detection_interval, minimum_percentage_probability, log_progress, display_percentage_probability, display_object_name, display_box, save_detected_video, per_frame_function, per_second_function, per_minute_function, video_complete_function, return_detected_frame, detection_timeout, thread_safe, custom_objects) and returns: output_video_filepath