Skip to content

Commit

Permalink
Fixes for things that go wrong when running (#15)
Browse files Browse the repository at this point in the history
Caption that doesn't get updated if non-default is used and check that
was only checking if something was None instead of also if it was False.
Also fix mypy pre-commit issue.
  • Loading branch information
kashton-bdai authored Oct 16, 2023
1 parent c6e5013 commit a8a6e85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vlfm/policy/base_objectnav_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def _update_object_map(

# If we are using vqa, then use the BLIP2 model to visually confirm whether
# the contours are actually correct.
if self._use_vqa is not None:
if (self._use_vqa is not None) and self._use_vqa:
contours, _ = cv2.findContours(
object_mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE
)
Expand Down
6 changes: 3 additions & 3 deletions vlfm/vlm/grounding_dino.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ def __init__(
self.box_threshold = box_threshold
self.text_threshold = text_threshold

def predict(
self, image: np.ndarray, caption: Optional[str] = ""
) -> ObjectDetections:
def predict(self, image: np.ndarray, caption: str = "") -> ObjectDetections:
"""
This function makes predictions on an input image tensor or numpy array using a
pretrained model.
Expand All @@ -62,6 +60,8 @@ def predict(
)
if caption == "":
caption_to_use = self.caption
else:
caption_to_use = caption
print("Caption:", caption_to_use)
with torch.inference_mode():
boxes, logits, phrases = predict(
Expand Down

0 comments on commit a8a6e85

Please sign in to comment.