(untested test) fixing some test errors
Browse files
tests/1_00186_from_ttpla_dataset.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tests/test_ttpla_to_masks.py
CHANGED
@@ -9,12 +9,16 @@ from wireseghr.data.ttpla_to_masks import convert_ttpla_jsons_to_masks
|
|
9 |
def _read_dims(json_path: Path):
|
10 |
with open(json_path, "r") as f:
|
11 |
data = json.load(f)
|
12 |
-
return
|
|
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
def test_convert_single_json_cable_only(tmp_path: Path):
|
16 |
# Use the provided example JSON at repo root
|
17 |
-
src_json = Path("/workspace/wire-seg-hr-impl/
|
18 |
assert src_json.exists()
|
19 |
|
20 |
H, W, stem = _read_dims(src_json)
|
@@ -41,14 +45,16 @@ def test_convert_single_json_cable_only(tmp_path: Path):
|
|
41 |
|
42 |
|
43 |
def test_convert_different_labels(tmp_path: Path):
|
44 |
-
src_json = Path("/workspace/wire-seg-hr-impl/
|
45 |
assert src_json.exists()
|
46 |
|
47 |
out_dir_cable = tmp_path / "masks_cable"
|
48 |
out_dir_tower = tmp_path / "masks_tower"
|
49 |
|
50 |
written_cable = convert_ttpla_jsons_to_masks(src_json, out_dir_cable, label="cable")
|
51 |
-
written_tower = convert_ttpla_jsons_to_masks(
|
|
|
|
|
52 |
|
53 |
mc = np.array(Image.open(written_cable[0]).convert("L"))
|
54 |
mt = np.array(Image.open(written_tower[0]).convert("L"))
|
|
|
9 |
def _read_dims(json_path: Path):
|
10 |
with open(json_path, "r") as f:
|
11 |
data = json.load(f)
|
12 |
+
return (
|
13 |
+
int(data["imageHeight"]),
|
14 |
+
int(data["imageWidth"]),
|
15 |
+
Path(data["imagePath"]).stem,
|
16 |
+
)
|
17 |
|
18 |
|
19 |
def test_convert_single_json_cable_only(tmp_path: Path):
|
20 |
# Use the provided example JSON at repo root
|
21 |
+
src_json = Path("/workspace/wire-seg-hr-impl/tests/1_00186_from_ttpla_dataset.json")
|
22 |
assert src_json.exists()
|
23 |
|
24 |
H, W, stem = _read_dims(src_json)
|
|
|
45 |
|
46 |
|
47 |
def test_convert_different_labels(tmp_path: Path):
|
48 |
+
src_json = Path("/workspace/wire-seg-hr-impl/tests/1_00186_from_ttpla_dataset.json")
|
49 |
assert src_json.exists()
|
50 |
|
51 |
out_dir_cable = tmp_path / "masks_cable"
|
52 |
out_dir_tower = tmp_path / "masks_tower"
|
53 |
|
54 |
written_cable = convert_ttpla_jsons_to_masks(src_json, out_dir_cable, label="cable")
|
55 |
+
written_tower = convert_ttpla_jsons_to_masks(
|
56 |
+
src_json, out_dir_tower, label="tower_wooden"
|
57 |
+
)
|
58 |
|
59 |
mc = np.array(Image.open(written_cable[0]).convert("L"))
|
60 |
mt = np.array(Image.open(written_tower[0]).convert("L"))
|