Skip to content

Commit d0f8be6

Browse files
authored
fix ut and text_det create_input (#1756)
1 parent 9fee192 commit d0f8be6

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

mmdeploy/codebase/mmocr/deploy/text_detection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def process_model_config(model_cfg: mmengine.Config,
3131
mmengine.Config: the model config after processing.
3232
"""
3333
pipeline = model_cfg.test_dataloader.dataset.pipeline
34+
if isinstance(imgs[0], np.ndarray):
35+
# set loading pipeline type
36+
pipeline[0].type = 'LoadImageFromNDArray'
3437

3538
for i, transform in enumerate(pipeline):
3639
if transform.type == 'PackTextDetInputs':

tests/test_codebase/test_mmocr/data/crnn.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
img_norm_cfg = dict(mean=[127], std=[127])
5555

5656
test_pipeline = [
57+
dict(
58+
type='LoadImageFromFile',
59+
color_type='grayscale',
60+
file_client_args=dict(backend='disk')),
5761
dict(
5862
type='RescaleToHeight',
5963
height=32,

tests/test_codebase/test_mmocr/data/dbnet.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
3232

3333
test_pipeline = [
34+
dict(
35+
type='LoadImageFromFile',
36+
file_client_args=dict(backend='disk'),
37+
color_type='color_ignore_orientation'),
3438
dict(
3539
type='PackTextDetInputs',
3640
meta_keys=('img_path', 'ori_shape', 'img_shape', 'scale_factor'))
@@ -53,6 +57,10 @@
5357
pipeline=None)
5458
],
5559
pipeline=[
60+
dict(
61+
type='LoadImageFromFile',
62+
file_client_args=dict(backend='disk'),
63+
color_type='color_ignore_orientation'),
5664
dict(type='Resize', scale=(1333, 736), keep_ratio=True),
5765
dict(
5866
type='mmocr.PackTextDetInputs',

0 commit comments

Comments
 (0)