repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/test.py
tools/test.py
#!/usr/bin/env python # Copyright (c) OpenMMLab. All rights reserved. import argparse import os import warnings import mmcv import torch from mmcv import Config, DictAction from mmcv.cnn import fuse_conv_bn from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (get_dist_info, init...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/det_test_imgs.py
tools/det_test_imgs.py
#!/usr/bin/env python # Copyright (c) OpenMMLab. All rights reserved. import os.path as osp from argparse import ArgumentParser import mmcv from mmcv.utils import ProgressBar from mmocr.apis import init_detector, model_inference from mmocr.models import build_detector # noqa: F401 from mmocr.utils import list_from_f...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/misc/print_config.py
tools/misc/print_config.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import warnings from mmcv import Config, DictAction def parse_args(): parser = argparse.ArgumentParser(description='Print the whole config') parser.add_argument('config', help='config file path') parser.add_argument( '--options', ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/detext_converter.py
tools/data/textrecog/detext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os import os.path as osp import mmcv import numpy as np from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir): """Collect all images and their correspond...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/imgur_converter.py
tools/data/textrecog/imgur_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os import os.path as osp import mmcv import numpy as np from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def parse_args(): parser = argparse.ArgumentParser( descri...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/totaltext_converter.py
tools/data/textrecog/totaltext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import os import os.path as osp import re import mmcv import numpy as np import scipy.io as scio import yaml from shapely.geometry import Polygon from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/ic13_converter.py
tools/data/textrecog/ic13_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os.path as osp from mmocr.utils.fileio import list_to_file def convert_annotations(root_path, split, format): """Convert original annotations to mmocr format The annotation format is as the following: word_1.png, "flyi...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/lsvt_converter.py
tools/data/textrecog/lsvt_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os.path as osp from functools import partial import mmcv from mmocr.utils.fileio import list_to_file def parse_args(): parser = argparse.ArgumentParser( description='Generate training and validation set of LSV...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/seg_synthtext_converter.py
tools/data/textrecog/seg_synthtext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os.path as osp import cv2 from mmocr.utils import list_from_file, list_to_file def parse_old_label(data_root, in_path, img_size=False): imgid2imgname = {} imgid2anno = {} idx = 0 for line in list_from_file(in_path): ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/kaist_converter.py
tools/data/textrecog/kaist_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os import os.path as osp import xml.etree.ElementTree as ET import mmcv from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir, ratio): """Coll...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/rects_converter.py
tools/data/textrecog/rects_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os import os.path as osp import mmcv from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir, ratio): """Collect all images and their correspond...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/hiertext_converter.py
tools/data/textrecog/hiertext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os.path as osp from functools import partial import mmcv import numpy as np from shapely.geometry import Polygon from mmocr.utils.fileio import list_to_file def seg2bbox(seg): """Convert segmentation to bbox. Arg...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/rctw_converter.py
tools/data/textrecog/rctw_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os import os.path as osp import mmcv from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir, ratio): """Collect all images and their correspond...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/funsd_converter.py
tools/data/textrecog/funsd_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os import os.path as osp import mmcv from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir): """Collect all images and their corresponding gro...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/sroie_converter.py
tools/data/textrecog/sroie_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os import os.path as osp import mmcv import numpy as np from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir): """Collect all images and their correspond...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/ic11_converter.py
tools/data/textrecog/ic11_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os.path as osp from mmocr.utils.fileio import list_to_file def convert_annotations(root_path, split, format): """Convert original annotations to mmocr format. The annotation format is as the following: word_1.png, "fl...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/bid_converter.py
tools/data/textrecog/bid_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os import os.path as osp import mmcv from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir): """Collect all images and their corresponding groundtruth fil...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/naf_converter.py
tools/data/textrecog/naf_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os.path as osp import mmcv import numpy as np from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir, split_info): """Collect all images and their correspo...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/vintext_converter.py
tools/data/textrecog/vintext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os import os.path as osp import mmcv from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir): """Collect all images and their corresponding groundtruth fil...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/ilst_converter.py
tools/data/textrecog/ilst_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os import os.path as osp import xml.etree.ElementTree as ET import mmcv from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir): """Collect all images and ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/mtwi_converter.py
tools/data/textrecog/mtwi_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os import os.path as osp import cv2 import mmcv from PIL import Image from mmocr.datasets.pipelines.crop import crop_img from mmocr.utils.fileio import list_to_file def collect_files(img_dir, gt_dir, ratio): """Collec...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/svt_converter.py
tools/data/textrecog/svt_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import xml.etree.ElementTree as ET import cv2 from mmocr.utils.fileio import list_to_file def parse_args(): parser = argparse.ArgumentParser( description='Generate testset of svt by cropping box image.') ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/textocr_converter.py
tools/data/textrecog/textocr_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os import os.path as osp from functools import partial import mmcv from mmocr.utils.fileio import list_to_file def parse_args(): parser = argparse.ArgumentParser( description='Generate training and validation set of TextO...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/cocotext_converter.py
tools/data/textrecog/cocotext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os.path as osp from functools import partial import mmcv from mmocr.utils.fileio import list_to_file def parse_args(): parser = argparse.ArgumentParser( description='Generate training and validation set of COC...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/openvino_converter.py
tools/data/textrecog/openvino_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import math import os import os.path as osp from argparse import ArgumentParser from functools import partial import mmcv from PIL import Image from mmocr.utils.fileio import list_to_file def parse_args(): parser = ArgumentParser(description='Generate training and...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/synthtext_converter.py
tools/data/textrecog/synthtext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os from functools import partial import mmcv import numpy as np from scipy.io import loadmat def parse_args(): parser = argparse.ArgumentParser( description='Crop images in Synthtext-style dataset in ' 'prepration for MMOCR\'s...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/lv_converter.py
tools/data/textrecog/lv_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os.path as osp from mmocr.utils.fileio import list_to_file def convert_annotations(root_path, split, format): """Convert original annotations to mmocr format. The annotation format is as the following: Crops/val/11/1/...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textrecog/art_converter.py
tools/data/textrecog/art_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import math import os.path as osp import mmcv from mmocr.utils.fileio import list_to_file def parse_args(): parser = argparse.ArgumentParser( description='Generate training and validation set of ArT ') parser.add_argument('r...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/utils/lmdb_converter.py
tools/data/utils/lmdb_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse from mmocr.utils import recog2lmdb def main(): parser = argparse.ArgumentParser() parser.add_argument('label_path', type=str, help='Path to label file') parser.add_argument('output', type=str, help='Output lmdb path') parser.add_argument...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/common/extract_kaist.py
tools/data/common/extract_kaist.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import shutil import xml.etree.ElementTree as ET import zipfile from xml.etree.ElementTree import ParseError def extract(root_path): idx = 0 for language in ['English', 'Korean', 'Mixed']: for camera in ['D...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/common/curvedsyntext_converter.py
tools/data/common/curvedsyntext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp from functools import partial import mmcv import numpy as np from mmocr.utils import bezier_to_polygon, sort_points # The default dictionary used by CurvedSynthText dict95 = [ ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/common/labelme_converter.py
tools/data/common/labelme_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import json import os.path as osp import warnings from functools import partial import mmcv from mmocr.datasets.pipelines.crop import crop_img, warp_img from mmocr.utils import list_to_file def parse_labelme_json(json_file, ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/kie/closeset_to_openset.py
tools/data/kie/closeset_to_openset.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json from functools import partial import mmcv from mmocr.utils import list_from_file, list_to_file def convert(closeset_line, merge_bg_others=False, ignore_idx=0, others_idx=25): """Convert line-json str of closeset to line-json str of open...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/detext_converter.py
tools/data/textdet/detext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import mmcv import numpy as np from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir): """Collect all images and their corresponding groundtruth files. Args: img_dir (str): The im...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/imgur_converter.py
tools/data/textdet/imgur_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os.path as osp import mmcv import numpy as np from mmocr.utils import convert_annotations def parse_args(): parser = argparse.ArgumentParser( description='Generate training, validation and test set of IMGUR ') parser....
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/totaltext_converter.py
tools/data/textdet/totaltext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import os import os.path as osp import re import cv2 import mmcv import numpy as np import scipy.io as scio import yaml from shapely.geometry import Polygon from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir): ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/ic13_converter.py
tools/data/textdet/ic13_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import mmcv from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir, split): """Collect all images and their corresponding groundtruth files. Args: img_dir (str): The image director...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/lsvt_converter.py
tools/data/textdet/lsvt_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os.path as osp import mmcv from mmocr.utils import convert_annotations def parse_args(): parser = argparse.ArgumentParser( description='Generate training and validation set of LSVT ') parser.add_argument('root_path', ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/kaist_converter.py
tools/data/textdet/kaist_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os import os.path as osp import xml.etree.ElementTree as ET import mmcv from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir, ratio): """Collect all images and their corresponding groundtruth files. ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/rects_converter.py
tools/data/textdet/rects_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os import os.path as osp import mmcv from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir, ratio): """Collect all images and their corresponding groundtruth files. Args: img_dir (str): The ima...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/hiertext_converter.py
tools/data/textdet/hiertext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os.path as osp import numpy as np from shapely.geometry import Polygon from mmocr.utils import convert_annotations def collect_level_info(annotation): """Collect information from any level in HierText. Args: annotati...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/rctw_converter.py
tools/data/textdet/rctw_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os import os.path as osp import mmcv from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir, ratio): """Collect all images and their corresponding groundtruth files. Args: img_dir (str): The ima...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/ctw1500_converter.py
tools/data/textdet/ctw1500_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import os.path as osp import xml.etree.ElementTree as ET from functools import partial import mmcv import numpy as np from shapely.geometry import Polygon from mmocr.utils import convert_annotations, list_from_file def collect_files(img_dir...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/funsd_converter.py
tools/data/textdet/funsd_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os import os.path as osp import mmcv from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir): """Collect all images and their corresponding groundtruth files. Args: img_dir (str): The image dir...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/sroie_converter.py
tools/data/textdet/sroie_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import mmcv import numpy as np from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir): """Collect all images and their corresponding groundtruth files. Args: img_dir (str): The im...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/ic11_converter.py
tools/data/textdet/ic11_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import mmcv from PIL import Image from mmocr.utils import convert_annotations def convert_gif(img_path): """Convert the gif image to png format. Args: img_path (str): The path to the gif image """ ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/bid_converter.py
tools/data/textdet/bid_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import mmcv from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir): """Collect all images and their corresponding groundtruth files. Args: img_dir (str): The image directory ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/naf_converter.py
tools/data/textdet/naf_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import mmcv from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir, split_info): """Collect all images and their corresponding groundtruth files. Args: img_dir (str): The image directory ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/vintext_converter.py
tools/data/textdet/vintext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import mmcv from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir): """Collect all images and their corresponding groundtruth files. Args: img_dir (str): The image directory ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/ilst_converter.py
tools/data/textdet/ilst_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import xml.etree.ElementTree as ET import mmcv from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir): """Collect all images and their corresponding groundtruth files. Args: img_d...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/mtwi_converter.py
tools/data/textdet/mtwi_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os import os.path as osp import cv2 import mmcv from PIL import Image from mmocr.utils import convert_annotations def collect_files(img_dir, gt_dir, ratio): """Collect all images and their corresponding groundtruth files. Arg...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/textocr_converter.py
tools/data/textdet/textocr_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os.path as osp import mmcv from mmocr.utils import convert_annotations def parse_args(): parser = argparse.ArgumentParser( description='Generate training and validation set of TextOCR ') parser.add_argument('root_path...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/cocotext_converter.py
tools/data/textdet/cocotext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os.path as osp import mmcv from mmocr.utils import convert_annotations def parse_args(): parser = argparse.ArgumentParser( description='Generate training and validation set of COCO Text v2 ') parser.add_argument('root...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/synthtext_converter.py
tools/data/textdet/synthtext_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os.path as osp import time import lmdb import mmcv import numpy as np from scipy.io import loadmat from shapely.geometry import Polygon from mmocr.utils import check_argument def trace_boundary(char_boxes): """Trace the boundary ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/icdar_converter.py
tools/data/textdet/icdar_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import os.path as osp from functools import partial import mmcv import numpy as np from shapely.geometry import Polygon from mmocr.utils import convert_annotations, list_from_file def collect_files(img_dir, gt_dir): """Collect all image...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/lv_converter.py
tools/data/textdet/lv_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import xml.etree.ElementTree as ET import mmcv from mmocr.utils import convert_annotations def collect_files(data_dir): """Collect all images and their corresponding groundtruth files. Args: data_dir (st...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/art_converter.py
tools/data/textdet/art_converter.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import math import os.path as osp import mmcv from mmocr.utils import convert_annotations def parse_args(): parser = argparse.ArgumentParser( description='Generate training and validation set of ArT ') parser.add_argument('root_path', h...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/data/textdet/coco_to_line_dict.py
tools/data/textdet/coco_to_line_dict.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import mmcv from mmocr.utils import list_to_file def parse_coco_json(in_path): json_obj = mmcv.load(in_path) image_infos = json_obj['images'] annotations = json_obj['annotations'] imgid2imgname = {} img_ids = [] for ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/deployment/deploy_test.py
tools/deployment/deploy_test.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import warnings from mmcv import Config from mmcv.parallel import MMDataParallel from mmcv.runner import get_dist_info from mmdet.apis import single_gpu_test from mmocr.apis.inference import disable_text_recog_aug_test from mmocr.core.deployment import (...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/deployment/onnx2tensorrt.py
tools/deployment/onnx2tensorrt.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import warnings from typing import Iterable import cv2 import mmcv import numpy as np import torch from mmcv.parallel import collate from mmcv.tensorrt import is_tensorrt_plugin_loaded, onnx2trt, save_trt_engine from mmdet....
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/deployment/pytorch2onnx.py
tools/deployment/pytorch2onnx.py
# Copyright (c) OpenMMLab. All rights reserved. import warnings from argparse import ArgumentParser from functools import partial import cv2 import numpy as np import torch from mmcv.onnx import register_extra_symbolics from mmcv.parallel import collate from mmdet.datasets import replace_ImageToTensor from mmdet.datas...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/deployment/mmocr_handler.py
tools/deployment/mmocr_handler.py
# Copyright (c) OpenMMLab. All rights reserved. import base64 import os import mmcv import torch from ts.torch_handler.base_handler import BaseHandler from mmocr.apis import init_detector, model_inference from mmocr.datasets.pipelines import * # NOQA class MMOCRHandler(BaseHandler): threshold = 0.5 def in...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/deployment/test_torchserve.py
tools/deployment/test_torchserve.py
# Copyright (c) OpenMMLab. All rights reserved. from argparse import ArgumentParser import numpy as np import requests from mmocr.apis import init_detector, model_inference def parse_args(): parser = ArgumentParser() parser.add_argument('img', help='Image file') parser.add_argument('config', help='Confi...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tools/deployment/mmocr2torchserve.py
tools/deployment/mmocr2torchserve.py
# Copyright (c) OpenMMLab. All rights reserved. from argparse import ArgumentParser, Namespace from pathlib import Path from tempfile import TemporaryDirectory import mmcv try: from model_archiver.model_packaging import package_model from model_archiver.model_packaging_utils import ModelExportUtils except Imp...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_tools/test_data_converter.py
tests/test_tools/test_data_converter.py
# Copyright (c) OpenMMLab. All rights reserved. """Test orientation check and ignore method.""" import shutil import tempfile from mmocr.utils import drop_orientation def test_drop_orientation(): img_file = 'tests/data/test_img2.jpg' output_file = drop_orientation(img_file) assert output_file is img_fil...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_core/test_deploy_utils.py
tests/test_core/test_deploy_utils.py
# Copyright (c) OpenMMLab. All rights reserved. import tempfile from functools import partial import mmcv import numpy as np import pytest import torch from packaging import version from mmocr.core.deployment import (ONNXRuntimeDetector, ONNXRuntimeRecognizer, TensorRTDetector, Tens...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_core/test_end2end_vis.py
tests/test_core/test_end2end_vis.py
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np from mmocr.core import det_recog_show_result def test_det_recog_show_result(): img = np.ones((100, 100, 3), dtype=np.uint8) * 255 det_recog_res = { 'result': [{ 'box': [51, 88, 51, 62, 85, 62, 85, 88], 'box_sco...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_loader.py
tests/test_dataset/test_loader.py
# Copyright (c) OpenMMLab. All rights reserved. import json import os.path as osp import tempfile import pytest from mmocr.datasets.utils.backend import (HardDiskAnnFileBackend, HTTPAnnFileBackend, PetrelAnnFileBackend) from mmocr.dat...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_crop.py
tests/test_dataset/test_crop.py
# Copyright (c) OpenMMLab. All rights reserved. import math from itertools import chain, permutations import numpy as np import pytest from mmocr.datasets.pipelines.box_utils import sort_vertex, sort_vertex8 from mmocr.datasets.pipelines.crop import box_jitter, crop_img, warp_img def test_order_vertex(): dummy_...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_test_time_aug.py
tests/test_dataset/test_test_time_aug.py
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import pytest from mmocr.datasets.pipelines.test_time_aug import MultiRotateAugOCR def test_resize_ocr(): input_img1 = np.ones((64, 256, 3), dtype=np.uint8) input_img2 = np.ones((64, 32, 3), dtype=np.uint8) rci = MultiRotateAugOCR(transf...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_textdet_targets.py
tests/test_dataset/test_textdet_targets.py
# Copyright (c) OpenMMLab. All rights reserved. from unittest import mock import numpy as np from mmdet.core import PolygonMasks import mmocr.datasets.pipelines.custom_format_bundle as cf_bundle import mmocr.datasets.pipelines.textdet_targets as textdet_targets @mock.patch('%s.cf_bundle.show_feature' % __name__) de...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_dbnet_transforms.py
tests/test_dataset/test_dbnet_transforms.py
# Copyright (c) OpenMMLab. All rights reserved. import imgaug import numpy as np from shapely.geometry import Polygon import mmocr.datasets.pipelines.dbnet_transforms as transforms def test_imgaug(): args = [dict(cls='Affine', translate_px=dict(x=-10, y=-10))] imgaug_transform = transforms.ImgAug(args, clip_...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_ocr_seg_target.py
tests/test_dataset/test_ocr_seg_target.py
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import numpy as np import pytest from mmocr.datasets.pipelines.ocr_seg_targets import OCRSegTargets def _create_dummy_dict_file(dict_file): chars = list('0123456789') with open(dict_file, 'w') as fw: for char in ch...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_parser.py
tests/test_dataset/test_parser.py
# Copyright (c) OpenMMLab. All rights reserved. import json import pytest from mmocr.datasets.utils.parser import LineJsonParser, LineStrParser def test_line_str_parser(): data_ret = ['sample1.jpg hello\n', 'sample2.jpg world'] keys = ['filename', 'text'] keys_idx = [0, 1] separator = ' ' # tes...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_loading.py
tests/test_dataset/test_loading.py
# Copyright (c) OpenMMLab. All rights reserved. import copy import numpy as np from mmocr.datasets.pipelines import LoadImageFromNdarray, LoadTextAnnotations def _create_dummy_ann(): results = {} results['img_info'] = {} results['img_info']['height'] = 1000 results['img_info']['width'] = 1000 re...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_ocr_dataset.py
tests/test_dataset/test_ocr_dataset.py
# Copyright (c) OpenMMLab. All rights reserved. import math import os.path as osp import tempfile from mmocr.datasets.ocr_dataset import OCRDataset def _create_dummy_ann_file(ann_file): ann_info1 = 'sample1.jpg hello' ann_info2 = 'sample2.jpg world' with open(ann_file, 'w') as fw: for ann_info i...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_uniform_concat_dataset.py
tests/test_dataset/test_uniform_concat_dataset.py
# Copyright (c) OpenMMLab. All rights reserved. import copy import pytest from mmdet.datasets import DATASETS from mmocr.datasets import UniformConcatDataset from mmocr.utils import list_from_file def test_uniform_concat_dataset_pipeline(): pipeline1 = [dict(type='LoadImageFromFile')] pipeline2 = [dict(type...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_detect_dataset.py
tests/test_dataset/test_detect_dataset.py
# Copyright (c) OpenMMLab. All rights reserved. import json import os.path as osp import tempfile import numpy as np from mmocr.datasets.text_det_dataset import TextDetDataset def _create_dummy_ann_file(ann_file): ann_info1 = { 'file_name': 'sample1.jpg', 'height': 640, '...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_ner_dataset.py
tests/test_dataset/test_ner_dataset.py
# Copyright (c) OpenMMLab. All rights reserved. import json import os.path as osp import tempfile import torch from mmocr.datasets.ner_dataset import NerDataset from mmocr.models.ner.convertors.ner_convertor import NerConvertor from mmocr.utils import list_to_file def _create_dummy_ann_file(ann_file): data = { ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_icdar_dataset.py
tests/test_dataset/test_icdar_dataset.py
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import mmcv import numpy as np from mmocr.datasets.icdar_dataset import IcdarDataset def _create_dummy_icdar_json(json_name): image_1 = { 'id': 0, 'width': 640, 'height': 640, 'file_name': 'fake...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_transform_wrappers.py
tests/test_dataset/test_transform_wrappers.py
# Copyright (c) OpenMMLab. All rights reserved. import copy import unittest.mock as mock import numpy as np import pytest from mmocr.datasets.pipelines import (OneOfWrapper, RandomWrapper, TorchVisionWrapper) from mmocr.datasets.pipelines.transforms import ColorJitter def test_...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_transforms.py
tests/test_dataset/test_transforms.py
# Copyright (c) OpenMMLab. All rights reserved. import copy import unittest.mock as mock import numpy as np import pytest import torchvision.transforms as TF from mmdet.core import BitmapMasks, PolygonMasks from PIL import Image import mmocr.datasets.pipelines.transforms as transforms @mock.patch('%s.transforms.np....
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_openset_kie_dataset.py
tests/test_dataset/test_openset_kie_dataset.py
# Copyright (c) OpenMMLab. All rights reserved. import json import math import os.path as osp import tempfile import torch from mmocr.datasets.openset_kie_dataset import OpensetKIEDataset from mmocr.utils import list_to_file def _create_dummy_ann_file(ann_file): ann_info1 = { 'file_name': '1.png...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_kie_dataset.py
tests/test_dataset/test_kie_dataset.py
# Copyright (c) OpenMMLab. All rights reserved. import json import math import os.path as osp import tempfile import pytest import torch from mmocr.datasets.kie_dataset import KIEDataset def _create_dummy_ann_file(ann_file): ann_info1 = { 'file_name': 'sample1.png', 'height': 200...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_ocr_seg_dataset.py
tests/test_dataset/test_ocr_seg_dataset.py
# Copyright (c) OpenMMLab. All rights reserved. import json import math import os.path as osp import tempfile import pytest from mmocr.datasets.ocr_seg_dataset import OCRSegDataset def _create_dummy_ann_file(ann_file): ann_info1 = { 'file_name': 'sample1.png', 'annotations': [{ ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_base_dataset.py
tests/test_dataset/test_base_dataset.py
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import numpy as np import pytest from mmocr.datasets.base_dataset import BaseDataset def _create_dummy_ann_file(ann_file): ann_info1 = 'sample1.jpg hello' ann_info2 = 'sample2.jpg world' with open(ann_file, 'w') as fw...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_dataset/test_ocr_transforms.py
tests/test_dataset/test_ocr_transforms.py
# Copyright (c) OpenMMLab. All rights reserved. import math import unittest.mock as mock import numpy as np import torch import torchvision.transforms.functional as TF from PIL import Image import mmocr.datasets.pipelines.ocr_transforms as transforms def test_resize_ocr(): input_img = np.ones((64, 256, 3), dtyp...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_metrics/test_eval_utils.py
tests/test_metrics/test_eval_utils.py
# Copyright (c) OpenMMLab. All rights reserved. """Tests the utils of evaluation.""" import numpy as np import pytest from shapely.geometry import MultiPolygon, Polygon import mmocr.core.evaluation.utils as utils def test_ignore_pred(): # test invalid arguments box = [0, 0, 1, 0, 1, 1, 0, 1] det_boxes =...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_metrics/test_hmean_detect.py
tests/test_metrics/test_hmean_detect.py
# Copyright (c) OpenMMLab. All rights reserved. import tempfile import numpy as np import pytest from mmocr.core.evaluation.hmean import (eval_hmean, get_gt_masks, output_ranklist) def _create_dummy_ann_infos(): ann_infos = { 'bboxes': np.array([[50., 70., 80., 1...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_metrics/test_hmean_iou.py
tests/test_metrics/test_hmean_iou.py
# Copyright (c) OpenMMLab. All rights reserved. """Test hmean_iou.""" import pytest import mmocr.core.evaluation.hmean_iou as hmean_iou def test_eval_hmean_iou(): pred_boxes = [] gt_boxes = [] gt_ignored_boxes = [] iou_thr = 0.5 precision_thr = 0.5 # test invalid arguments. with pytest...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_metrics/test_hmean_ic13.py
tests/test_metrics/test_hmean_ic13.py
# Copyright (c) OpenMMLab. All rights reserved. """Test hmean_ic13.""" import math import pytest import mmocr.core.evaluation.hmean_ic13 as hmean_ic13 import mmocr.core.evaluation.utils as utils def test_compute_recall_precision(): gt_polys = [] det_polys = [] # test invalid arguments. with pytest...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_models/test_textdet_neck.py
tests/test_models/test_textdet_neck.py
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmocr.models.textdet.necks import FPNC, FPN_UNet def test_fpnc(): in_channels = [64, 128, 256, 512] size = [112, 56, 28, 14] asf_cfgs = [ None, dict(attention_type='ScaleChannelSpatial'), ] for flag i...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_models/test_ocr_encoder.py
tests/test_models/test_ocr_encoder.py
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmocr.models.textrecog.encoders import (ABIVisionModel, BaseEncoder, NRTREncoder, SAREncoder, SatrnEncoder, TransformerEncoder) def test_sar_encode...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_models/test_ocr_decoder.py
tests/test_models/test_ocr_decoder.py
# Copyright (c) OpenMMLab. All rights reserved. import math import pytest import torch from mmocr.models.textrecog.decoders import (ABILanguageDecoder, ABIVisionDecoder, BaseDecoder, MasterDecoder, NRTRDecoder, ...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_models/test_ocr_preprocessor.py
tests/test_models/test_ocr_preprocessor.py
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmocr.models.textrecog.preprocessor import (BasePreprocessor, TPSPreprocessor) def test_tps_preprocessor(): with pytest.raises(AssertionError): TPSPreprocessor(num_fiducial=-1)...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_models/test_loss.py
tests/test_models/test_loss.py
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch from mmdet.core import BitmapMasks import mmocr.models.textdet.losses as losses def test_panloss(): panloss = losses.PANLoss() # test bitmasks2tensor mask = [[1, 0, 1], [1, 1, 1], [0, 0, 1]] target = [[1, 0, 1, 0, 0], [1...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_models/test_ocr_head.py
tests/test_models/test_ocr_head.py
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmocr.models.textrecog import SegHead def test_seg_head(): with pytest.raises(AssertionError): SegHead(num_classes='100') with pytest.raises(AssertionError): SegHead(num_classes=-1) seg_head = SegHead(num_cla...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_models/test_recog_config.py
tests/test_models/test_recog_config.py
# Copyright (c) OpenMMLab. All rights reserved. import copy from os.path import dirname, exists, join import numpy as np import pytest import torch def _demo_mm_inputs(num_kernels=0, input_shape=(1, 3, 300, 300), num_items=None): # yapf: disable """Create a superset of inputs needed to run t...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_models/test_ocr_fuser.py
tests/test_models/test_ocr_fuser.py
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmocr.models.textrecog.fusers import ABIFuser def test_base_alignment(): model = ABIFuser(d_model=512, num_chars=90, max_seq_len=40) l_feat = torch.randn(1, 40, 512) v_feat = torch.randn(1, 40, 512) result = model(l_feat, v_feat) a...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false
xdxie/WordArt
https://github.com/xdxie/WordArt/blob/89bf8a218881b250d0ead7a0287526c69586c92a/tests/test_models/test_modules.py
tests/test_models/test_modules.py
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch from mmocr.models.textdet.modules import GCN, LocalGraphs, ProposalLocalGraphs from mmocr.models.textdet.modules.utils import (feature_embedding, normalize_adjacent_matrix) def test_local_g...
python
Apache-2.0
89bf8a218881b250d0ead7a0287526c69586c92a
2026-01-05T07:11:30.009719Z
false