chore: Bump version to 0.12.13 and update documentation for color space handling
This commit is contained in:
@@ -42,6 +42,52 @@ class ImageDepthTest(unittest.TestCase):
|
||||
def setUpClass(cls):
|
||||
cls.image_depth = load_image_depth()
|
||||
|
||||
def test_material_color_space_matches_scene_view_transform(self):
|
||||
mappings = {
|
||||
"ACES 1.3": "ACES 1.3 sRGB",
|
||||
"ACES 2.0": "ACES 2.0 sRGB",
|
||||
"AgX": "AgX Base sRGB",
|
||||
"Filmic": "Filmic sRGB",
|
||||
"Khronos PBR Neutral": "Khronos PBR Neutral sRGB",
|
||||
"Standard": "AgX Base sRGB",
|
||||
}
|
||||
for view_transform, expected in mappings.items():
|
||||
with self.subTest(view_transform=view_transform):
|
||||
scene = SimpleNamespace(
|
||||
view_settings=SimpleNamespace(
|
||||
view_transform=view_transform,
|
||||
)
|
||||
)
|
||||
self.assertEqual(
|
||||
self.image_depth.material_color_space_name(scene),
|
||||
expected,
|
||||
)
|
||||
|
||||
def test_material_color_space_falls_back_when_unsupported(self):
|
||||
class ColorSpaceSettings:
|
||||
def __init__(self):
|
||||
self._name = "sRGB"
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, value):
|
||||
if value != "sRGB":
|
||||
raise TypeError("unsupported color space")
|
||||
self._name = value
|
||||
|
||||
image = SimpleNamespace(colorspace_settings=ColorSpaceSettings())
|
||||
scene = SimpleNamespace(
|
||||
view_settings=SimpleNamespace(view_transform="ACES 2.0")
|
||||
)
|
||||
|
||||
result = self.image_depth.set_material_color_space(image, scene)
|
||||
|
||||
self.assertEqual(result, "sRGB")
|
||||
self.assertEqual(image.colorspace_settings.name, "sRGB")
|
||||
|
||||
def test_extracts_depth_and_uses_first_view(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
npz_path = Path(directory) / "results.npz"
|
||||
|
||||
@@ -76,6 +76,34 @@ class MogeOnnxTest(unittest.TestCase):
|
||||
["DmlExecutionProvider", "CPUExecutionProvider"],
|
||||
)
|
||||
|
||||
def test_coreml_session_uses_mlprogram(self):
|
||||
calls = []
|
||||
fake_runtime = ModuleType("onnxruntime")
|
||||
fake_runtime.get_available_providers = lambda: [
|
||||
"CoreMLExecutionProvider",
|
||||
"CPUExecutionProvider",
|
||||
]
|
||||
fake_runtime.InferenceSession = lambda path, providers: calls.append(
|
||||
(path, providers)
|
||||
)
|
||||
|
||||
with patch.dict(sys.modules, {"onnxruntime": fake_runtime}):
|
||||
self.moge.create_runtime_session("model.onnx")
|
||||
|
||||
self.assertEqual(calls[0][0], "model.onnx")
|
||||
self.assertEqual(
|
||||
calls[0][1][0],
|
||||
(
|
||||
"CoreMLExecutionProvider",
|
||||
{
|
||||
"ModelFormat": "MLProgram",
|
||||
"MLComputeUnits": "ALL",
|
||||
"RequireStaticInputShapes": "0",
|
||||
"EnableOnSubgraphs": "0",
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
def test_explicit_unavailable_provider_falls_back_to_cpu(self):
|
||||
providers = self.moge.select_providers(
|
||||
"cuda",
|
||||
|
||||
@@ -118,6 +118,7 @@ class WorkerTest(unittest.TestCase):
|
||||
cls.surface_outputs = load_server_module("outputs.surface")
|
||||
cls.debug_da3_outputs = load_server_module("outputs.debug_da3")
|
||||
cls.debug_moge2_outputs = load_server_module("outputs.debug_moge2")
|
||||
cls.common_job = load_server_module("jobs.common")
|
||||
cls.depth_job = load_server_module("jobs.depth")
|
||||
cls.surface_job = load_server_module("jobs.surface")
|
||||
cls.debug_da3_job = load_server_module("jobs.debug_da3")
|
||||
@@ -127,20 +128,39 @@ class WorkerTest(unittest.TestCase):
|
||||
cls.foreground_job = load_server_module("jobs.foreground")
|
||||
cls.download = load_server_module("model_download")
|
||||
|
||||
def test_surface_inference_progress_omits_single_frame_count(self):
|
||||
def test_inference_progress_omits_single_frame_count(self):
|
||||
self.assertEqual(
|
||||
self.surface_job.inference_progress_message("MoGe-2", 0, 1),
|
||||
self.common_job.frame_progress_message(
|
||||
"Estimating MoGe-2 geometry", 0, 1
|
||||
),
|
||||
"Estimating MoGe-2 geometry",
|
||||
)
|
||||
self.assertEqual(
|
||||
self.surface_job.inference_progress_message("DA3", 0, 1),
|
||||
self.common_job.frame_progress_message(
|
||||
"Estimating DA3 geometry", 0, 1
|
||||
),
|
||||
"Estimating DA3 geometry",
|
||||
)
|
||||
self.assertEqual(
|
||||
self.surface_job.inference_progress_message("DA3", 1, 3),
|
||||
self.common_job.frame_progress_message(
|
||||
"Estimating DA3 geometry", 1, 3
|
||||
),
|
||||
"Estimating DA3 geometry (2/3)",
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
self.common_job.frame_progress_message(
|
||||
"Estimating MoGe-2 depth", 0, 1
|
||||
),
|
||||
"Estimating MoGe-2 depth",
|
||||
)
|
||||
self.assertEqual(
|
||||
self.common_job.frame_progress_message(
|
||||
"Estimating DA3 depth", 0, 1
|
||||
),
|
||||
"Estimating DA3 depth",
|
||||
)
|
||||
|
||||
def test_surface_has_one_model_independent_builder(self):
|
||||
self.assertTrue(callable(self.surface.build_surface))
|
||||
self.assertTrue(callable(self.surface_outputs.write_surface_archive))
|
||||
|
||||
Reference in New Issue
Block a user