Tool of computing the metric of text detection
Project description
Text Detect Metric
Evaluate on the custom dataset.
- Here we use the evaluation code of
ch_mobile_v2_det
on the text detection test set liekkas/text_det_test_dataset, and you can use the same analogy.
1. Install packages.
pip install modelscope==1.5.2
pip install text_det_metric
2. Run
- Run
get_pred_txt.py
to getpred.txt
import cv2 from modelscope.msdatasets import MsDataset from ch_mobile_v2_det import TextDetector test_data = MsDataset.load( "text_det_test_dataset", namespace="liekkas", subset_name="default", split="test", ) text_detector = TextDetector() content = [] for one_data in test_data: img_path = one_data.get("image:FILE") print(img_path) img = cv2.imread(str(img_path)) dt_boxes, scores, _ = text_detector(img) content.append(f"{img_path}\t{dt_boxes.tolist()}\t{scores}") with open("pred.txt", "w", encoding="utf-8") as f: for v in content: f.write(f"{v}\n")
- Run
compute_metric.py
to get the metrics on the datasetfrom text_det_metric import DetectionIoUEvaluator metric = DetectionIoUEvaluator() # pred_path pred_path = "1.txt" mertric = metric(pred_path) print(mertric)
See details for TextDetMetric.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for text_det_metric-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f06548beabd42cf4ad3b0ce63e5bb8b120065b8c2322f7ba3a2a7acb4b95c94 |
|
MD5 | ecd3dff9dcd91fee247e646a63978f3e |
|
BLAKE2b-256 | bc60e0ee69184dd6495262840466d6278cbb66e2fc76c015388d0693f3a23e3e |