Spaces:
Sleeping
Sleeping
Update onnx_text_recognition.py
Browse files- onnx_text_recognition.py +3 -0
onnx_text_recognition.py
CHANGED
|
@@ -89,6 +89,7 @@ class TextRecognition:
|
|
| 89 |
else:
|
| 90 |
n = math.ceil(len(cropped_lines) / self.line_threshold)
|
| 91 |
for i in range(n):
|
|
|
|
| 92 |
start = int(i * self.line_threshold)
|
| 93 |
end = int(min(start + self.line_threshold, len(cropped_lines)))
|
| 94 |
sc, gt = self.predict_text(cropped_lines[start:end])
|
|
@@ -107,7 +108,9 @@ class TextRecognition:
|
|
| 107 |
|
| 108 |
def process_lines(self, polygons, image, height, width):
|
| 109 |
# Crop line images
|
|
|
|
| 110 |
cropped_lines = self.crop_lines(polygons, image, height, width)
|
|
|
|
| 111 |
# Get text predictions
|
| 112 |
scores, generated_text = self.get_text_lines(cropped_lines)
|
| 113 |
return generated_text
|
|
|
|
| 89 |
else:
|
| 90 |
n = math.ceil(len(cropped_lines) / self.line_threshold)
|
| 91 |
for i in range(n):
|
| 92 |
+
print(i)
|
| 93 |
start = int(i * self.line_threshold)
|
| 94 |
end = int(min(start + self.line_threshold, len(cropped_lines)))
|
| 95 |
sc, gt = self.predict_text(cropped_lines[start:end])
|
|
|
|
| 108 |
|
| 109 |
def process_lines(self, polygons, image, height, width):
|
| 110 |
# Crop line images
|
| 111 |
+
print('starting text generation')
|
| 112 |
cropped_lines = self.crop_lines(polygons, image, height, width)
|
| 113 |
+
print('cropped lines')
|
| 114 |
# Get text predictions
|
| 115 |
scores, generated_text = self.get_text_lines(cropped_lines)
|
| 116 |
return generated_text
|