Calibrated probabilities (temperature 0.74)
Browse files- app.js +2 -1
- model-info.js +4 -3
app.js
CHANGED
|
@@ -176,7 +176,8 @@ async function classify(blob, id = ++latest) {
|
|
| 176 |
if (id !== latest) return;
|
| 177 |
const f = MODEL.familiarity;
|
| 178 |
const score = mahalanobis(bank, f.classes, f.dims, output.features.data);
|
| 179 |
-
|
|
|
|
| 180 |
} catch (err) {
|
| 181 |
if (id !== latest) return;
|
| 182 |
preview.hidden = true;
|
|
|
|
| 176 |
if (id !== latest) return;
|
| 177 |
const f = MODEL.familiarity;
|
| 178 |
const score = mahalanobis(bank, f.classes, f.dims, output.features.data);
|
| 179 |
+
// Calibrated on validation photos (calibrate.py): the label is unchanged.
|
| 180 |
+
showResult(softmax(Array.from(output.logits.data, (v) => v / MODEL.temperature)), score);
|
| 181 |
} catch (err) {
|
| 182 |
if (id !== latest) return;
|
| 183 |
preview.hidden = true;
|
model-info.js
CHANGED
|
@@ -11,6 +11,7 @@ export const MODEL = {
|
|
| 11 |
"trash"
|
| 12 |
],
|
| 13 |
"sha256": "536ae512fd303bc4710c4e52e66edca463f832f2d3068e64f34271f3e30bebf7",
|
|
|
|
| 14 |
"familiarity": {
|
| 15 |
"method": "mahalanobis",
|
| 16 |
"file": "familiarity.bin",
|
|
@@ -20,9 +21,9 @@ export const MODEL = {
|
|
| 20 |
"threshold": -5855.972243745473
|
| 21 |
},
|
| 22 |
"lowConfidence": {
|
| 23 |
-
"threshold": 0.
|
| 24 |
-
"accuracyBelow": 0.
|
| 25 |
-
"accuracyAbove": 0.
|
| 26 |
}
|
| 27 |
};
|
| 28 |
export const WASM = {
|
|
|
|
| 11 |
"trash"
|
| 12 |
],
|
| 13 |
"sha256": "536ae512fd303bc4710c4e52e66edca463f832f2d3068e64f34271f3e30bebf7",
|
| 14 |
+
"temperature": 0.7424868605879112,
|
| 15 |
"familiarity": {
|
| 16 |
"method": "mahalanobis",
|
| 17 |
"file": "familiarity.bin",
|
|
|
|
| 21 |
"threshold": -5855.972243745473
|
| 22 |
},
|
| 23 |
"lowConfidence": {
|
| 24 |
+
"threshold": 0.97,
|
| 25 |
+
"accuracyBelow": 0.8436482084690554,
|
| 26 |
+
"accuracyAbove": 0.991130820399113
|
| 27 |
}
|
| 28 |
};
|
| 29 |
export const WASM = {
|