Spaces:
Running
Running
breezedeus
commited on
Commit
•
c67f5ec
1
Parent(s):
e1274bb
use onnx backend for rec models
Browse files
app.py
CHANGED
@@ -74,7 +74,8 @@ def get_ocr_model(det_model_name, rec_model_name, det_more_configs):
|
|
74 |
return MODELS[(det_model_name, rec_model_name, config_str)]
|
75 |
|
76 |
det_model_name, det_model_backend = det_model_name.split('::')
|
77 |
-
rec_model_name, rec_model_backend = rec_model_name.split('::')
|
|
|
78 |
model = CnOcr(
|
79 |
det_model_name=det_model_name,
|
80 |
det_model_backend=det_model_backend,
|
@@ -189,7 +190,7 @@ def main():
|
|
189 |
|
190 |
all_models = list(REC_AVAILABLE_MODELS.all_models())
|
191 |
all_models.sort()
|
192 |
-
all_models = [f'{m}
|
193 |
|
194 |
title = '开源Python OCR工具:'
|
195 |
desc = (
|
@@ -212,49 +213,49 @@ def main():
|
|
212 |
[
|
213 |
'ch_PP-OCRv3_det::onnx',
|
214 |
True,
|
215 |
-
'number-densenet_lite_136-fc
|
216 |
False,
|
217 |
'docs/examples/card1-s.jpg',
|
218 |
],
|
219 |
[
|
220 |
'ch_PP-OCRv3_det::onnx',
|
221 |
True,
|
222 |
-
'number-densenet_lite_136-fc
|
223 |
False,
|
224 |
'docs/examples/card2-s.jpg',
|
225 |
],
|
226 |
[
|
227 |
'ch_PP-OCRv3_det::onnx',
|
228 |
True,
|
229 |
-
'number-densenet_lite_136-fc
|
230 |
False,
|
231 |
'docs/examples/cy1-s.jpg',
|
232 |
],
|
233 |
[
|
234 |
'ch_PP-OCRv3_det::onnx',
|
235 |
False,
|
236 |
-
'densenet_lite_136-gru
|
237 |
False,
|
238 |
'docs/examples/huochepiao.jpeg',
|
239 |
],
|
240 |
[
|
241 |
'ch_PP-OCRv3_det::onnx',
|
242 |
False,
|
243 |
-
'densenet_lite_136-gru
|
244 |
False,
|
245 |
'docs/examples/1_res.jpg',
|
246 |
],
|
247 |
[
|
248 |
'db_shufflenet_v2::pytorch',
|
249 |
False,
|
250 |
-
'en_number_mobile_v2.0
|
251 |
False,
|
252 |
'docs/examples/en_book1.jpeg',
|
253 |
],
|
254 |
[
|
255 |
'db_shufflenet_v2::pytorch',
|
256 |
False,
|
257 |
-
'densenet_lite_136-gru
|
258 |
True,
|
259 |
'docs/examples/beauty0.jpg',
|
260 |
],
|
@@ -276,7 +277,7 @@ def main():
|
|
276 |
rec_model_name = gr.Dropdown(
|
277 |
label='选择识别模型',
|
278 |
choices=all_models,
|
279 |
-
value='densenet_lite_136-fc
|
280 |
)
|
281 |
|
282 |
gr.Markdown('### 检测参数')
|
|
|
74 |
return MODELS[(det_model_name, rec_model_name, config_str)]
|
75 |
|
76 |
det_model_name, det_model_backend = det_model_name.split('::')
|
77 |
+
# rec_model_name, rec_model_backend = rec_model_name.split('::')
|
78 |
+
rec_model_backend = 'onnx'
|
79 |
model = CnOcr(
|
80 |
det_model_name=det_model_name,
|
81 |
det_model_backend=det_model_backend,
|
|
|
190 |
|
191 |
all_models = list(REC_AVAILABLE_MODELS.all_models())
|
192 |
all_models.sort()
|
193 |
+
all_models = [f'{m}' for m, b in all_models if b == 'onnx']
|
194 |
|
195 |
title = '开源Python OCR工具:'
|
196 |
desc = (
|
|
|
213 |
[
|
214 |
'ch_PP-OCRv3_det::onnx',
|
215 |
True,
|
216 |
+
'number-densenet_lite_136-fc',
|
217 |
False,
|
218 |
'docs/examples/card1-s.jpg',
|
219 |
],
|
220 |
[
|
221 |
'ch_PP-OCRv3_det::onnx',
|
222 |
True,
|
223 |
+
'number-densenet_lite_136-fc',
|
224 |
False,
|
225 |
'docs/examples/card2-s.jpg',
|
226 |
],
|
227 |
[
|
228 |
'ch_PP-OCRv3_det::onnx',
|
229 |
True,
|
230 |
+
'number-densenet_lite_136-fc',
|
231 |
False,
|
232 |
'docs/examples/cy1-s.jpg',
|
233 |
],
|
234 |
[
|
235 |
'ch_PP-OCRv3_det::onnx',
|
236 |
False,
|
237 |
+
'densenet_lite_136-gru',
|
238 |
False,
|
239 |
'docs/examples/huochepiao.jpeg',
|
240 |
],
|
241 |
[
|
242 |
'ch_PP-OCRv3_det::onnx',
|
243 |
False,
|
244 |
+
'densenet_lite_136-gru',
|
245 |
False,
|
246 |
'docs/examples/1_res.jpg',
|
247 |
],
|
248 |
[
|
249 |
'db_shufflenet_v2::pytorch',
|
250 |
False,
|
251 |
+
'en_number_mobile_v2.0',
|
252 |
False,
|
253 |
'docs/examples/en_book1.jpeg',
|
254 |
],
|
255 |
[
|
256 |
'db_shufflenet_v2::pytorch',
|
257 |
False,
|
258 |
+
'densenet_lite_136-gru',
|
259 |
True,
|
260 |
'docs/examples/beauty0.jpg',
|
261 |
],
|
|
|
277 |
rec_model_name = gr.Dropdown(
|
278 |
label='选择识别模型',
|
279 |
choices=all_models,
|
280 |
+
value='densenet_lite_136-fc',
|
281 |
)
|
282 |
|
283 |
gr.Markdown('### 检测参数')
|