Update my_model/KBVQA.py
Browse files- my_model/KBVQA.py +3 -2
my_model/KBVQA.py
CHANGED
@@ -23,6 +23,7 @@ class KBVQA():
|
|
23 |
self.captioner = None
|
24 |
self.detector = None
|
25 |
self.detection_model = None
|
|
|
26 |
self.kbvqa_model = None
|
27 |
self.access_token = os.getenv("HUGGINGFACE_TOKEN")
|
28 |
# self.kbvqa_model_loaded = self.all_models_loaded()
|
@@ -63,9 +64,9 @@ class KBVQA():
|
|
63 |
self.detector = ObjectDetector()
|
64 |
self.detector.load_model(model)
|
65 |
|
66 |
-
def detect_objects(self, img
|
67 |
image = self.detector.process_image(img)
|
68 |
-
detected_objects_string, detected_objects_list = self.detector.detect_objects(image, threshold=
|
69 |
image_with_boxes = self.detector.draw_boxes(img, detected_objects_list)
|
70 |
return image_with_boxes, detected_objects_string
|
71 |
|
|
|
23 |
self.captioner = None
|
24 |
self.detector = None
|
25 |
self.detection_model = None
|
26 |
+
self.detecttion_confidence = None
|
27 |
self.kbvqa_model = None
|
28 |
self.access_token = os.getenv("HUGGINGFACE_TOKEN")
|
29 |
# self.kbvqa_model_loaded = self.all_models_loaded()
|
|
|
64 |
self.detector = ObjectDetector()
|
65 |
self.detector.load_model(model)
|
66 |
|
67 |
+
def detect_objects(self, img):
|
68 |
image = self.detector.process_image(img)
|
69 |
+
detected_objects_string, detected_objects_list = self.detector.detect_objects(image, threshold=self.detection_confidence)
|
70 |
image_with_boxes = self.detector.draw_boxes(img, detected_objects_list)
|
71 |
return image_with_boxes, detected_objects_string
|
72 |
|