Closed aaprasad closed 4 months ago
This update introduces significant enhancements to the biogtr
module, focusing on refining the handling of instances within frames. Key changes include the addition of a _frame
attribute to the Instance
class, updates to the Frame
class to manage instance attributes, and modifications to various methods to operate on instances instead of frames. Additionally, new utility functions were added to handle bounding box and time extraction, and several methods were refactored for improved clarity and performance.
File(s) | Change Summary |
---|---|
biogtr/data_structures.py |
Added _frame attribute and frame property to Instance ; modified Frame class to set frame attribute for each Instance ; updated Frame.__repr__ and Frame.instances setter. |
biogtr/inference/tracker.py |
Updated sliding_inference and _run_global_tracker methods to operate on instances instead of frames. |
biogtr/models/global_tracking_transformer.py |
Refactored to use torch.nn.Module ; updated forward method to accept ref_instances and query_instances ; added extract_features method. |
biogtr/models/gtr_runner.py |
Modified forward , training_step , validation_step , test_step , predict_step , and _shared_eval_step methods to operate on instances; updated method signatures and processing logic. |
biogtr/models/model_utils.py |
Renamed get_boxes_times to get_boxes ; added get_times function; updated bounding box extraction to operate on instances. |
biogtr/models/transformer.py |
Replaced Frame with Instance and updated related functions; modified forward method to operate on instances. |
biogtr/training/losses.py |
Updated imports and logic to use get_boxes and get_times ; adjusted bounding box and time index extraction to work with instances. |
tests/test_models.py |
Modified test cases to reflect changes in argument passing and processing of instances within frames; updated iteration and return values accordingly. |
sequenceDiagram
participant User
participant Tracker
participant GlobalTrackingTransformer
participant GTRRunner
User->>Tracker: Call sliding_inference(device)
Tracker->>GlobalTrackingTransformer: Call forward(ref_instances, query_instances)
GlobalTrackingTransformer->>GTRRunner: Call extract_features(instances)
GTRRunner->>GlobalTrackingTransformer: Return extracted features
GlobalTrackingTransformer->>Tracker: Return tracking results
Tracker->>User: Return inference results
In the realm of code, where data flows, A rabbit hops, where logic grows. Instances now with frames align, Bounding boxes, times define. Transformations smooth and clear, Bringing enhancements, far and near. With every change, precision's cheer! 🐰✨
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?
Currently, at all levels we use
biogtr.Frame
as the base unit of data given to the models as an input. However, one of the core advantages of the Global Tracking Transformer is that it really associates detections. Thus, if we are able to just use detections as input into the model then at a higher level we can come up with more useful ways to group the instances when passing it into the model. Thus, here we refactor thebiogtr.models.GlobalTrackingTransformer
andbiogtr.models.Transformer
to take as input a set ofref_instances
and a set ofquery instances
. Thequery_instances
are used as an input into the decoder to associate against theref_instances
. One level up, inbiogtr.inference.Tracker
, we basically show an example of how we can group instances by frame against window.Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Refactor
Tests