diff --git a/.gitignore b/.gitignore index fdc0e71..bc5ad2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +test_weight/ # IDE .idea/ .vscode/ diff --git a/demo/inference_on_a_image.py b/demo/inference_on_a_image.py index 62546d7..51e2634 100644 --- a/demo/inference_on_a_image.py +++ b/demo/inference_on_a_image.py @@ -27,6 +27,7 @@ def plot_boxes_to_image(image_pil, tgt): for box, label in zip(boxes, labels): # from 0..1 to 0..W, 0..H box = box * torch.Tensor([W, H, W, H]) + print("label:",label) # from xywh to xyxy box[:2] -= box[2:] / 2 box[2:] += box[:2] diff --git a/groundingdino/util/get_tokenlizer.py b/groundingdino/util/get_tokenlizer.py index f7dcf7e..bb6ed4f 100644 --- a/groundingdino/util/get_tokenlizer.py +++ b/groundingdino/util/get_tokenlizer.py @@ -1,3 +1,4 @@ +import os from transformers import AutoTokenizer, BertModel, BertTokenizer, RobertaModel, RobertaTokenizerFast @@ -23,4 +24,7 @@ def get_pretrained_language_model(text_encoder_type): return BertModel.from_pretrained(text_encoder_type) if text_encoder_type == "roberta-base": return RobertaModel.from_pretrained(text_encoder_type) + + if os.path.isdir(text_encoder_type): + return BertModel.from_pretrained(text_encoder_type) raise ValueError("Unknown text_encoder_type {}".format(text_encoder_type)) diff --git a/groundingdino/version.py b/groundingdino/version.py index 3dc1f76..b794fd4 100644 --- a/groundingdino/version.py +++ b/groundingdino/version.py @@ -1 +1 @@ -__version__ = "0.1.0" +__version__ = '0.1.0'