Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite6bd1d1

Browse files
Improve the performance of get_detcost() function.
More information --https://docs.google.com/spreadsheets/d/17fL_NVWe7XjwGmdBIts75YFuzUmokUyfd_YMEU9ISXY/edit?gid=0#gid=0
1 parentad65b82 commite6bd1d1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎src/tesseract.cc‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include<algorithm>
1818
#include<boost/functional/hash.hpp>// For boost::hash_range
1919
#include<cassert>
20+
#include<cstdint>
2021
#include<functional>// For std::hash (though not strictly necessary here, but good practice)
2122
#include<iostream>
2223

@@ -85,24 +86,26 @@ bool Node::operator>(const Node& other) const {
8586
doubleTesseractDecoder::get_detcost(
8687
size_t d,const std::vector<DetectorCostTuple>& detector_cost_tuples)const {
8788
double min_cost = INF;
89+
uint32_t min_det_cost = std::numeric_limits<uint32_t>::infinity();
8890
double error_cost;
8991
ErrorCost ec;
9092
DetectorCostTuple dct;
9193

9294
for (int ei : d2e[d]) {
9395
ec = error_costs[ei];
94-
if (ec.min_cost>= min_cost)break;
96+
if (ec.likelihood_cost * min_det_cost>= min_cost * errors[ei].symptom.detectors.size())break;
9597

9698
dct = detector_cost_tuples[ei];
9799
if (!dct.error_blocked) {
98-
error_cost = ec.likelihood_cost / dct.detectors_count;
99-
if (error_cost < min_cost) {
100+
error_cost = ec.likelihood_cost;
101+
if (ec.likelihood_cost < min_cost * dct.detectors_count) {
100102
min_cost = error_cost;
103+
min_det_cost = dct.detectors_count;
101104
}
102105
}
103106
}
104107

105-
return min_cost + config.det_penalty;
108+
return(min_cost / min_det_cost) + config.det_penalty;
106109
}
107110

108111
TesseractDecoder::TesseractDecoder(TesseractConfig config_) : config(config_) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp