修正 mini_npz 深度数据职责
This commit is contained in:
@@ -157,40 +157,6 @@ class WorkerTest(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(args.remove_background_model_dir, "ben2")
|
||||
|
||||
def test_ai_depth_is_converted_for_positive_displacement(self):
|
||||
prediction = SimpleNamespace(
|
||||
depth=np.array([[[0.25, 1.0], [1.5, 2.0]]]),
|
||||
conf=np.array([[[0.1, 0.2], [0.3, 0.4]]]),
|
||||
)
|
||||
|
||||
self.worker.convert_ai_depth_for_displacement(prediction)
|
||||
|
||||
np.testing.assert_array_equal(
|
||||
prediction.depth,
|
||||
[[[0.75, 0.0], [-0.5, -1.0]]],
|
||||
)
|
||||
np.testing.assert_array_equal(
|
||||
prediction.conf,
|
||||
[[[0.1, 0.2], [0.3, 0.4]]],
|
||||
)
|
||||
|
||||
def test_npz_reference_depth_preserves_prediction_arrays(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
npz_path = Path(directory) / "results.npz"
|
||||
depth = np.array([[[1.0, 2.0]]], dtype=np.float32)
|
||||
confidence = np.array([[[0.2, 0.8]]], dtype=np.float32)
|
||||
np.savez_compressed(npz_path, depth=depth, conf=confidence)
|
||||
|
||||
self.worker.write_npz_reference_depth(npz_path, 1.5)
|
||||
|
||||
with np.load(npz_path, allow_pickle=False) as archive:
|
||||
np.testing.assert_array_equal(archive["depth"], depth)
|
||||
np.testing.assert_array_equal(archive["conf"], confidence)
|
||||
self.assertEqual(
|
||||
float(archive[self.worker.REFERENCE_DEPTH_KEY]),
|
||||
1.5,
|
||||
)
|
||||
|
||||
def test_prepares_a_single_image_file(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
image_path = Path(directory) / "input.png"
|
||||
@@ -1013,12 +979,9 @@ class WorkerTest(unittest.TestCase):
|
||||
_export_dir,
|
||||
options,
|
||||
) in export_calls:
|
||||
expected_depth = (
|
||||
-1.0 if export_format == "mini_npz" else 2.0
|
||||
)
|
||||
np.testing.assert_array_equal(
|
||||
_prediction.depth,
|
||||
np.full((1, 2, 2), expected_depth, dtype=np.float32),
|
||||
np.full((1, 2, 2), 2.0, dtype=np.float32),
|
||||
)
|
||||
if export_format == "glb":
|
||||
self.assertEqual(
|
||||
|
||||
Reference in New Issue
Block a user