From 032eb684ec4c192f0fc1d35249a5fc76ca02e319 Mon Sep 17 00:00:00 2001 From: crosstyan Date: Mon, 21 Apr 2025 18:38:08 +0800 Subject: [PATCH] feat: Enhance play notebook and camera module with new projection and distortion functionalities - Updated play notebook to include new tracking and clustering functionalities. - Introduced `distortion` and `project` functions for applying distortion to 2D points and projecting 3D points to 2D, respectively. - Enhanced `CameraParams` and `Camera` classes with methods for distortion and projection, improving usability. - Cleaned up execution counts in the notebook for better organization. --- app/camera/__init__.py | 155 ++++++++++++++++- play.ipynb | 385 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 504 insertions(+), 36 deletions(-) diff --git a/app/camera/__init__.py b/app/camera/__init__.py index 91bbf35..a2a66e3 100644 --- a/app/camera/__init__.py +++ b/app/camera/__init__.py @@ -1,7 +1,7 @@ from collections import OrderedDict, defaultdict from dataclasses import dataclass from datetime import datetime -from typing import Any, TypeAlias, TypedDict +from typing import Any, TypeAlias, TypedDict, Optional from beartype import beartype from jax import Array @@ -12,6 +12,95 @@ from typing_extensions import NotRequired CameraID: TypeAlias = str # pylint: disable=invalid-name +@jaxtyped(typechecker=beartype) +def distortion( + points_2d: Num[Array, "N 2"], + K: Num[Array, "3 3"], + dist_coeffs: Num[Array, "5"], +) -> Num[Array, "N 2"]: + """ + Apply distortion to 2D points + + Args: + points_2d: 2D points in image coordinates + K: Camera intrinsic matrix + dist_coeffs: Distortion coefficients [k1, k2, p1, p2, k3] + + Returns: + Distorted 2D points + """ + k1, k2, p1, p2, k3 = dist_coeffs + + # Get principal point and focal length + cx, cy = K[0, 2], K[1, 2] + fx, fy = K[0, 0], K[1, 1] + + # Convert to normalized coordinates + x = (points_2d[:, 0] - cx) / fx + y = (points_2d[:, 1] - cy) / fy + r2 = x * x + y * y + + # Radial distortion + xdistort = x * (1 + k1 * r2 + k2 * r2 * r2 + k3 * r2 * r2 * r2) + ydistort = y * (1 + k1 * r2 + k2 * r2 * r2 + k3 * r2 * r2 * r2) + + # Tangential distortion + xdistort = xdistort + 2 * p1 * x * y + p2 * (r2 + 2 * x * x) + ydistort = ydistort + p1 * (r2 + 2 * y * y) + 2 * p2 * x * y + + # Back to absolute coordinates + xdistort = xdistort * fx + cx + ydistort = ydistort * fy + cy + + # Combine distorted coordinates + return jnp.stack([xdistort, ydistort], axis=1) + + +@jaxtyped(typechecker=beartype) +def project( + points_3d: Num[Array, "N 3"], + projection_matrix: Num[Array, "3 4"], + K: Num[Array, "3 3"], + dist_coeffs: Num[Array, "5"], +) -> Num[Array, "N 2"]: + """ + Project 3D points to 2D points + + Args: + points_3d: 3D points in world coordinates + projection_matrix: pre-computed projection matrix (K @ Rt[:3, :]) + K: Camera intrinsic matrix + dist_coeffs: Distortion coefficients + + Returns: + 2D points in image coordinates + """ + P = projection_matrix + p3d_homogeneous = jnp.hstack( + (points_3d, jnp.ones((points_3d.shape[0], 1), dtype=points_3d.dtype)) + ) + + # Project points + p2d_homogeneous = p3d_homogeneous @ P.T + + # Perspective division + p2d = p2d_homogeneous[:, 0:2] / p2d_homogeneous[:, 2:3] + + # Apply distortion if needed + if dist_coeffs is not None: + # Check if valid points (between 0 and 1) + valid = jnp.all(p2d > 0, axis=1) & jnp.all(p2d < 1, axis=1) + + # Only apply distortion if there are valid points + if jnp.any(valid): + # Only distort valid points + valid_p2d = p2d[valid] + distorted_valid = distortion(valid_p2d, K, dist_coeffs) + p2d = p2d.at[valid].set(distorted_valid) + + return jnp.squeeze(p2d) + + @jaxtyped(typechecker=beartype) @dataclass(frozen=True) class CameraParams: @@ -29,8 +118,18 @@ class CameraParams: R and t are the rotation and translation that describe the change of coordinates from world to camera coordinate systems (or camera frame) + + Rt is expected to be World-to-Camera (W2C) transformation matrix, + which is the result of `solvePnP` in OpenCV. (but converted to homogeneous coordinates) + + + World-to-Camera (W2C): Transforms points from world coordinates to camera coordinates + + - The world origin is transformed to camera space + - Used for projecting 3D world points onto the camera's image plane + - Required for rendering/projection """ - dist_coeffs: Num[Array, "N"] + dist_coeffs: Num[Array, "5"] """ An array of distortion coefficients of the form [k1, k2, [p1, p2, [k3]]], where ki is the ith @@ -42,6 +141,25 @@ class CameraParams: The size of image plane (width, height) """ + @property + def pose_matrix(self) -> Num[Array, "4 4"]: + """ + The inversion of the extrinsic matrix, which gives Camera-to-World (C2W) transformation matrix. + + Camera-to-World (C2W): Transforms points from camera coordinates to world coordinates + + - The camera is the origin in camera space + - This transformation tells where the camera is positioned in world space + - Often used for camera positioning/orientation + + The result is cached on first access. (lazy evaluation) + """ + t = getattr(self, "_pose", None) + if t is None: + t = jnp.linalg.inv(self.Rt) + object.__setattr__(self, "_pose", t) + return t + @property def projection_matrix(self) -> Num[Array, "3 4"]: """ @@ -73,6 +191,39 @@ class Camera: Camera parameters """ + def project(self, points_3d: Num[Array, "N 3"]) -> Num[Array, "N 2"]: + """ + Project 3D points to 2D points using this camera's parameters + + Args: + points_3d: 3D points in world coordinates + + Returns: + 2D points in image coordinates + """ + return project( + points_3d=points_3d, + K=self.params.K, + dist_coeffs=self.params.dist_coeffs, + projection_matrix=self.params.projection_matrix, + ) + + def distortion(self, points_2d: Num[Array, "N 2"]) -> Num[Array, "N 2"]: + """ + Apply distortion to 2D points using this camera's parameters + + Args: + points_2d: 2D points in image coordinates + + Returns: + Distorted 2D points + """ + return distortion( + points_2d=points_2d, + K=self.params.K, + dist_coeffs=self.params.dist_coeffs, + ) + @jaxtyped(typechecker=beartype) @dataclass(frozen=True) diff --git a/play.ipynb b/play.ipynb index a6cdd16..79d3567 100644 --- a/play.ipynb +++ b/play.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 32, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -32,7 +32,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -77,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -109,7 +109,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -122,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -162,7 +162,7 @@ "" ] }, - "execution_count": 36, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -173,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -253,7 +253,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -325,7 +325,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -403,7 +403,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -428,7 +428,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -437,7 +437,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -449,7 +449,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -489,7 +489,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -542,13 +542,13 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -580,13 +580,13 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -614,7 +614,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -703,28 +703,345 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ - "def triangle_from_cluster(cluster: list[Detection]) -> Float[Array, \"3\"]:\n", - " proj_matrices = jnp.array(\n", - " [\n", - " el.camera.params.projection_matrix\n", - " for el in cluster\n", - " ]\n", - " )\n", + "from dataclasses import dataclass\n", + "from copy import copy as shallow_copy, deepcopy as deep_copy\n", + "\n", + "\n", + "@jaxtyped(typechecker=beartype)\n", + "@dataclass\n", + "class Tracking:\n", + " id: int\n", + " keypoints: Float[Array, \"J 3\"]\n", + "\n", + "\n", + "@jaxtyped(typechecker=beartype)\n", + "def triangle_from_cluster(cluster: list[Detection]) -> Float[Array, \"N 3\"]:\n", + " proj_matrices = jnp.array([el.camera.params.projection_matrix for el in cluster])\n", " points = jnp.array([el.keypoints for el in cluster])\n", " confidences = jnp.array([el.confidences for el in cluster])\n", - " return triangulate_points_from_multiple_views_linear(proj_matrices, points, confidences=confidences)\n", + " return triangulate_points_from_multiple_views_linear(\n", + " proj_matrices, points, confidences=confidences\n", + " )\n", + "\n", + "# res = {\n", + "# \"a\": triangle_from_cluster(clusters_detections[0]).tolist(),\n", + "# \"b\": triangle_from_cluster(clusters_detections[1]).tolist(),\n", + "# }\n", + "# with open(\"samples/res.json\", \"wb\") as f:\n", + "# f.write(orjson.dumps(res))\n", + "\n", + "class GlobalTrackingState:\n", + " _last_id: int\n", + " _trackings: list[Tracking]\n", + "\n", + " def __init__(self):\n", + " self._last_id = 0\n", + " self._trackings = []\n", + "\n", + " @property\n", + " def trackings(self) -> list[Tracking]:\n", + " return shallow_copy(self._trackings)\n", + "\n", + " def add_tracking(self, cluster: list[Detection]) -> Tracking:\n", + " tracking = Tracking(id=self._last_id, keypoints=triangle_from_cluster(cluster))\n", + " self._last_id += 1\n", + " self._trackings.append(tracking)\n", + " return tracking\n", "\n", "\n", - "res = {\n", - " \"a\": triangle_from_cluster(clusters_detections[0]).tolist(),\n", - " \"b\": triangle_from_cluster(clusters_detections[1]).tolist(),\n", - "} \n", - "with open(\"samples/res.json\", \"wb\") as f:\n", - " f.write(orjson.dumps(res))" + "global_tracking_state = GlobalTrackingState()\n", + "for cluster in clusters_detections:\n", + " global_tracking_state.add_tracking(cluster)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Tracking(id=0, keypoints=Array([[-2.478689 , 0.58576185, 0.31040636],\n", + " [-2.487635 , 0.5750785 , 0.33750448],\n", + " [-2.516869 , 0.5680907 , 0.33390856],\n", + " [-2.6138005 , 0.42978898, 0.27764028],\n", + " [-2.6396189 , 0.47488394, 0.29678106],\n", + " [-2.5685527 , 0.43878514, 0.09963156],\n", + " [-2.7254057 , 0.3893181 , 0.08480301],\n", + " [-2.5344586 , 0.40936536, -0.15840554],\n", + " [-2.747655 , 0.34484679, -0.16990761],\n", + " [-2.4726276 , 0.40729105, -0.3720496 ],\n", + " [-2.7587056 , 0.28427097, -0.406074 ],\n", + " [-2.5269191 , 0.3938678 , -0.3918639 ],\n", + " [-2.6455402 , 0.34699422, -0.4058177 ],\n", + " [-2.5941784 , 0.27557036, -0.70096797],\n", + " [-2.6883006 , 0.23655021, -0.7130081 ],\n", + " [-2.6684163 , 0.12745126, -0.9703396 ],\n", + " [-2.7417223 , 0.09283889, -1.016917 ],\n", + " [-2.5061405 , 0.22308868, -1.0217493 ],\n", + " [-2.5167677 , 0.21673253, -1.0037726 ],\n", + " [-2.700999 , 0.0955274 , -0.9893921 ],\n", + " [-2.5327384 , 0.26760662, -1.0935913 ],\n", + " [-2.5889606 , 0.21380152, -1.1008173 ],\n", + " [-2.7783084 , 0.06784341, -1.05547 ],\n", + " [-2.6203077 , 0.47694924, 0.30091333],\n", + " [-2.6141524 , 0.48480964, 0.29051763],\n", + " [-2.6101258 , 0.4842495 , 0.2759923 ],\n", + " [-2.6019723 , 0.49182186, 0.26141244],\n", + " [-2.5955567 , 0.49043015, 0.24537463],\n", + " [-2.580753 , 0.4980408 , 0.23413275],\n", + " [-2.5645325 , 0.5104086 , 0.22897872],\n", + " [-2.543535 , 0.52415067, 0.22312577],\n", + " [-2.5252726 , 0.53506696, 0.22230433],\n", + " [-2.5074315 , 0.54455465, 0.2243325 ],\n", + " [-2.4946752 , 0.54923993, 0.23260562],\n", + " [-2.4883354 , 0.55697906, 0.25126523],\n", + " [-2.4821732 , 0.5633511 , 0.26851192],\n", + " [-2.481398 , 0.5659203 , 0.2852917 ],\n", + " [-2.4857533 , 0.5658061 , 0.29980442],\n", + " [-2.4904487 , 0.56464785, 0.31604052],\n", + " [-2.4929392 , 0.56345594, 0.33420235],\n", + " [-2.5342155 , 0.56024826, 0.34131834],\n", + " [-2.5266714 , 0.5639934 , 0.34675875],\n", + " [-2.515618 , 0.57274914, 0.35055315],\n", + " [-2.5086176 , 0.5741665 , 0.35129368],\n", + " [-2.49758 , 0.58184963, 0.348806 ],\n", + " [-2.491509 , 0.5783985 , 0.34651712],\n", + " [-2.4922395 , 0.57566667, 0.34606606],\n", + " [-2.4926522 , 0.57316136, 0.34310994],\n", + " [-2.4908383 , 0.5702774 , 0.34285372],\n", + " [-2.491695 , 0.5665806 , 0.34203148],\n", + " [-2.49199 , 0.5766112 , 0.33185345],\n", + " [-2.48335 , 0.5849312 , 0.32483235],\n", + " [-2.4761553 , 0.58624744, 0.3187993 ],\n", + " [-2.465714 , 0.59216094, 0.31144223],\n", + " [-2.496002 , 0.5712814 , 0.29583213],\n", + " [-2.490761 , 0.57405967, 0.2940837 ],\n", + " [-2.4833305 , 0.57589704, 0.29455808],\n", + " [-2.474398 , 0.58521056, 0.29803884],\n", + " [-2.4671159 , 0.58693707, 0.30250964],\n", + " [-2.5242941 , 0.5664761 , 0.3291623 ],\n", + " [-2.5189805 , 0.5701378 , 0.33211127],\n", + " [-2.5117717 , 0.57125694, 0.33249125],\n", + " [-2.5066514 , 0.573846 , 0.33103615],\n", + " [-2.511985 , 0.570361 , 0.32826287],\n", + " [-2.5195093 , 0.5682223 , 0.32761118],\n", + " [-2.4931314 , 0.572403 , 0.33128136],\n", + " [-2.491004 , 0.57048696, 0.33129817],\n", + " [-2.4916062 , 0.56848407, 0.3308549 ],\n", + " [-2.4921398 , 0.5659704 , 0.33047572],\n", + " [-2.4917126 , 0.5680113 , 0.33095637],\n", + " [-2.4934018 , 0.57097757, 0.3312303 ],\n", + " [-2.5044987 , 0.56543654, 0.27018583],\n", + " [-2.49717 , 0.56721306, 0.2746278 ],\n", + " [-2.4840567 , 0.5733305 , 0.27995318],\n", + " [-2.4808855 , 0.5778754 , 0.27817678],\n", + " [-2.4791615 , 0.5749825 , 0.27794725],\n", + " [-2.4798987 , 0.57225764, 0.2715237 ],\n", + " [-2.4859283 , 0.5651626 , 0.26878288],\n", + " [-2.4825733 , 0.57105947, 0.2674468 ],\n", + " [-2.482417 , 0.57205695, 0.2651913 ],\n", + " [-2.4860063 , 0.5670868 , 0.26224008],\n", + " [-2.4929094 , 0.56676567, 0.26232985],\n", + " [-2.4998984 , 0.5661312 , 0.26627693],\n", + " [-2.5047336 , 0.5645675 , 0.27005965],\n", + " [-2.4979978 , 0.56436163, 0.27196637],\n", + " [-2.4850368 , 0.57016957, 0.27112174],\n", + " [-2.4854894 , 0.5679848 , 0.27099285],\n", + " [-2.4858654 , 0.5657339 , 0.26873872],\n", + " [-2.485554 , 0.5676637 , 0.26872697],\n", + " [-2.4873292 , 0.57088923, 0.26689386],\n", + " [-2.4981174 , 0.56366634, 0.26787338],\n", + " [-2.4909582 , 0.37295616, -0.40748718],\n", + " [-2.6490762 , 0.32337624, -0.43623102],\n", + " [-2.7246935 , 0.24376573, -0.45344314],\n", + " [-2.7518306 , 0.23105064, -0.45996842],\n", + " [-2.7698176 , 0.22506613, -0.4736081 ],\n", + " [-2.7504241 , 0.22800633, -0.46472058],\n", + " [-2.7755752 , 0.21673861, -0.48169854],\n", + " [-2.7885907 , 0.21188174, -0.48581603],\n", + " [-2.7911522 , 0.21484403, -0.48935196],\n", + " [-2.759041 , 0.22250253, -0.4689292 ],\n", + " [-2.7862694 , 0.21226972, -0.48406732],\n", + " [-2.7993248 , 0.20662239, -0.4882717 ],\n", + " [-2.8062823 , 0.20908453, -0.48991066],\n", + " [-2.7570608 , 0.22210872, -0.46874624],\n", + " [-2.7824435 , 0.21303381, -0.48331115],\n", + " [-2.7962708 , 0.20712012, -0.4869999 ],\n", + " [-2.8056016 , 0.20792596, -0.4883144 ],\n", + " [-2.7566772 , 0.22073819, -0.47055322],\n", + " [-2.7741377 , 0.21431786, -0.4822729 ],\n", + " [-2.7845633 , 0.21069744, -0.4851864 ],\n", + " [-2.784297 , 0.2150593 , -0.48519084],\n", + " [-2.7607975 , 0.27365783, -0.42897853],\n", + " [-2.7522154 , 0.28045487, -0.4421708 ],\n", + " [-2.746194 , 0.28172007, -0.46141976],\n", + " [-2.7603068 , 0.2713149 , -0.47768784],\n", + " [-2.7764916 , 0.2570097 , -0.49032772],\n", + " [-2.7587183 , 0.27294153, -0.4844668 ],\n", + " [-2.77585 , 0.25995484, -0.50209296],\n", + " [-2.7856925 , 0.25821355, -0.5033261 ],\n", + " [-2.7931395 , 0.25417143, -0.5010109 ],\n", + " [-2.7742484 , 0.26124442, -0.48536086],\n", + " [-2.792075 , 0.25210914, -0.5037874 ],\n", + " [-2.7990744 , 0.2503853 , -0.5015753 ],\n", + " [-2.8078728 , 0.24846262, -0.49781758],\n", + " [-2.7920868 , 0.24492791, -0.48061696],\n", + " [-2.8058107 , 0.2379582 , -0.49851406],\n", + " [-2.815008 , 0.2381111 , -0.4961291 ],\n", + " [-2.8190477 , 0.23477224, -0.49271274],\n", + " [-2.8075583 , 0.23149821, -0.4738758 ],\n", + " [-2.8188121 , 0.2248099 , -0.48789412],\n", + " [-2.822658 , 0.22395411, -0.486353 ],\n", + " [-2.8291316 , 0.2225797 , -0.48452914]], dtype=float32)),\n", + " Tracking(id=1, keypoints=Array([[-1.2553115 , 0.81767416, 0.44171926],\n", + " [-1.2456927 , 0.8036527 , 0.46956694],\n", + " [-1.302486 , 0.813311 , 0.46435893],\n", + " [-1.245059 , 0.7567441 , 0.43512627],\n", + " [-1.4064106 , 0.76918995, 0.41482762],\n", + " [-1.1888118 , 0.7098885 , 0.25775027],\n", + " [-1.5546072 , 0.6874975 , 0.22544383],\n", + " [-1.1686605 , 0.6328288 , 0.03890971],\n", + " [-1.6690636 , 0.613729 , 0.01887926],\n", + " [-1.2173432 , 0.6612864 , -0.12372287],\n", + " [-1.5662235 , 0.642984 , -0.10074274],\n", + " [-1.276065 , 0.6505205 , -0.23342979],\n", + " [-1.5031629 , 0.6353773 , -0.24284542],\n", + " [-1.3245349 , 0.59676427, -0.5656998 ],\n", + " [-1.5147399 , 0.5729649 , -0.56791174],\n", + " [-1.3548312 , 0.5475617 , -0.87576115],\n", + " [-1.5277345 , 0.5106128 , -0.87238586],\n", + " [-1.3269273 , 0.59170055, -0.9538355 ],\n", + " [-1.290105 , 0.5917955 , -0.94912887],\n", + " [-1.3769125 , 0.53148586, -0.9001328 ],\n", + " [-1.4701391 , 0.5551263 , -0.9486235 ],\n", + " [-1.5282948 , 0.5314149 , -0.93778586],\n", + " [-1.5279521 , 0.50264376, -0.89517343],\n", + " [-1.3896687 , 0.78212154, 0.43669158],\n", + " [-1.3875366 , 0.7785802 , 0.41728354],\n", + " [-1.3847445 , 0.77620625, 0.40143034],\n", + " [-1.3775258 , 0.7738861 , 0.38587955],\n", + " [-1.3668877 , 0.77508116, 0.37086558],\n", + " [-1.3495451 , 0.77578163, 0.36163867],\n", + " [-1.3325701 , 0.77516156, 0.3543622 ],\n", + " [-1.3131677 , 0.77481353, 0.34953067],\n", + " [-1.2948365 , 0.77043116, 0.34866422],\n", + " [-1.2756544 , 0.7680839 , 0.34981343],\n", + " [-1.2576406 , 0.7676621 , 0.3607644 ],\n", + " [-1.2487329 , 0.76640284, 0.37460014],\n", + " [-1.2476267 , 0.7613117 , 0.39171293],\n", + " [-1.2417752 , 0.7631028 , 0.40951785],\n", + " [-1.2406809 , 0.7637108 , 0.42770866],\n", + " [-1.2424214 , 0.76247483, 0.44312298],\n", + " [-1.2449623 , 0.7657555 , 0.46379378],\n", + " [-1.3307456 , 0.81414324, 0.47075832],\n", + " [-1.3190908 , 0.8143914 , 0.4794416 ],\n", + " [-1.306804 , 0.81769013, 0.48060942],\n", + " [-1.2916197 , 0.82214326, 0.4857923 ],\n", + " [-1.2817711 , 0.81895435, 0.48213756],\n", + " [-1.2552457 , 0.81200224, 0.48346815],\n", + " [-1.2519522 , 0.8085054 , 0.48572475],\n", + " [-1.2474728 , 0.8025153 , 0.48543444],\n", + " [-1.243003 , 0.79651874, 0.48514473],\n", + " [-1.2406443 , 0.7915283 , 0.48249066],\n", + " [-1.2608445 , 0.8172351 , 0.46584633],\n", + " [-1.256579 , 0.8180955 , 0.45589966],\n", + " [-1.2491268 , 0.8212112 , 0.44875354],\n", + " [-1.2444685 , 0.82276416, 0.44101098],\n", + " [-1.2709363 , 0.8137922 , 0.42292774],\n", + " [-1.2622437 , 0.8133173 , 0.42321014],\n", + " [-1.2527177 , 0.81485313, 0.42394385],\n", + " [-1.2481103 , 0.8090447 , 0.42394283],\n", + " [-1.2439959 , 0.8077901 , 0.42782867],\n", + " [-1.3185279 , 0.8132555 , 0.455423 ],\n", + " [-1.3073637 , 0.81249124, 0.46022734],\n", + " [-1.298568 , 0.8122064 , 0.4607794 ],\n", + " [-1.2868971 , 0.8143201 , 0.45781255],\n", + " [-1.2992586 , 0.8110255 , 0.45644143],\n", + " [-1.3084131 , 0.8106478 , 0.45369217],\n", + " [-1.25393 , 0.8063764 , 0.4629369 ],\n", + " [-1.2497365 , 0.8051851 , 0.46708038],\n", + " [-1.2452476 , 0.7992271 , 0.46680468],\n", + " [-1.2413497 , 0.7922395 , 0.46243277],\n", + " [-1.2459726 , 0.7978798 , 0.46105224],\n", + " [-1.2512271 , 0.8018539 , 0.46109664],\n", + " [-1.2894073 , 0.80356973, 0.3949233 ],\n", + " [-1.2737364 , 0.8088681 , 0.4039713 ],\n", + " [-1.2575928 , 0.80955 , 0.4089413 ],\n", + " [-1.2497358 , 0.8127981 , 0.40973902],\n", + " [-1.245353 , 0.81257224, 0.40999565],\n", + " [-1.2420748 , 0.80380005, 0.40572852],\n", + " [-1.2434423 , 0.7948831 , 0.39910692],\n", + " [-1.2440251 , 0.79979116, 0.39715847],\n", + " [-1.2473823 , 0.802991 , 0.39349133],\n", + " [-1.2520038 , 0.80874175, 0.39346927],\n", + " [-1.2658229 , 0.80748516, 0.39274913],\n", + " [-1.2787858 , 0.80246013, 0.3915122 ],\n", + " [-1.2877386 , 0.8018655 , 0.39484885],\n", + " [-1.2699101 , 0.80767363, 0.40016773],\n", + " [-1.2542638 , 0.8073875 , 0.40130627],\n", + " [-1.2470095 , 0.80304414, 0.4014101 ],\n", + " [-1.2451108 , 0.7965887 , 0.39917985],\n", + " [-1.2470095 , 0.80304414, 0.4014101 ],\n", + " [-1.2542638 , 0.8073875 , 0.40130627],\n", + " [-1.2700459 , 0.8073668 , 0.39853284],\n", + " [-1.2208867 , 0.6653857 , -0.14107333],\n", + " [-1.2295499 , 0.666676 , -0.14252058],\n", + " [-1.2398047 , 0.6640044 , -0.15045756],\n", + " [-1.2491337 , 0.6642992 , -0.15746638],\n", + " [-1.2494593 , 0.67095923, -0.16590758],\n", + " [-1.2318163 , 0.6709184 , -0.15842697],\n", + " [-1.2360069 , 0.6675048 , -0.16684474],\n", + " [-1.2418597 , 0.6643395 , -0.17036118],\n", + " [-1.2491734 , 0.658755 , -0.17511088],\n", + " [-1.227513 , 0.6711193 , -0.16040966],\n", + " [-1.2349824 , 0.6654219 , -0.17266446],\n", + " [-1.2394276 , 0.65952814, -0.17668773],\n", + " [-1.2448883 , 0.65159357, -0.18011504],\n", + " [-1.2285581 , 0.6685526 , -0.16612191],\n", + " [-1.2304138 , 0.6656384 , -0.17683747],\n", + " [-1.2352761 , 0.6589148 , -0.18067938],\n", + " [-1.2397696 , 0.6542397 , -0.18179603],\n", + " [-1.2297099 , 0.66609055, -0.17332217],\n", + " [-1.230786 , 0.664324 , -0.1790045 ],\n", + " [-1.2307583 , 0.6601091 , -0.18404593],\n", + " [-1.234234 , 0.6567872 , -0.18384361],\n", + " [-1.5696746 , 0.63732606, -0.10729273],\n", + " [-1.55086 , 0.64279026, -0.10464413],\n", + " [-1.5384696 , 0.64851606, -0.10692033],\n", + " [-1.5344497 , 0.64882326, -0.11430191],\n", + " [-1.5279433 , 0.650463 , -0.12476842],\n", + " [-1.5458598 , 0.6470458 , -0.11982083],\n", + " [-1.5357145 , 0.6531256 , -0.1302915 ],\n", + " [-1.5323898 , 0.65010923, -0.131393 ],\n", + " [-1.5330654 , 0.64818895, -0.13211855],\n", + " [-1.551035 , 0.6446348 , -0.12478309],\n", + " [-1.5443487 , 0.6461636 , -0.1344983 ],\n", + " [-1.5416367 , 0.6473249 , -0.13531932],\n", + " [-1.5427909 , 0.6441275 , -0.13736817],\n", + " [-1.5514573 , 0.6438553 , -0.13022557],\n", + " [-1.5493276 , 0.6440739 , -0.13788472],\n", + " [-1.5467429 , 0.64533913, -0.13838342],\n", + " [-1.5477741 , 0.64245623, -0.13843 ],\n", + " [-1.5572879 , 0.6400873 , -0.13644902],\n", + " [-1.5551068 , 0.64055866, -0.14215696],\n", + " [-1.5568593 , 0.6414328 , -0.14450715],\n", + " [-1.5548064 , 0.64144945, -0.1446854 ]], dtype=float32))]" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "next_group = next(sync_gen)\n", + "display(next_group)" ] } ],