Skip to content

Commit 7eeb94d

Browse files
committed
解决使用np.arange函数可能会不包含stop值的bug
1 parent c82f93a commit 7eeb94d

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

docs/en/basic_concepts/evaluation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ In MMOCR, the calculation of `HmeanIOUMetric` can be summarized as the following
6060
It is worth noting that `pred_score_thrs` will **automatically search** for the **best threshold** within a certain range by default, and users can also customize the search range by manually modifying the configuration file:
6161

6262
```python
63-
# By default, HmeanIOUMetric searches the best threshold within the range [0.3, 1) with a step size of 0.1
64-
val_evaluator = dict(type='HmeanIOUMetric', pred_score_thrs=dict(start=0.3, stop=1, step=0.1))
63+
# By default, HmeanIOUMetric searches the best threshold within the range [0.3, 0.9] with a step size of 0.1
64+
val_evaluator = dict(type='HmeanIOUMetric', pred_score_thrs=dict(start=0.3, stop=0.9, step=0.1))
6565
```
6666

6767
2. Calculate the IoU matrix

docs/zh_cn/basic_concepts/evaluation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ F_1=(1+\beta^2)\cdot\frac{PR}{\beta^2\cdot P+R} = \frac{2PR}{P+R}
6060
值得注意的是,`pred_score_thrs` 默认将**自动搜索**一定范围内的**最佳阈值**,用户也可以通过手动修改配置文件来自定义搜索范围:
6161

6262
```python
63-
# HmeanIOUMetric 默认以 0.1 为步长搜索 [0.3, 1) 范围内的最佳得分阈值
64-
val_evaluator = dict(type='HmeanIOUMetric', pred_score_thrs=dict(start=0.3, stop=1, step=0.1))
63+
# HmeanIOUMetric 默认以 0.1 为步长搜索 [0.3, 0.9] 范围内的最佳得分阈值
64+
val_evaluator = dict(type='HmeanIOUMetric', pred_score_thrs=dict(start=0.3, stop=0.9, step=0.1))
6565
```
6666

6767
2. 计算 IoU 矩阵

mmocr/evaluation/metrics/hmean_iou_metric.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class HmeanIOUMetric(BaseMetric):
4444
ignore_precision_thr (float): Precision threshold when prediction and\
4545
gt ignored polygons are matched. Defaults to 0.5.
4646
pred_score_thrs (dict): Best prediction score threshold searching
47-
space. Defaults to dict(start=0.3, stop=1 step=0.1).
47+
space. Defaults to dict(start=0.3, stop=0.9 step=0.1).
4848
strategy (str): Polygon matching strategy. Options are 'max_matching'
4949
and 'vanilla'. 'max_matching' refers to the optimum strategy that
5050
maximizes the number of matches. Vanilla strategy matches gt and
@@ -63,7 +63,7 @@ class HmeanIOUMetric(BaseMetric):
6363
def __init__(self,
6464
match_iou_thr: float = 0.5,
6565
ignore_precision_thr: float = 0.5,
66-
pred_score_thrs: Dict = dict(start=0.3, stop=1, step=0.1),
66+
pred_score_thrs: Dict = dict(start=0.3, stop=0.9, step=0.1),
6767
strategy: str = 'vanilla',
6868
collect_device: str = 'cpu',
6969
prefix: Optional[str] = None) -> None:
@@ -75,8 +75,8 @@ def __init__(self,
7575
pred_score_thrs['stop'],
7676
int(
7777
np.round((pred_score_thrs['stop'] - pred_score_thrs['start']) /
78-
pred_score_thrs['step'])),
79-
endpoint=False)
78+
pred_score_thrs['step'])) + 1,
79+
endpoint=True)
8080
assert strategy in ['max_matching', 'vanilla']
8181
self.strategy = strategy
8282

projects/ABCNet/abcnet/metric/e2e_hmean_iou_metric.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class E2EHmeanIOUMetric(BaseMetric):
4545
ignore_precision_thr (float): Precision threshold when prediction and\
4646
gt ignored polygons are matched. Defaults to 0.5.
4747
pred_score_thrs (dict): Best prediction score threshold searching
48-
space. Defaults to dict(start=0.3, stop=1, step=0.1).
48+
space. Defaults to dict(start=0.3, stop=0.9, step=0.1).
4949
strategy (str): Polygon matching strategy. Options are 'max_matching'
5050
and 'vanilla'. 'max_matching' refers to the optimum strategy that
5151
maximizes the number of matches. Vanilla strategy matches gt and
@@ -64,7 +64,7 @@ class E2EHmeanIOUMetric(BaseMetric):
6464
def __init__(self,
6565
match_iou_thr: float = 0.5,
6666
ignore_precision_thr: float = 0.5,
67-
pred_score_thrs: Dict = dict(start=0.3, stop=1, step=0.1),
67+
pred_score_thrs: Dict = dict(start=0.3, stop=0.9, step=0.1),
6868
lexicon_path: Optional[str] = None,
6969
word_spotting: bool = False,
7070
min_length_case_word: int = 3,
@@ -80,8 +80,8 @@ def __init__(self,
8080
pred_score_thrs['stop'],
8181
int(
8282
np.round((pred_score_thrs['stop'] - pred_score_thrs['start']) /
83-
pred_score_thrs['step'])),
84-
endpoint=False)
83+
pred_score_thrs['step'])) + 1,
84+
endpoint=True)
8585
self.word_spotting = word_spotting
8686
self.min_length_case_word = min_length_case_word
8787
self.special_characters = special_characters

projects/SPTS/spts/metric/e2e_point_metric.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def __init__(self,
6363
text_score_thrs['stop'],
6464
int(
6565
np.round((text_score_thrs['stop'] - text_score_thrs['start']) /
66-
text_score_thrs['step'])),
67-
endpoint=False)
66+
text_score_thrs['step'])) + 1,
67+
endpoint=True)
6868
self.word_spotting = word_spotting
6969
self.match_dist_thr = match_dist_thr
7070
if lexicon_path:

0 commit comments

Comments
 (0)