Spaces:
Sleeping
Sleeping
Update utils/tools.py
Browse files- utils/tools.py +5 -1
utils/tools.py
CHANGED
@@ -419,7 +419,11 @@ def text_prompt(annotations, text, img_path, device, wider=False, threshold=0.9)
|
|
419 |
cropped_boxes, cropped_images, not_crop, origin_id, annotations_ = crop_image(
|
420 |
annotations, img_path
|
421 |
)
|
422 |
-
|
|
|
|
|
|
|
|
|
423 |
scores = retriev(
|
424 |
clip_model, preprocess, cropped_boxes, text, device=device
|
425 |
)
|
|
|
419 |
cropped_boxes, cropped_images, not_crop, origin_id, annotations_ = crop_image(
|
420 |
annotations, img_path
|
421 |
)
|
422 |
+
import os
|
423 |
+
clip_model_path = "CLIP_ViT_B_32.pt"
|
424 |
+
assert os.path.exists(clip_model_path)
|
425 |
+
clip_model, preprocess = clip.load(clip_model_path, device=device)
|
426 |
+
#clip_model, preprocess = clip.load("./weights/CLIP_ViT_B_32.pt", device=device)
|
427 |
scores = retriev(
|
428 |
clip_model, preprocess, cropped_boxes, text, device=device
|
429 |
)
|