MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / mask_iou

Function mask_iou

tests/test_visual_only_compare.cpp:17–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#include <vector>
16
17static float mask_iou(const sam3_mask& a, const sam3_mask& b) {
18 if (a.width != b.width || a.height != b.height) return 0.0f;
19 int inter = 0, uni = 0;
20 for (int i = 0; i < (int)a.data.size(); ++i) {
21 bool fa = a.data[i] > 127;
22 bool fb = b.data[i] > 127;
23 if (fa && fb) inter++;
24 if (fa || fb) uni++;
25 }
26 return uni > 0 ? (float)inter / uni : 1.0f;
27}
28
29static int count_fg(const sam3_mask& m) {
30 int n = 0;

Callers 1

compare_resultsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected