| 11 | }; |
| 12 | |
| 13 | int main(int argc, char** argv) { |
| 14 | if (argc < 4) { |
| 15 | fprintf(stderr, "Usage: %s <ref_dir> <prephase_ref_dir> <model_path>\n", argv[0]); |
| 16 | return 1; |
| 17 | } |
| 18 | |
| 19 | const std::string ref_dir = argv[1]; |
| 20 | const std::string prephase_ref_dir = argv[2]; |
| 21 | const std::string model_path = argv[3]; |
| 22 | const std::string cpp_root = ref_dir + "/cpp_out_geom"; |
| 23 | |
| 24 | // Test cases matching the Python dump script |
| 25 | std::vector<geom_case> cases; |
| 26 | |
| 27 | // Case 1: dummy prompt (no exemplars, just CLS) |
| 28 | { |
| 29 | geom_case c; |
| 30 | c.id = "dummy_prompt"; |
| 31 | // No exemplars |
| 32 | cases.push_back(std::move(c)); |
| 33 | } |
| 34 | |
| 35 | // Case 2: single positive box (cx=0.5, cy=0.5, w=0.3, h=0.3) |
| 36 | // API uses XYXY format — convert from CxCyWH to XYXY |
| 37 | { |
| 38 | geom_case c; |
| 39 | c.id = "single_box"; |
| 40 | float cx = 0.5f, cy = 0.5f, w = 0.3f, h = 0.3f; |
| 41 | sam3_box box; |
| 42 | box.x0 = cx - w * 0.5f; // 0.35 |
| 43 | box.y0 = cy - h * 0.5f; // 0.35 |
| 44 | box.x1 = cx + w * 0.5f; // 0.65 |
| 45 | box.y1 = cy + h * 0.5f; // 0.65 |
| 46 | c.params.pos_exemplars.push_back(box); |
| 47 | cases.push_back(std::move(c)); |
| 48 | } |
| 49 | |
| 50 | // Case 3: two boxes (one positive, one negative) |
| 51 | // Box1: cx=0.3, cy=0.4, w=0.2, h=0.25 (positive) |
| 52 | // Box2: cx=0.7, cy=0.6, w=0.15, h=0.2 (negative) |
| 53 | { |
| 54 | geom_case c; |
| 55 | c.id = "two_boxes"; |
| 56 | { |
| 57 | float cx = 0.3f, cy = 0.4f, w = 0.2f, h = 0.25f; |
| 58 | sam3_box box = {cx - w * 0.5f, cy - h * 0.5f, cx + w * 0.5f, cy + h * 0.5f}; |
| 59 | c.params.pos_exemplars.push_back(box); |
| 60 | } |
| 61 | { |
| 62 | float cx = 0.7f, cy = 0.6f, w = 0.15f, h = 0.2f; |
| 63 | sam3_box box = {cx - w * 0.5f, cy - h * 0.5f, cx + w * 0.5f, cy + h * 0.5f}; |
| 64 | c.params.neg_exemplars.push_back(box); |
| 65 | } |
| 66 | cases.push_back(std::move(c)); |
| 67 | } |
| 68 | |
| 69 | sam3_params mparams; |
| 70 | mparams.model_path = model_path; |
nothing calls this directly
no test coverage detected