-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add osx-arm64 env #13
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
- Coverage 75.28% 75.00% -0.29%
==========================================
Files 24 24
Lines 1513 1532 +19
==========================================
+ Hits 1139 1149 +10
- Misses 374 383 +9 ☔ View full report in Codecov by Sentry. |
Got it working on mps/cpu, but now device errors on local ubuntu tests with cuda. I'll need to debug before merging. |
Co-authored-by: aaprasad <aaprasad.ucsd.edu> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Warning Rate Limit Exceeded@aaprasad has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 34 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThis update involves major enhancements across the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Actionable comments outside the diff hunks (1)
tests/test_training.py (1)
Line range hint
45-45
: The local variablefeats
is assigned but never used. Consider removing it if it's not needed.
def pose_bbox(points: np.ndarray, bbox_size: Union[tuple[int], int]) -> torch.Tensor: | ||
"""Calculate bbox around instance pose. | ||
|
||
Args: | ||
instance: a labeled instance in a frame, | ||
padding: the amount to pad around the pose crop | ||
im_shape: the size of the original image in (w,h) | ||
bbox_size: size of bbox either an int indicating square bbox or in (x,y) | ||
|
||
Returns: | ||
Bounding box in [y1, x1, y2, x2] format. | ||
""" | ||
w, h = im_shape | ||
if isinstance(bbox_size, int): | ||
bbox_size = (bbox_size, bbox_size) | ||
# print(points) | ||
minx = np.nanmin(points[:, 0], axis=-1) | ||
miny = np.nanmin(points[:, -1], axis=-1) | ||
minpoints = np.array([minx, miny]).T | ||
|
||
points = torch.Tensor([[p.x, p.y] for p in instance.points]) | ||
maxx = np.nanmax(points[:, 0], axis=-1) | ||
maxy = np.nanmax(points[:, -1], axis=-1) | ||
maxpoints = np.array([maxx, maxy]).T | ||
|
||
min_x = max(torch.nanmin(points[:, 0]) - padding, 0) | ||
min_y = max(torch.nanmin(points[:, 1]) - padding, 0) | ||
max_x = min(torch.nanmax(points[:, 0]) + padding, w) | ||
max_y = min(torch.nanmax(points[:, 1]) + padding, h) | ||
c = (minpoints + maxpoints) / 2 | ||
|
||
bbox = torch.Tensor([min_y, min_x, max_y, max_x]) | ||
bbox = torch.Tensor( | ||
[ | ||
c[-1] - bbox_size[-1] / 2, | ||
c[0] - bbox_size[0] / 2, | ||
c[-1] + bbox_size[-1] / 2, | ||
c[0] + bbox_size[0] / 2, | ||
] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor the pose_bbox
function to improve readability and maintainability.
- if isinstance(bbox_size, int):
- bbox_size = (bbox_size, bbox_size)
- minx = np.nanmin(points[:, 0], axis=-1)
- miny = np.nanmin(points[:, -1], axis=-1)
- minpoints = np.array([minx, miny]).T
-
- maxx = np.nanmax(points[:, 0], axis=-1)
- maxy = np.nanmax(points[:, -1], axis=-1)
- maxpoints = np.array([maxx, maxy]).T
-
- c = (minpoints + maxpoints) / 2
-
- bbox = torch.Tensor(
- [
- c[-1] - bbox_size[-1] / 2,
- c[0] - bbox_size[0] / 2,
- c[-1] + bbox_size[-1] / 2,
- c[0] + bbox_size[0] / 2,
- ]
- )
+ half_height, half_width = (bbox_size if isinstance(bbox_size, tuple) else (bbox_size, bbox_size))
+ min_coords = np.nanmin(points, axis=0)
+ max_coords = np.nanmax(points, axis=0)
+ center = (min_coords + max_coords) / 2
+ y1, x1 = center[1] - half_height // 2, center[0] - half_width // 2
+ y2, x2 = center[1] + half_height // 2, center[0] + half_width // 2
+ bbox = torch.tensor([y1, x1, y2, x2])
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
def pose_bbox(points: np.ndarray, bbox_size: Union[tuple[int], int]) -> torch.Tensor: | |
"""Calculate bbox around instance pose. | |
Args: | |
instance: a labeled instance in a frame, | |
padding: the amount to pad around the pose crop | |
im_shape: the size of the original image in (w,h) | |
bbox_size: size of bbox either an int indicating square bbox or in (x,y) | |
Returns: | |
Bounding box in [y1, x1, y2, x2] format. | |
""" | |
w, h = im_shape | |
if isinstance(bbox_size, int): | |
bbox_size = (bbox_size, bbox_size) | |
# print(points) | |
minx = np.nanmin(points[:, 0], axis=-1) | |
miny = np.nanmin(points[:, -1], axis=-1) | |
minpoints = np.array([minx, miny]).T | |
points = torch.Tensor([[p.x, p.y] for p in instance.points]) | |
maxx = np.nanmax(points[:, 0], axis=-1) | |
maxy = np.nanmax(points[:, -1], axis=-1) | |
maxpoints = np.array([maxx, maxy]).T | |
min_x = max(torch.nanmin(points[:, 0]) - padding, 0) | |
min_y = max(torch.nanmin(points[:, 1]) - padding, 0) | |
max_x = min(torch.nanmax(points[:, 0]) + padding, w) | |
max_y = min(torch.nanmax(points[:, 1]) + padding, h) | |
c = (minpoints + maxpoints) / 2 | |
bbox = torch.Tensor([min_y, min_x, max_y, max_x]) | |
bbox = torch.Tensor( | |
[ | |
c[-1] - bbox_size[-1] / 2, | |
c[0] - bbox_size[0] / 2, | |
c[-1] + bbox_size[-1] / 2, | |
c[0] + bbox_size[0] / 2, | |
] | |
) | |
def pose_bbox(points: np.ndarray, bbox_size: Union[tuple[int], int]) -> torch.Tensor: | |
"""Calculate bbox around instance pose. | |
Args: | |
instance: a labeled instance in a frame, | |
bbox_size: size of bbox either an int indicating square bbox or in (x,y) | |
Returns: | |
Bounding box in [y1, x1, y2, x2] format. | |
""" | |
half_height, half_width = (bbox_size if isinstance(bbox_size, tuple) else (bbox_size, bbox_size)) | |
min_coords = np.nanmin(points, axis=0) | |
max_coords = np.nanmax(points, axis=0) | |
center = (min_coords + max_coords) / 2 | |
y1, x1 = center[1] - half_height // 2, center[0] - half_width // 2 | |
y2, x2 = center[1] + half_height // 2, center[0] + half_width // 2 | |
bbox = torch.tensor([y1, x1, y2, x2]) |
try: | ||
reid_features = torch.cat( | ||
[frame.get_features() for frame in frames], dim=0 | ||
).unsqueeze(0) | ||
except Exception as e: | ||
print([[f.device for f in frame.get_features()] for frame in frames]) | ||
raise (e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor error handling to provide more informative error messages and avoid generic exception catching.
- except Exception as e:
- print([[f.device for f in frame.get_features()] for frame in frames])
- raise (e)
+ except RuntimeError as e:
+ print("Error during tensor concatenation:", e)
+ raise
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
try: | |
reid_features = torch.cat( | |
[frame.get_features() for frame in frames], dim=0 | |
).unsqueeze(0) | |
except Exception as e: | |
print([[f.device for f in frame.get_features()] for frame in frames]) | |
raise (e) | |
try: | |
reid_features = torch.cat( | |
[frame.get_features() for frame in frames], dim=0 | |
).unsqueeze(0) | |
except RuntimeError as e: | |
print("Error during tensor concatenation:", e) | |
raise |
|
||
if not self.persistent_tracking: | ||
if self.verbose: | ||
warnings.warn(f"Clearing Queue after tracking") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary warning message or add placeholders to the f-string.
- warnings.warn(f"Clearing Queue after tracking")
+ warnings.warn("Clearing Queue after tracking")
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
warnings.warn(f"Clearing Queue after tracking") | |
warnings.warn("Clearing Queue after tracking") |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
pyproject.toml
pyproject.toml
pyproject.toml
dependencies forpip
onesSummary by CodeRabbit
New Features
Bug Fixes
Documentation
Refactor
Tests
Chores
.gitignore
, and project configurations to enhance development workflow and project management.