Spaces:
Runtime error
Runtime error
liuyizhang
commited on
Commit
·
760bde3
1
Parent(s):
00f982a
update app.py
Browse files
GroundingDINO/groundingdino/datasets/transforms.py
CHANGED
|
@@ -10,8 +10,8 @@ import torch
|
|
| 10 |
import torchvision.transforms as T
|
| 11 |
import torchvision.transforms.functional as F
|
| 12 |
|
| 13 |
-
from
|
| 14 |
-
from
|
| 15 |
|
| 16 |
|
| 17 |
def crop(image, target, region):
|
|
|
|
| 10 |
import torchvision.transforms as T
|
| 11 |
import torchvision.transforms.functional as F
|
| 12 |
|
| 13 |
+
from groundingdino.util.box_ops import box_xyxy_to_cxcywh
|
| 14 |
+
from groundingdino.util.misc import interpolate
|
| 15 |
|
| 16 |
|
| 17 |
def crop(image, target, region):
|
GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py
CHANGED
|
@@ -23,8 +23,8 @@ from torch import nn
|
|
| 23 |
from torchvision.ops.boxes import nms
|
| 24 |
from transformers import AutoTokenizer, BertModel, BertTokenizer, RobertaModel, RobertaTokenizerFast
|
| 25 |
|
| 26 |
-
from
|
| 27 |
-
from
|
| 28 |
NestedTensor,
|
| 29 |
accuracy,
|
| 30 |
get_world_size,
|
|
@@ -33,9 +33,9 @@ from GroundingDINO.groundingdino.util.misc import (
|
|
| 33 |
is_dist_avail_and_initialized,
|
| 34 |
nested_tensor_from_tensor_list,
|
| 35 |
)
|
| 36 |
-
from
|
| 37 |
-
from
|
| 38 |
-
from
|
| 39 |
|
| 40 |
from ..registry import MODULE_BUILD_FUNCS
|
| 41 |
from .backbone import build_backbone
|
|
|
|
| 23 |
from torchvision.ops.boxes import nms
|
| 24 |
from transformers import AutoTokenizer, BertModel, BertTokenizer, RobertaModel, RobertaTokenizerFast
|
| 25 |
|
| 26 |
+
from groundingdino.util import box_ops, get_tokenlizer
|
| 27 |
+
from groundingdino.util.misc import (
|
| 28 |
NestedTensor,
|
| 29 |
accuracy,
|
| 30 |
get_world_size,
|
|
|
|
| 33 |
is_dist_avail_and_initialized,
|
| 34 |
nested_tensor_from_tensor_list,
|
| 35 |
)
|
| 36 |
+
from groundingdino.util.utils import get_phrases_from_posmap
|
| 37 |
+
from groundingdino.util.visualizer import COCOVisualizer
|
| 38 |
+
from groundingdino.util.vl_utils import create_positive_map_from_span
|
| 39 |
|
| 40 |
from ..registry import MODULE_BUILD_FUNCS
|
| 41 |
from .backbone import build_backbone
|
app.py
CHANGED
|
@@ -1,11 +1,19 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
import argparse
|
| 8 |
import copy
|
|
|
|
| 9 |
|
| 10 |
import numpy as np
|
| 11 |
import torch
|
|
|
|
| 1 |
+
|
| 2 |
+
import subprocess
|
| 3 |
+
|
| 4 |
+
result = subprocess.run(['pip', 'install', '-e', 'segment_anything'], check=True)
|
| 5 |
+
print(f'install segment_anything result = {result}')
|
| 6 |
+
result = subprocess.run(['pip', 'install', '-e', 'GroundingDINO'], check=True)
|
| 7 |
+
print(f'install GroundingDINO result = {result}')
|
| 8 |
+
|
| 9 |
+
# os.system("pip install -e segment_anything")
|
| 10 |
+
# os.system("pip install -e GroundingDINO")
|
| 11 |
|
| 12 |
import gradio as gr
|
| 13 |
|
| 14 |
import argparse
|
| 15 |
import copy
|
| 16 |
+
import os
|
| 17 |
|
| 18 |
import numpy as np
|
| 19 |
import torch
|