Spaces:
Running
on
T4
Running
on
T4
efengx
commited on
Commit
·
0098847
1
Parent(s):
e6e25c0
fix: update
Browse files- fengxai/SelfSupervised.py +4 -2
- fengxai/inference.py +1 -1
fengxai/SelfSupervised.py
CHANGED
@@ -4,13 +4,13 @@ import cv2
|
|
4 |
import numpy as np
|
5 |
from segment_anything import SamPredictor, sam_model_registry
|
6 |
from diffusers import StableDiffusionInpaintPipeline
|
7 |
-
from groundingdino.util.inference import load_model, load_image, predict, annotate
|
8 |
from torchvision.ops import box_convert
|
9 |
from typing import List
|
10 |
|
11 |
class SelfSupervised:
|
12 |
-
|
13 |
def __init__(self):
|
|
|
|
|
14 |
# -----Set Image and CUDA
|
15 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
# ------SAM Parameters
|
@@ -48,6 +48,8 @@ class SelfSupervised:
|
|
48 |
|
49 |
# 预测图片
|
50 |
def imagePredict(self, imgFile, item="clothing", boxThreshold=0.3, textTreshold=0.25):
|
|
|
|
|
51 |
src, img = load_image(imgFile)
|
52 |
h, w, _ = src.shape
|
53 |
boxes, logits, phrases = predict(
|
|
|
4 |
import numpy as np
|
5 |
from segment_anything import SamPredictor, sam_model_registry
|
6 |
from diffusers import StableDiffusionInpaintPipeline
|
|
|
7 |
from torchvision.ops import box_convert
|
8 |
from typing import List
|
9 |
|
10 |
class SelfSupervised:
|
|
|
11 |
def __init__(self):
|
12 |
+
from groundingdino.util.inference import load_model
|
13 |
+
|
14 |
# -----Set Image and CUDA
|
15 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
# ------SAM Parameters
|
|
|
48 |
|
49 |
# 预测图片
|
50 |
def imagePredict(self, imgFile, item="clothing", boxThreshold=0.3, textTreshold=0.25):
|
51 |
+
from groundingdino.util.inference import load_image, predict
|
52 |
+
|
53 |
src, img = load_image(imgFile)
|
54 |
h, w, _ = src.shape
|
55 |
boxes, logits, phrases = predict(
|
fengxai/inference.py
CHANGED
@@ -6,7 +6,7 @@ def imagePrediction(imageFile, funcCallback):
|
|
6 |
and not os.path.exists("weights/groundingdino_swint_ogc.pth"):
|
7 |
cmd = "pip install git+https://github.com/IDEA-Research/GroundingDINO.git"
|
8 |
os.system(cmd)
|
9 |
-
|
10 |
cmd = """
|
11 |
mkdir weights \
|
12 |
&& cd weights \
|
|
|
6 |
and not os.path.exists("weights/groundingdino_swint_ogc.pth"):
|
7 |
cmd = "pip install git+https://github.com/IDEA-Research/GroundingDINO.git"
|
8 |
os.system(cmd)
|
9 |
+
|
10 |
cmd = """
|
11 |
mkdir weights \
|
12 |
&& cd weights \
|