-
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
Refactor inference script #51
Conversation
…`Instance` classes into separate modules within `io`
…`Instance` classes into separate modules within `io`
…nto aadi/refactor-data-structures
WalkthroughThe recent updates in the Changes
Poem
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: 7
Outside diff range and nitpick comments (9)
tests/test_training.py (2)
Line range hint
9-9
: Remove unused import.- from omegaconf import DictConfig
Line range hint
44-44
: Remove unused variable.- feats = 128
biogtr/datasets/microscopy_dataset.py (1)
Line range hint
86-86
: Replace the lambda expression with a function definition for better readability and maintainability.- parser = lambda x: data_utils.parse_synthetic(x, source=source) + def parser(x): + return data_utils.parse_synthetic(x, source=source)tests/test_inference.py (1)
Line range hint
168-168
: Remove the unused local variableN
to clean up the code.- N = N_t * T
Tools
Ruff
4-4:
pytest
imported but unused
7-7:
omegaconf.DictConfig
imported but unusedbiogtr/models/gtr_runner.py (1)
Line range hint
78-78
: Correct the type hints to use proper string formatting.- ref_instances: list["biogtr.io.Instance"], - query_instances: list["biogtr.io.Instance"] = None, + ref_instances: list[Instance], + query_instances: list[Instance] = None,Also applies to: 79-79, 94-94, 112-112, 130-130, 148-148, 149-149, 166-166
tests/test_datasets.py (1)
Line range hint
11-11
: Remove the unused import to clean up the code.- from biogtr.models.model_utils.get_device
biogtr/datasets/sleap_dataset.py (1)
Line range hint
9-9
: Remove unused import to clean up the code.- import warnings
biogtr/io/frame.py (1)
Line range hint
161-183
: Ensure consistent handling of default parameters into_slp
.The method
to_slp
modifies the default parametertrack_lookup
which can lead to unexpected behavior across function calls.- def to_slp(self, track_lookup: dict[int, sio.Track] = None): + def to_slp(self, track_lookup: dict[int, sio.Track] = None): + if track_lookup is None: + track_lookup = {}biogtr/inference/tracker.py (1)
Line range hint
158-475
: Refactorsliding_inference
to improve clarity and reduce complexity.The method
sliding_inference
is complex and contains nested logic that could be simplified. Consider breaking down the method into smaller, more manageable functions.+ def handle_instance_features(self, frame, model): + # Logic to handle instance features + pass + + def update_tracks(self, frame, batch_idx): + # Logic to update tracks + pass + - # Existing complex logic + self.handle_instance_features(frame, model) + self.update_tracks(frame, batch_idx)Tools
Ruff
174-174: Undefined name
curr_track
174-174: Local variable
curr_track
is assigned to but never used
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (16)
- biogtr/datasets/base_dataset.py (3 hunks)
- biogtr/datasets/cell_tracking_dataset.py (1 hunks)
- biogtr/datasets/microscopy_dataset.py (1 hunks)
- biogtr/datasets/sleap_dataset.py (1 hunks)
- biogtr/inference/configs/inference.yaml (1 hunks)
- biogtr/inference/track.py (3 hunks)
- biogtr/inference/tracker.py (4 hunks)
- biogtr/io/config.py (7 hunks)
- biogtr/io/frame.py (2 hunks)
- biogtr/io/instance.py (2 hunks)
- biogtr/models/gtr_runner.py (1 hunks)
- tests/configs/inference.yaml (1 hunks)
- tests/fixtures/configs.py (1 hunks)
- tests/test_datasets.py (1 hunks)
- tests/test_inference.py (2 hunks)
- tests/test_training.py (1 hunks)
Additional context used
Ruff
tests/test_training.py
9-9:
omegaconf.DictConfig
imported but unused
44-44: Local variable
feats
is assigned to but never usedbiogtr/inference/track.py
17-17: Undefined name
biogtr
118-118: f-string without any placeholders
biogtr/datasets/microscopy_dataset.py
86-86: Do not assign a
lambda
expression, use adef
tests/test_inference.py
4-4:
pytest
imported but unused
7-7:
omegaconf.DictConfig
imported but unused
168-168: Local variable
N
is assigned to but never usedbiogtr/models/gtr_runner.py
11-11:
biogtr.io.frame.Frame
imported but unused
12-12:
biogtr.io.instance.Instance
imported but unused
78-78: Undefined name
biogtr
79-79: Undefined name
biogtr
94-94: Undefined name
biogtr
112-112: Undefined name
biogtr
130-130: Undefined name
biogtr
148-148: Undefined name
biogtr
149-149: Undefined name
biogtr
166-166: Undefined name
biogtr
tests/test_datasets.py
11-11:
biogtr.models.model_utils.get_device
imported but unusedbiogtr/datasets/sleap_dataset.py
9-9:
warnings
imported but unusedbiogtr/io/config.py
56-56: Undefined name
params_cfg
82-82: Undefined name
GlobalTrackingTransformer
94-94: Undefined name
GTRRunner
110-110: Undefined name
GTRRunner
167-167: Undefined name
SleapDataset
167-167: Undefined name
MicroscopyDataset
167-167: Undefined name
CellTrackingDataset
231-231: Undefined name
SleapDataset
231-231: Undefined name
MicroscopyDataset
231-231: Undefined name
CellTrackingDataset
302-302: Undefined name
biogtr
biogtr/io/frame.py
57-57: Undefined name
Instance
58-58: Undefined name
AssociationMatrix
299-299: Undefined name
Instance
308-308: Undefined name
Instance
338-338: Undefined name
AssociationMatrix
357-357: Undefined name
AssociationMatrix
biogtr/inference/tracker.py
120-120: f-string without any placeholders
174-174: Undefined name
curr_track
174-174: Local variable
curr_track
is assigned to but never usedbiogtr/io/instance.py
93-93: Undefined name
Frame
520-520: Undefined name
Frame
529-529: Undefined name
Frame
Additional comments not posted (12)
tests/configs/inference.yaml (1)
7-7
: Ensurepersistent_tracking
is set as intended.Verification successful
The
persistent_tracking
setting is correctly utilized in the tracking logic within the codebase.
biogtr/models/gtr_runner.py
: Multiple references topersistent_tracking
, including its initialization and usage.biogtr/inference/tracker.py
: Initialization and conditional logic based onpersistent_tracking
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `persistent_tracking` setting is correctly utilized in the tracking logic. # Test: Search for usage of `persistent_tracking` in the codebase. Expect: Proper handling in tracking logic. rg --type python $'persistent_tracking'Length of output: 69
Script:
#!/bin/bash # Description: Verify that the `persistent_tracking` setting is correctly utilized in the tracking logic. # Test: Search for usage of `persistent_tracking` in Python files. Expect: Proper handling in tracking logic. rg 'persistent_tracking' --glob '*.py'Length of output: 1096
biogtr/inference/configs/inference.yaml (1)
7-7
: Ensurepersistent_tracking
is set as intended.Verification successful
The
persistent_tracking
setting is correctly utilized in the tracking logic.
biogtr/inference/tracker.py
: Thepersistent_tracking
attribute is defined, documented, and used in the tracking logic.biogtr/models/gtr_runner.py
: Thepersistent_tracking
attribute is defined, documented, and used in the runner logic.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `persistent_tracking` setting is correctly utilized in the tracking logic. # Test: Search for usage of `persistent_tracking` in the codebase. Expect: Proper handling in tracking logic. rg --type python $'persistent_tracking'Length of output: 69
Script:
#!/bin/bash # Description: Verify that the `persistent_tracking` setting is correctly utilized in the tracking logic. # Test: Search for usage of `persistent_tracking` in the codebase. Expect: Proper handling in tracking logic. rg --type py 'persistent_tracking'Length of output: 1092
tests/fixtures/configs.py (1)
25-29
: Added fixture for inference configuration.This will help in managing the inference configuration paths more effectively.
tests/test_training.py (1)
126-141
: Ensure directories are created before use.This change improves the test setup by ensuring necessary directories are created.
biogtr/inference/track.py (1)
54-88
: Refactored tracking logic.The refactoring enhances clarity and modularity by separating concerns and improving readability.
biogtr/datasets/base_dataset.py (1)
Line range hint
16-49
: Updated constructor parameters.The changes to the constructor parameters enhance flexibility and clarity, allowing for more granular control over dataset initialization.
biogtr/datasets/microscopy_dataset.py (1)
54-55
: Parameter order change in the constructor is consistent with the PR objectives and improves clarity.biogtr/datasets/cell_tracking_dataset.py (1)
58-59
: Parameter order change in the constructor is consistent with the PR objectives and improves clarity.biogtr/datasets/sleap_dataset.py (2)
68-69
: The addition ofvideo_files
to the constructor is well-integrated and aligns with the PR objectives.
68-69
: The usage ofvideo_files
inget_instances
method is correctly implemented and supports the functionality described in the PR.
[APROVED]biogtr/io/instance.py (2)
230-230
: Convertself.pose
values to a numpy array to ensure compatibility withsio.PredictedInstance.from_numpy
.Ensure this change is covered by unit tests to verify the correct data type is passed.
241-241
: Enhanced error message provides more context for debugging.Consider adding logging for such errors in a production environment to aid in monitoring and troubleshooting.
def get_data_paths(self, data_cfg: dict) -> tuple[list[str], list[str]]: | ||
"""Get file paths from directory. | ||
|
||
Args: | ||
data_cfg: Config for the dataset containing "dir" key. | ||
|
||
Returns: | ||
lists of labels file paths and video file paths respectively | ||
""" | ||
dir_cfg = data_cfg.pop("dir", None) | ||
|
||
if dir_cfg: | ||
labels_suff = dir_cfg.labels_suffix | ||
vid_suff = dir_cfg.vid_suffix | ||
|
||
label_files = glob.glob(f"{dir_cfg.path}/*.{labels_suff}") | ||
vid_files = glob.glob(f"{dir_cfg.path}/*.{vid_suff}") | ||
return label_files, vid_files | ||
|
||
return None, None | ||
|
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 get_data_paths
to improve error handling and return type consistency.
The method get_data_paths
currently returns None, None
if dir_cfg
is not found. It would be more consistent to always return two lists, even if they are empty.
- return None, None
+ return [], []
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 get_data_paths(self, data_cfg: dict) -> tuple[list[str], list[str]]: | |
"""Get file paths from directory. | |
Args: | |
data_cfg: Config for the dataset containing "dir" key. | |
Returns: | |
lists of labels file paths and video file paths respectively | |
""" | |
dir_cfg = data_cfg.pop("dir", None) | |
if dir_cfg: | |
labels_suff = dir_cfg.labels_suffix | |
vid_suff = dir_cfg.vid_suffix | |
label_files = glob.glob(f"{dir_cfg.path}/*.{labels_suff}") | |
vid_files = glob.glob(f"{dir_cfg.path}/*.{vid_suff}") | |
return label_files, vid_files | |
return None, None | |
def get_data_paths(self, data_cfg: dict) -> tuple[list[str], list[str]]: | |
"""Get file paths from directory. | |
Args: | |
data_cfg: Config for the dataset containing "dir" key. | |
Returns: | |
lists of labels file paths and video file paths respectively | |
""" | |
dir_cfg = data_cfg.pop("dir", None) | |
if dir_cfg: | |
labels_suff = dir_cfg.labels_suffix | |
vid_suff = dir_cfg.vid_suffix | |
label_files = glob.glob(f"{dir_cfg.path}/*.{labels_suff}") | |
vid_files = glob.glob(f"{dir_cfg.path}/*.{vid_suff}") | |
return label_files, vid_files | |
return [], [] |
@classmethod | ||
def from_yaml(cls, base_cfg_path: str, params_cfg_path: str = None) -> None: | ||
"""Load config directly from yaml. | ||
|
||
Args: | ||
base_cfg_path: path to base config file. | ||
params_cfg_path: path to override params. | ||
""" | ||
base_cfg = OmegaConf.load(base_cfg_path) | ||
params_cfg = OmegaConf.load(params_cfg_path) if params_cfg else None | ||
return cls(base_cfg, params_cfg) |
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.
Ensure proper handling of None
for optional parameters in from_yaml
.
The method from_yaml
does not handle the case where params_cfg_path
is None
before attempting to load it, which could lead to an error.
- params_cfg = OmegaConf.load(params_cfg_path) if params_cfg else None
+ if params_cfg_path:
+ params_cfg = OmegaConf.load(params_cfg_path)
+ else:
+ params_cfg = None
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.
@classmethod | |
def from_yaml(cls, base_cfg_path: str, params_cfg_path: str = None) -> None: | |
"""Load config directly from yaml. | |
Args: | |
base_cfg_path: path to base config file. | |
params_cfg_path: path to override params. | |
""" | |
base_cfg = OmegaConf.load(base_cfg_path) | |
params_cfg = OmegaConf.load(params_cfg_path) if params_cfg else None | |
return cls(base_cfg, params_cfg) | |
@classmethod | |
def from_yaml(cls, base_cfg_path: str, params_cfg_path: str = None) -> None: | |
"""Load config directly from yaml. | |
Args: | |
base_cfg_path: path to base config file. | |
params_cfg_path: path to override params. | |
""" | |
base_cfg = OmegaConf.load(base_cfg_path) | |
if params_cfg_path: | |
params_cfg = OmegaConf.load(params_cfg_path) | |
else: | |
params_cfg = None | |
return cls(base_cfg, params_cfg) |
Tools
Ruff
56-56: Undefined name
params_cfg
label_files, vid_files = self.get_data_paths(dataset_params) | ||
# todo: handle this better | ||
if "slp_files" in dataset_params: | ||
if label_files is not None: | ||
dataset_params.slp_files = label_files | ||
if vid_files is not None: | ||
dataset_params.video_files = vid_files | ||
return SleapDataset(**dataset_params) | ||
|
||
elif "tracks" in dataset_params or "source" in dataset_params: | ||
if label_files is not None: | ||
dataset_params.tracks = label_files | ||
if vid_files is not None: | ||
dataset_params.video_files = vid_files | ||
return MicroscopyDataset(**dataset_params) | ||
|
||
elif "raw_images" in dataset_params: | ||
if label_files is not None: | ||
dataset_params.gt_images = label_files | ||
if vid_files is not None: | ||
dataset_params.raw_images = vid_files | ||
return CellTrackingDataset(**dataset_params) | ||
|
||
# todo: handle this better | ||
if "slp_files" in dataset_params: | ||
return SleapDataset(**dataset_params) | ||
|
||
elif "tracks" in dataset_params or "source" in dataset_params: | ||
return MicroscopyDataset(**dataset_params) | ||
|
||
elif "raw_images" in dataset_params: | ||
return CellTrackingDataset(**dataset_params) | ||
|
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.
Simplify the get_dataset
method by reducing redundancy.
The method get_dataset
contains repetitive blocks of code for handling different dataset types. This can be simplified by using a mapping from dataset type to class.
+ dataset_mapping = {
+ 'slp_files': SleapDataset,
+ 'tracks': MicroscopyDataset,
+ 'source': MicroscopyDataset,
+ 'raw_images': CellTrackingDataset
+ }
+ for key, dataset_class in dataset_mapping.items():
+ if key in dataset_params:
+ if label_files is not None:
+ dataset_params[key.replace('_files', '')] = label_files
+ if vid_files is not None:
+ dataset_params['video_files'] = vid_files
+ return dataset_class(**dataset_params)
+ raise ValueError("Could not resolve dataset type from Config!")
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.
label_files, vid_files = self.get_data_paths(dataset_params) | |
# todo: handle this better | |
if "slp_files" in dataset_params: | |
if label_files is not None: | |
dataset_params.slp_files = label_files | |
if vid_files is not None: | |
dataset_params.video_files = vid_files | |
return SleapDataset(**dataset_params) | |
elif "tracks" in dataset_params or "source" in dataset_params: | |
if label_files is not None: | |
dataset_params.tracks = label_files | |
if vid_files is not None: | |
dataset_params.video_files = vid_files | |
return MicroscopyDataset(**dataset_params) | |
elif "raw_images" in dataset_params: | |
if label_files is not None: | |
dataset_params.gt_images = label_files | |
if vid_files is not None: | |
dataset_params.raw_images = vid_files | |
return CellTrackingDataset(**dataset_params) | |
# todo: handle this better | |
if "slp_files" in dataset_params: | |
return SleapDataset(**dataset_params) | |
elif "tracks" in dataset_params or "source" in dataset_params: | |
return MicroscopyDataset(**dataset_params) | |
elif "raw_images" in dataset_params: | |
return CellTrackingDataset(**dataset_params) | |
label_files, vid_files = self.get_data_paths(dataset_params) | |
dataset_mapping = { | |
'slp_files': SleapDataset, | |
'tracks': MicroscopyDataset, | |
'source': MicroscopyDataset, | |
'raw_images': CellTrackingDataset | |
} | |
for key, dataset_class in dataset_mapping.items(): | |
if key in dataset_params: | |
if label_files is not None: | |
dataset_params[key.replace('_files', '')] = label_files | |
if vid_files is not None: | |
dataset_params['video_files'] = vid_files | |
return dataset_class(**dataset_params) | |
raise ValueError("Could not resolve dataset type from Config!") |
def __init__(self, cfg: DictConfig, params_cfg: DictConfig = None): | ||
"""Initialize the class with config from hydra/omega conf. | ||
|
||
First uses `base_param` file then overwrites with specific `params_config`. | ||
|
||
Args: | ||
cfg: The `DictConfig` containing all the hyperparameters needed for | ||
training/evaluation. | ||
params_cfg: The `DictConfig` containing subset of hyperparameters to override. | ||
training/evaluation | ||
""" | ||
base_cfg = cfg | ||
print(f"Base Config: {cfg}") | ||
|
||
if "params_config" in cfg: | ||
# merge configs | ||
params_config = OmegaConf.load(cfg.params_config) | ||
pprint(f"Overwriting base config with {params_config}") | ||
self.cfg = OmegaConf.merge(base_cfg, params_config) | ||
params_cfg = OmegaConf.load(cfg.params_config) | ||
|
||
if params_cfg: | ||
pprint(f"Overwriting base config with {params_cfg}") | ||
self.cfg = OmegaConf.merge(base_cfg, params_cfg) # merge configs | ||
else: | ||
# just use base config | ||
self.cfg = base_cfg | ||
self.cfg = cfg |
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.
Consider adding error handling for file operations in __init__
.
While loading configurations from files, it's crucial to handle potential I/O errors. Consider wrapping the file operations in a try-except block to catch and handle exceptions like FileNotFoundError
or PermissionError
.
+ try:
+ params_cfg = OmegaConf.load(cfg.params_config)
+ except Exception as e:
+ print(f"Error loading params config: {e}")
+ return None
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 __init__(self, cfg: DictConfig, params_cfg: DictConfig = None): | |
"""Initialize the class with config from hydra/omega conf. | |
First uses `base_param` file then overwrites with specific `params_config`. | |
Args: | |
cfg: The `DictConfig` containing all the hyperparameters needed for | |
training/evaluation. | |
params_cfg: The `DictConfig` containing subset of hyperparameters to override. | |
training/evaluation | |
""" | |
base_cfg = cfg | |
print(f"Base Config: {cfg}") | |
if "params_config" in cfg: | |
# merge configs | |
params_config = OmegaConf.load(cfg.params_config) | |
pprint(f"Overwriting base config with {params_config}") | |
self.cfg = OmegaConf.merge(base_cfg, params_config) | |
params_cfg = OmegaConf.load(cfg.params_config) | |
if params_cfg: | |
pprint(f"Overwriting base config with {params_cfg}") | |
self.cfg = OmegaConf.merge(base_cfg, params_cfg) # merge configs | |
else: | |
# just use base config | |
self.cfg = base_cfg | |
self.cfg = cfg | |
def __init__(self, cfg: DictConfig, params_cfg: DictConfig = None): | |
"""Initialize the class with config from hydra/omega conf. | |
First uses `base_param` file then overwrites with specific `params_config`. | |
Args: | |
cfg: The `DictConfig` containing all the hyperparameters needed for | |
training/evaluation. | |
params_cfg: The `DictConfig` containing subset of hyperparameters to override. | |
training/evaluation | |
""" | |
base_cfg = cfg | |
print(f"Base Config: {cfg}") | |
if "params_config" in cfg: | |
try: | |
params_cfg = OmegaConf.load(cfg.params_config) | |
except Exception as e: | |
print(f"Error loading params config: {e}") | |
return None | |
if params_cfg: | |
pprint(f"Overwriting base config with {params_cfg}") | |
self.cfg = OmegaConf.merge(base_cfg, params_cfg) # merge configs | |
else: | |
self.cfg = cfg |
@@ -3,88 +3,13 @@ | |||
import torch | |||
import pytest |
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 unused imports to clean up the code.
- import pytest
- from omegaconf import DictConfig
Also applies to: 7-7
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.
import pytest |
Tools
Ruff
4-4:
pytest
imported but unused
print(f"Pod Index: {index}") | ||
|
||
checkpoints = pd.read_csv(cfg.checkpoints) | ||
checkpoint = checkpoints.iloc[index] | ||
else: | ||
checkpoint = pred_cfg.get_ckpt_path() | ||
checkpoint = pred_cfg.cfg.ckpt_path | ||
|
||
model = GTRRunner.load_from_checkpoint(checkpoint) | ||
tracker_cfg = pred_cfg.get_tracker_cfg() | ||
print("Updating tracker hparams") | ||
model.tracker_cfg = tracker_cfg | ||
print(f"Using the following params for tracker:") |
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 f-string.
- print(f"Using the following params for tracker:")
+ print("Using the following params for tracker:")
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.
print(f"Using the following params for tracker:") | |
print("Using the following params for tracker:") |
Tools
Ruff
118-118: f-string without any placeholders
@@ -11,6 +11,7 @@ | |||
import pandas as pd | |||
import pytorch_lightning as pl | |||
import torch | |||
import sleap_io as sio | |||
|
|||
|
|||
def export_trajectories(frames_pred: list["biogtr.io.Frame"], save_path: str = None): |
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.
Fix undefined name error.
- from biogtr.io import Config
+ from biogtr.io import Config, Frame
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 export_trajectories(frames_pred: list["biogtr.io.Frame"], save_path: str = None): | |
from biogtr.io import Config, Frame | |
def export_trajectories(frames_pred: list["biogtr.io.Frame"], save_path: str = None): |
Tools
Ruff
17-17: Undefined name
biogtr
Its been a while since I updated the inference script so here I've updated it to work with our API
python track.py --config_dir=[PATH TO CONFIG] --config-name=[CONFIG NAME]
and it will save each vid as a .slp fileSummary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests