def __init__(self,
              root_path="./",
              confidence_threshold=0.8,
              nms_threshold=0.4,
              image_size=416):
     self.image_folder = root_path + 'assets/images/'
     self.model_cfg = root_path + 'config/yolov3.cfg'
     self.weights_path = root_path + 'config/yolov3.weights'
     self.class_path = root_path + 'config/voc.names'
     self.confidence_threshold = confidence_threshold
     self.nms_threshold = nms_threshold
     self.image_size = image_size
     self.font_scale = 1
     self.font = cv2.FONT_HERSHEY_PLAIN
     self.classes = DetectionUtils.load_classes(self.class_path)
     self.colors = [(randint(0, 255), randint(0, 255), randint(0, 255))
                    for _ in range(len(self.classes) + 1)]
     self.model = self.__load_model()
 def __init__(self,
              confidence_threshold=0.8,
              nms_threshold=0.4,
              image_size=416,
              tiny=False):
     self.model_cfg = Constants.ROOT_PATH + 'config/yolov3.cfg'
     self.weights_path = Constants.ROOT_PATH + 'config/yolov3.weights'
     if tiny:
         self.model_cfg = Constants.ROOT_PATH + 'config/yolov3-tiny.cfg'
         self.weights_path = Constants.ROOT_PATH + 'config/yolov3-tiny.weights'
     self.class_path = Constants.ROOT_PATH + 'config/coco.names'
     self.confidence_threshold = confidence_threshold
     self.nms_threshold = nms_threshold
     self.image_size = image_size
     self.font_scale = 1
     self.font = cv2.FONT_HERSHEY_PLAIN
     self.classes = DetectionUtils.load_classes(self.class_path)
     # self.colors = [(randint(0, 255), randint(0, 255), randint(0, 255)) for _ in range(len(self.classes))]
     self.colors = [(0, 175, 0) for _ in range(len(self.classes))]
     self.model = self.__load_model()