Commit 561471b
Generalize the constraint for score_calibration in ImageClassifier
Major changes:
(1) Use the default_score value from Metadata instead of always falling back to `kDefaultCalibratedScore` (-1), which was defined in ImageClassifier.
(2) Removed the check for kMinCalibratedScore and kMaxCalibratedScore. First, it doesn't make sense to restrict the calibrated score to [0, 1]. The calibrated score is bounded by [0, scale]. Second, ComputeCalibratedScore returns either the default_score or the calibrated score derived from the sigmoid function. Therefore, it's redundant to check the value range once more in ImageClassifier.
PiperOrigin-RevId: 3988504361 parent f3e1530 commit 561471b
File tree
2 files changed
+34
-44
lines changed- tensorflow_lite_support/cc/task/vision
- utils
2 files changed
+34
-44
lines changedLines changed: 12 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | 49 | | |
70 | 50 | | |
71 | 51 | | |
| |||
378 | 358 | | |
379 | 359 | | |
380 | 360 | | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | 361 | | |
388 | 362 | | |
389 | 363 | | |
| |||
453 | 427 | | |
454 | 428 | | |
455 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
456 | 442 | | |
457 | 443 | | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | 444 | | |
474 | 445 | | |
475 | 446 | | |
| |||
Lines changed: 22 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
98 | 110 | | |
99 | 111 | | |
100 | 112 | | |
| |||
160 | 172 | | |
161 | 173 | | |
162 | 174 | | |
| 175 | + | |
163 | 176 | | |
164 | | - | |
165 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
166 | 180 | | |
167 | 181 | | |
168 | | - | |
| 182 | + | |
169 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
170 | 189 | | |
171 | 190 | | |
172 | 191 | | |
| |||
0 commit comments