Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to GenJAX 0.5.0, fix unsupported escape sequences #76

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ classifiers = [
"Programming Language :: Python :: 3.12"
]
dependencies = [
"genjax==0.4.0",
"genjax==0.5.0",
"rerun-sdk==0.16.1",
"tqdm==4.66.2",
"numpy==1.26.4",
Expand Down Expand Up @@ -53,9 +53,6 @@ dependencies = [
b3d_pull = "b3d.bucket_utils.b3d_pull:download_from_bucket"
b3d_push = "b3d.bucket_utils.b3d_push:upload_to_bucket"

# [tool.setuptools]
# package-dir = {"" = "src"}

[tool.setuptools.package-data]
"b3d" = [
"nvdiffrast/common/*.h",
Expand All @@ -77,8 +74,8 @@ b3d_push = "b3d.bucket_utils.b3d_push:upload_to_bucket"
"nvdiffrast/jax/*.cpp",
]

[tool.setuptools_scm]
write_to = "b3d/_version.py"

[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.pyright]
typeCheckingMode = "standard"
6 changes: 3 additions & 3 deletions src/b3d/chisight/sparse/gps_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ def gaussian_restriction_to_ray(
the mean `mu` and standard deviation `sig`, such that,
parameterizing they ray by $r(t) = o +t*v$, we have
$$
N( r(t) | \tilde\mu, cov) = w * N(t | \mu, \sigma)
N( r(t) | \\tilde\\mu, cov) = w * N(t | \\mu, \\sigma)
$$
where
$$
w = N( r(\mu) | \tilde\mu, cov) / N(\mu, \mu, \sigma).
w = N( r(\\mu) | \\tilde\\mu, cov) / N(\\mu, \\mu, \\sigma).
$$
Note that $\mu$ is the maximum of both the nominator and denominator.
Note that $\\mu$ is the maximum of both the nominator and denominator.
Also note that the first equation implies that the integral of
the Gaussian along the ray is given by $w$.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/b3d/io/video_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class VideoInput:
x-axis pointing to the right, and y-axis pointing down. This is the OpenCV convention.
Quaternions. We follow scipy.spatial.transform.Rotation.from_quat which uses scalar-last (x, y, z, w)
Camera Intrinsics. We store it as an array of shape (8,) containing width, height, fx, fy, cx, cy, near, far.
The camera matrix is given by: $$ K = \begin{bmatrix} f_x & 0 & c_x \ 0 & f_y & c_y \ 0 & 0 & 1 \end{bmatrix} $$
The camera matrix is given by: $$ K = \\begin{bmatrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \\end{bmatrix} $$
Spatial units. Spatial units are measured in meters (if not indicated otherwise).

**Attributes:**
Expand Down
4 changes: 2 additions & 2 deletions src/b3d/pose/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def choose_good_quat(q):
so we'll iteratively resolve that as well.

Recall that SO(3) is isomorphic to S^3/x~-x and
also to D^3/~ where x~-x for x in S^2 = \partial D^3.
also to D^3/~ where x~-x for x in S^2 = \\partial D^3.
"""
return jnp.where(
q[..., [3]] != 0,
Expand Down Expand Up @@ -180,7 +180,7 @@ def canonical(self):
chooses from {q, -q} s.t. q[3] >= 0. Note that if q[3]==0 there is still ambiguity.

Recall that SO(3) is isomorphic to S^3/x~-x and
also to D^3/~ where x~-x for x in S^2 = \partial D^3.
also to D^3/~ where x~-x for x in S^2 = \\partial D^3.
"""
quat = self.quat / jnp.linalg.norm(self.quat, axis=-1, keepdims=True)
return Pose(self.pos, choose_good_quat(quat))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def choose_good_quat(q):
which represents the same rotation.

Recall that SO(3) is isomorphic to S^3/x~-x and
also to D^3/~ where x~-x for x in S^2 = \partial D^3.
also to D^3/~ where x~-x for x in S^2 = \\partial D^3.
"""
# TODO: choose good representative if q[3]==0 there is still ambiguity.
return jnp.where(q[..., [3]] == 0, q, jnp.sign(q[..., [3]]) * q)
Expand Down