Spaces:
Running
on
T4
Running
on
T4
Update segment_image.py
Browse files- segment_image.py +10 -10
segment_image.py
CHANGED
@@ -182,11 +182,11 @@ class SegmentImage:
|
|
182 |
|
183 |
def get_region_preds(self, img):
|
184 |
"""Function for predicting text region coordinates."""
|
185 |
-
results = self.region_model
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
results = results[0].cpu()
|
191 |
if results.masks:
|
192 |
# Extracts detected region polygons
|
@@ -211,11 +211,11 @@ class SegmentImage:
|
|
211 |
|
212 |
def get_line_preds(self, img):
|
213 |
"""Function for predicting text line coordinates."""
|
214 |
-
results = self.line_model
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
results = results[0].cpu()
|
220 |
if results.masks:
|
221 |
# Detected text line polygons
|
|
|
182 |
|
183 |
def get_region_preds(self, img):
|
184 |
"""Function for predicting text region coordinates."""
|
185 |
+
results = self.region_model(source=img,
|
186 |
+
device=self.device,
|
187 |
+
conf=self.region_conf_threshold,
|
188 |
+
half=bool(self.region_half_precision),
|
189 |
+
iou=self.region_nms_iou)
|
190 |
results = results[0].cpu()
|
191 |
if results.masks:
|
192 |
# Extracts detected region polygons
|
|
|
211 |
|
212 |
def get_line_preds(self, img):
|
213 |
"""Function for predicting text line coordinates."""
|
214 |
+
results = self.line_model(source=img,
|
215 |
+
device=self.device,
|
216 |
+
conf=self.line_conf_threshold,
|
217 |
+
half=bool(self.line_half_precision),
|
218 |
+
iou=self.line_nms_iou)
|
219 |
results = results[0].cpu()
|
220 |
if results.masks:
|
221 |
# Detected text line polygons
|