Repository navigation
Expand file tree
/
Copy pathrerankSift.test.ts
More file actions
59 lines (51 loc) · 1.53 KB
/
Copy pathrerankSift.test.ts
File metadata and controls
59 lines (51 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { execFileSync } from "node:child_process";
import { mkdtempSync, readFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
describe("rerank_sift.py", () => {
it("샘플 query와 gallery를 SIFT/RANSAC 점수로 재정렬한다", () => {
const dir = mkdtempSync(join(tmpdir(), "path-finder-sift-"));
const output = join(dir, "sift.json");
execFileSync("uv", [
"run",
"--with",
"numpy",
"--with",
"opencv-python-headless",
"python",
"scripts/rerank_sift.py",
"--output",
output,
"--top-k",
"3",
]);
const report = JSON.parse(readFileSync(output, "utf8"));
expect(report.method).toBe("SIFT_RANSAC");
expect(report.topK).toHaveLength(3);
expect(report.topK[0].score).toBeGreaterThan(0);
}, 20000);
it("상대 경로 query와 gallery를 받아도 리포트를 생성한다", () => {
const dir = mkdtempSync(join(tmpdir(), "path-finder-sift-relative-"));
const output = join(dir, "sift.json");
execFileSync("uv", [
"run",
"--with",
"numpy",
"--with",
"opencv-python-headless",
"python",
"scripts/rerank_sift.py",
"--query",
"public/samples/query-starfield-north.jpg",
"--gallery",
"public/gallery",
"--output",
output,
"--top-k",
"1",
]);
const report = JSON.parse(readFileSync(output, "utf8"));
expect(report.topK).toHaveLength(1);
}, 20000);
});