Simple debug version
Browse files- pipeline.py +14 -14
pipeline.py
CHANGED
@@ -11,15 +11,15 @@ from PIL import Image
|
|
11 |
# most of this code has been obtained from Datature's prediction script
|
12 |
# https://github.com/datature/resources/blob/main/scripts/bounding_box/prediction.py
|
13 |
|
14 |
-
def load_model():
|
15 |
-
|
16 |
|
17 |
-
model = load_model()
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
#
|
22 |
-
|
23 |
|
24 |
# def __call__(self, inputs: "Image.Image")-> List[Dict[str, Any]]:
|
25 |
|
@@ -81,12 +81,12 @@ model = load_model()
|
|
81 |
# "score": 1.0,
|
82 |
# })
|
83 |
|
84 |
-
labels = [{"score":0.9509243965148926,"label":"car","box":{"xmin":142,"ymin":106,"xmax":376,"ymax":229}},
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
|
92 |
# return labels
|
|
|
11 |
# most of this code has been obtained from Datature's prediction script
|
12 |
# https://github.com/datature/resources/blob/main/scripts/bounding_box/prediction.py
|
13 |
|
14 |
+
# def load_model():
|
15 |
+
# return tf.saved_model.load('./saved_model')
|
16 |
|
17 |
+
# model = load_model()
|
18 |
|
19 |
+
class PreTrainedPipeline():
|
20 |
+
def __init__(self, path: str):
|
21 |
+
# load the model
|
22 |
+
self.model = tf.saved_model.load(os.path.join(path, "saved_model"))
|
23 |
|
24 |
# def __call__(self, inputs: "Image.Image")-> List[Dict[str, Any]]:
|
25 |
|
|
|
81 |
# "score": 1.0,
|
82 |
# })
|
83 |
|
84 |
+
# labels = [{"score":0.9509243965148926,"label":"car","box":{"xmin":142,"ymin":106,"xmax":376,"ymax":229}},
|
85 |
+
# {"score":0.9981777667999268,"label":"car","box":{"xmin":405,"ymin":146,"xmax":640,"ymax":297}},
|
86 |
+
# {"score":0.9963648915290833,"label":"car","box":{"xmin":0,"ymin":115,"xmax":61,"ymax":167}},
|
87 |
+
# {"score":0.974663257598877,"label":"car","box":{"xmin":155,"ymin":104,"xmax":290,"ymax":141}},
|
88 |
+
# {"score":0.9986898303031921,"label":"car","box":{"xmin":39,"ymin":117,"xmax":169,"ymax":188}},
|
89 |
+
# {"score":0.9998276233673096,"label":"person","box":{"xmin":172,"ymin":60,"xmax":482,"ymax":396}},
|
90 |
+
# {"score":0.9996274709701538,"label":"skateboard","box":{"xmin":265,"ymin":348,"xmax":440,"ymax":413}}]
|
91 |
|
92 |
# return labels
|