-
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
Use instances as model input #46
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8ddc557
add back-reference to frame as attribute for instane
aaprasad 7887d56
separate get_boxes_times into two functions and use `Instances` as input
aaprasad 9bab7bc
use instances as input into model instead of frames
aaprasad 4ff91e7
simplify feature extraction logic
aaprasad 076398a
fix docstrings
aaprasad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -66,7 +66,8 @@ def forward( | |||||
"""Execute forward pass of the lightning module. | ||||||
|
||||||
Args: | ||||||
instances: a list of dicts where each dict is a frame with gt data | ||||||
ref_instances: a list of `Instance` objects containing crops and other data needed for transformer model | ||||||
query_instances: a list of `Instance` objects used as queries in the decoder. Mostly used for inference. | ||||||
|
||||||
Returns: | ||||||
An association matrix between objects | ||||||
|
@@ -80,8 +81,8 @@ def training_step( | |||||
"""Execute single training step for model. | ||||||
|
||||||
Args: | ||||||
train_batch: A single batch from the dataset which is a list of dicts | ||||||
with length `clip_length` where each dict is a frame | ||||||
train_batch: A single batch from the dataset which is a list of `Frame` objects | ||||||
with length `clip_length` containing Instances and other metadata. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
batch_idx: the batch number used by lightning | ||||||
|
||||||
Returns: | ||||||
|
@@ -98,8 +99,8 @@ def validation_step( | |||||
"""Execute single val step for model. | ||||||
|
||||||
Args: | ||||||
val_batch: A single batch from the dataset which is a list of dicts | ||||||
with length `clip_length` where each dict is a frame | ||||||
val_batch: A single batch from the dataset which is a list of `Frame` objects | ||||||
with length `clip_length` containing Instances and other metadata. | ||||||
batch_idx: the batch number used by lightning | ||||||
|
||||||
Returns: | ||||||
|
@@ -116,8 +117,8 @@ def test_step( | |||||
"""Execute single test step for model. | ||||||
|
||||||
Args: | ||||||
val_batch: A single batch from the dataset which is a list of dicts | ||||||
with length `clip_length` where each dict is a frame | ||||||
test_batch: A single batch from the dataset which is a list of `Frame` objects | ||||||
with length `clip_length` containing Instances and other metadata. | ||||||
batch_idx: the batch number used by lightning | ||||||
|
||||||
Returns: | ||||||
|
@@ -134,8 +135,8 @@ def predict_step(self, batch: list[list[Frame]], batch_idx: int) -> list[Frame]: | |||||
Computes association + assignment. | ||||||
|
||||||
Args: | ||||||
batch: A single batch from the dataset which is a list of dicts | ||||||
with length `clip_length` where each dict is a frame | ||||||
batch: A single batch from the dataset which is a list of `Frame` objects | ||||||
with length `clip_length` containing Instances and other metadata. | ||||||
batch_idx: the batch number used by lightning | ||||||
|
||||||
Returns: | ||||||
|
@@ -149,18 +150,16 @@ def _shared_eval_step(self, frames: list[Frame], mode: str) -> dict[str, float]: | |||||
"""Run evaluation used by train, test, and val steps. | ||||||
|
||||||
Args: | ||||||
frames: A list of dicts where each dict is a frame containing gt data | ||||||
frames: A list of `Frame` objects with length `clip_length` containing Instances and other metadata. | ||||||
mode: which metrics to compute and whether to use persistent tracking or not | ||||||
|
||||||
Returns: | ||||||
a dict containing the loss and any other metrics specified by `eval_metrics` | ||||||
""" | ||||||
try: | ||||||
frames = [frame for frame in frames if frame.has_instances()] | ||||||
if len(frames) == 0: | ||||||
return None | ||||||
|
||||||
instances = [instance for frame in frames for instance in frame.instances] | ||||||
if len(instances) == 0: | ||||||
return None | ||||||
|
||||||
eval_metrics = self.metrics[mode] | ||||||
persistent_tracking = self.persistent_tracking[mode] | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.