Change Border Width in Video Object Detection

How should I go about changing the border width for the video object detection? I’m running the standard code example pasted below. Is there any easy way to simply render the border at certain # of pixels for example? Thanks in advance for the help!

from imageai.Detection import VideoObjectDetection
import os

execution_path = os.getcwd()

detector = VideoObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , “resnet50_coco_best_v2.0.1.h5”))
detector.loadModel()

video_path = detector.detectObjectsFromVideo(input_file_path=os.path.join(execution_path, “traffic.mp4”),
output_file_path=os.path.join(execution_path, “traffic_detected”)
, frames_per_second=24, log_progress=True)
print(video_path)

As at now, the option to change the border width of the bounding boxes is not supported.

You can implement a workaround this by

  • reading the image frames with OpenCV
  • detect each frame individually as an image using the imageai.Detection.ObjectDetection class
  • use OpenCV to draw the boxes from ImageAI box_points result yourself.