-
Notifications
You must be signed in to change notification settings - Fork 85
[HAWKEYE] Add object_id to loader
#473
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,6 +73,13 @@ def get_identifier_variable(cls, player_tracking_data): | |
| return identifier | ||
| return object_id | ||
|
|
||
| @classmethod | ||
| def is_priority(cls, object_id): | ||
| if object_id in cls.PRIORITY_IDS: | ||
| return True | ||
| else: | ||
| return False | ||
|
|
||
|
|
||
| class HawkEyeDeserializer(TrackingDataDeserializer[HawkEyeInputs]): | ||
| def __init__( | ||
|
|
@@ -82,9 +89,12 @@ def __init__( | |
| limit: Optional[int] = None, | ||
| sample_rate: Optional[float] = None, | ||
| coordinate_system: Optional[Union[str, Provider]] = None, | ||
| object_id: Optional[str] = None, | ||
| ): | ||
| super().__init__(limit, sample_rate, coordinate_system) | ||
| self.object_id: HawkEyeObjectIdentifier = None | ||
| self.object_id: HawkEyeObjectIdentifier = ( | ||
| None if object_id is None else object_id | ||
|
Contributor
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. This is identical to self.object_id = object_id
Contributor
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. I also do not see where the user-provided
Contributor
Author
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. I'm running into some issues because I removed this branch, but the goal of the I'll redo this PR at some point. |
||
| ) | ||
| self.pitch_width = pitch_width | ||
| self.pitch_length = pitch_length | ||
|
|
||
|
|
@@ -270,17 +280,19 @@ def deserialize(self, inputs: HawkEyeInputs) -> TrackingDataset: | |
| with open_as_file(player_centroid_feed) as player_centroid_data_fp: | ||
| player_tracking_data = json.load(player_centroid_data_fp) | ||
|
|
||
| self.object_id = HawkEyeObjectIdentifier.get_identifier_variable( | ||
| _object_id = HawkEyeObjectIdentifier.get_identifier_variable( | ||
| player_tracking_data | ||
| ) | ||
| if HawkEyeObjectIdentifier.is_priority(_object_id): | ||
| self.object_id = _object_id | ||
|
|
||
| if frame_rate is None: | ||
| frame_rate = self.__infer_frame_rate(ball_tracking_data) | ||
|
|
||
| if not self._game_id: | ||
| self._game_id = ball_tracking_data["details"]["match"]["id"][ | ||
| self.object_id | ||
| ] | ||
| self._game_id = ball_tracking_data["details"]["match"][ | ||
| "id" | ||
| ].get(self.object_id, None) | ||
|
|
||
| # Parse the teams, players and periods. A value can be added by | ||
| # later feeds, but we will not overwrite existing values. | ||
|
|
||
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.
Can you add this to the docstring?