def __init__(self):
    self.bridge = CvBridge()
    self.n_gpu = rospy.get_param('~n_gpu', default=1)
    self.backend = rospy.get_param('~backend', default='full_yolo')
    self.backend_path = rospy.get_param('~weights_path')
    self.input_size = rospy.get_param('~input_size', default=416)
    self.labels = rospy.get_param('~labels')
    self.max_number_detections = rospy.get_param('~max_number_detections', default=5)
    self.anchors = rospy.get_param('~anchors', default=[0.57273, 0.677385, 1.87446, 2.06253, 3.33843, 5.47434, 7.88282, 3.52778, 9.77052, 9.16828])
    self.weights_path = rospy.get_param('~weights_path', default='../weights/full_yolo.h5')
    self.weight_file = rospy.get_param('~weight_file')
    self.yolo = YOLO(n_gpu=self.n_gpu, backend=self.backend, backend_path=self.backend_path, input_size=self.input_size, labels=self.labels, max_box_per_image=self.max_number_detections, anchors=self.anchors)
    self.yolo.load_weights(((self.weights_path + '/') + self.weight_file))
    rospy.loginfo('YOLO detector ready...')
    s = rospy.Service('yolo_detect', YoloDetect, self._handle_yolo_detect, buff_size=10000000)
    s.spin()
def __init__(self):
    self.bridge = CvBridge()
    self.n_gpu = rospy.get_param('~n_gpu', default=1)
    self.backend = rospy.get_param('~backend', default='full_yolo')
    self.backend_path = rospy.get_param('~weights_path')
    self.input_size = rospy.get_param('~input_size', default=416)
    self.labels = rospy.get_param('~labels')
    self.max_number_detections = rospy.get_param('~max_number_detections', default=5)
    self.anchors = rospy.get_param('~anchors', default=[0.57273, 0.677385, 1.87446, 2.06253, 3.33843, 5.47434, 7.88282, 3.52778, 9.77052, 9.16828])
    self.weights_path = rospy.get_param('~weights_path', default='../weights/full_yolo.h5')
    self.weight_file = rospy.get_param('~weight_file')
    self.yolo = YOLO(n_gpu=self.n_gpu, backend=self.backend, backend_path=self.backend_path, input_size=self.input_size, labels=self.labels, max_box_per_image=self.max_number_detections, anchors=self.anchors)
    self.yolo.load_weights(((self.weights_path + '/') + self.weight_file))
    rospy.loginfo('YOLO detector ready...')
    s = rospy.Service('yolo_detect', YoloDetect, self._handle_yolo_detect, buff_size=10000000)
    s.spin()