-
Notifications
You must be signed in to change notification settings - Fork 102
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
(3g -> 3f) Use frame group for triangulation #1693
(3g -> 3f) Use frame group for triangulation #1693
Conversation
WalkthroughThe modifications in the Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Additional comments not posted (1)
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 (
|
* Add FrameGroup class * Replace _get_instances_by_camera with maintained _instances_by_cam * Convert enforce_frame_idx_unique to regular method * Write (failing) FrameGroup test * Get FrameGroup.session validator working * Get rid of test_instance_group bug * Fix create_instance_group bug * Fix failing tests * Add update_points, get_instance_group, and numpy methods * Add `get_instances` method * Rename `update_points` to `upsert_points` and numpy multiple `InstanceGroup`s * Create and add missing instance when updating reprojections * Add method to add `Instance`s and `InstanceGroup`s * Create new InstanceGroup if instance_group is None in add_instance_group * (3g -> 3f) Use frame group for triangulation (#1693)
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: 0
Actionable comments outside the diff hunks (15)
tests/gui/test_commands.py (7)
Line range hint
5-5
: Remove unused importDict
.- from typing import Dict, List + from typing import List
Line range hint
7-7
: Remove unused importnumpy
.- import numpy as np
Line range hint
21-21
: Remove unused importTriangulateSession
.- from sleap.gui.commands import ( - AddSession, - CommandContext, - ExportAnalysisFile, - ExportDatasetWithImages, - ImportDeepLabCutFolder, - OpenSkeleton, - RemoveVideo, - ReplaceVideo, - SaveProjectAs, - TriangulateSession, - get_new_version_filename, - ) + from sleap.gui.commands import ( + AddSession, + CommandContext, + ExportAnalysisFile, + ExportDatasetWithImages, + ImportDeepLabCutFolder, + OpenSkeleton, + RemoveVideo, + ReplaceVideo, + SaveProjectAs, + get_new_version_filename, + )
Line range hint
25-25
: Remove unused importCamcorder
.- from sleap.io.cameras import Camcorder
Line range hint
227-227
: Useif okay:
instead ofif okay is True:
for truth checks.- if okay is True: + if okay:
Line range hint
368-368
: Useif video.backend.grayscale:
instead ofif video.backend.grayscale is True:
for truth checks.- if video.backend.grayscale is True: + if video.backend.grayscale:
Line range hint
528-528
: Remove unnecessary f-string as it contains no placeholders.- filename = get_package_file(f"skeletons/fly32.json") + filename = get_package_file("skeletons/fly32.json")sleap/gui/commands.py (8)
Line range hint
38-40
: Remove unused imports to clean up the code.- from itertools import permutations, product - from typing import Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, cast + from typing import Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
Line range hint
196-196
: Undefined nameMainWindow
used. Ensure thatMainWindow
is defined or imported correctly in this context.
Line range hint
838-838
: Local variablefile_dir
is assigned but never used. Consider removing it if it's unnecessary.- file_dir = os.path.dirname(filename)
Line range hint
1712-1712
: Avoid using bareexcept
statements. Specify exception types to handle specific exceptions appropriately.- except: + except Exception as e:
Line range hint
1733-1733
: Avoid using bareexcept
statements. Specify exception types to handle specific exceptions appropriately.- except: + except Exception as e:
Line range hint
2470-2470
: The f-string does not contain any placeholders. Use a regular string instead.- f"Please select the area from which to remove instances. This will be applied to all frames." + "Please select the area from which to remove instances. This will be applied to all frames."
Line range hint
2802-2802
: The f-string does not contain any placeholders. Use a regular string instead.- f"An error occurred while generating suggestions. " + "An error occurred while generating suggestions. "
Line range hint
3145-3145
: Avoid using bareexcept
statements. Specify exception types to handle specific exceptions appropriately.- except: + except Exception as e:
* Add method to get single instance permutations * Add method and (failing) test to get instance grouping * Append a dummy instance for missing instances * Update tests to accept a dummy instance * Add initial InstanceGroup class * Few extra tests for `InstanceGroup` * Remember instance grouping after testing hypotheses * Use reconsumable iterator for reprojected coords * Only triangulate user instances, add fixture, update tests * Normalize instance reprojection errors * Add `locked`, `_dummy_instance`, `numpy`, and `update_points` * Allow `PredictedPoint`s to be updated as well * Add tests for new attributes and methods * Add methods to create, add, replace, and remove instances * Use PredictedInstance for new/dummy instances * (3f -> 3e) Add `FrameGroup` class (#1665) * (3g -> 3f) Use frame group for triangulation (#1693)
* Update methods to allow triangulating multiple instances at once * Return instances and coords as a dictionary with cams * Update get_instance_across_views to handle multiple frames * [wip] Update calculate reprojected points to support multiple frames * Finish support for multi-frame reprojection * Remove code to put in next PR * (3b -> 3a) Add method to get single instance permutations (#1586) * Add method to get single instance permutations * Append a dummy instance for missing instances * Correct 'permutations' to 'products' * (3c -> 3b) Add method to test instance grouping (#1599) * (3d -> 3c) Add method for multi instance products (#1605) * (3e -> 3a) Add `InstanceGroup` class (#1618) * Add method to get single instance permutations * Add method and (failing) test to get instance grouping * Append a dummy instance for missing instances * Update tests to accept a dummy instance * Add initial InstanceGroup class * Few extra tests for `InstanceGroup` * Remember instance grouping after testing hypotheses * Use reconsumable iterator for reprojected coords * Only triangulate user instances, add fixture, update tests * Normalize instance reprojection errors * Add `locked`, `_dummy_instance`, `numpy`, and `update_points` * Allow `PredictedPoint`s to be updated as well * Add tests for new attributes and methods * Add methods to create, add, replace, and remove instances * Use PredictedInstance for new/dummy instances * (3f -> 3e) Add `FrameGroup` class (#1665) * (3g -> 3f) Use frame group for triangulation (#1693) * Only use user-`Instance`s for triangulation * Remove unused code * Use `LabeledFrame` class instead of dummy labeled frame * Limit which methods can update `Labels.labeled_frames` * Update cache when Labels. remove_session_video * Remove RecordingSession.instance_groups * [wip] Maintain cached FrameGroup dictionaries * Add unique name (per FrameGroup) requirement for InstanceGroup * Lint * Fix remove_video bug * Add RecordingSession.new_frame_group method * Add TODO comments for later * Fix RecordingSesssion.remove_video bug * Remove FrameGroup._frame_idx_registry class attribute
Description
This PR makes use of the
FrameGroup
andInstanceGroup
classes and uses them for triangulation.Types of changes
Does this address any currently open issues?
[list open issues here]
Outside contributors checklist
Thank you for contributing to SLEAP!
❤️
Summary by CodeRabbit
New Features
Tests