@@ -210,7 +210,7 @@ class ImplicitronDatasetBase(torch.utils.data.Dataset[FrameData]):
210
210
# Maps sequence name to the sequence's global frame indices.
211
211
# It is used for the default implementations of some functions in this class.
212
212
# Implementations which override them are free to ignore this member.
213
- seq_to_idx : Dict [str , List [int ]] = field (init = False )
213
+ _seq_to_idx : Dict [str , List [int ]] = field (init = False )
214
214
215
215
def __len__ (self ) -> int :
216
216
raise NotImplementedError
@@ -223,7 +223,7 @@ def get_frame_numbers_and_timestamps(
223
223
unordered views, then the dataset should override this method to
224
224
return the index and timestamp in their videos of the frames whose
225
225
indices are given in `idxs`. In addition,
226
- the values in seq_to_idx should be in ascending order.
226
+ the values in _seq_to_idx should be in ascending order.
227
227
If timestamps are absent, they should be replaced with a constant.
228
228
229
229
This is used for letting SceneBatchSampler identify consecutive
@@ -244,7 +244,7 @@ def get_eval_batches(self) -> Optional[List[List[int]]]:
244
244
245
245
def sequence_names (self ) -> Iterable [str ]:
246
246
"""Returns an iterator over sequence names in the dataset."""
247
- return self .seq_to_idx .keys ()
247
+ return self ._seq_to_idx .keys ()
248
248
249
249
def sequence_frames_in_order (
250
250
self , seq_name : str
@@ -262,7 +262,7 @@ def sequence_frames_in_order(
262
262
`dataset_idx` is the index within the dataset.
263
263
`None` timestamps are replaced with 0s.
264
264
"""
265
- seq_frame_indices = self .seq_to_idx [seq_name ]
265
+ seq_frame_indices = self ._seq_to_idx [seq_name ]
266
266
nos_timestamps = self .get_frame_numbers_and_timestamps (seq_frame_indices )
267
267
268
268
yield from sorted (
@@ -411,7 +411,7 @@ def seq_frame_index_to_dataset_index(
411
411
self .frame_annots [idx ]["frame_annotation" ].frame_number : idx
412
412
for idx in seq_idx
413
413
}
414
- for seq , seq_idx in self .seq_to_idx .items ()
414
+ for seq , seq_idx in self ._seq_to_idx .items ()
415
415
}
416
416
417
417
def _get_batch_idx (seq_name , frame_no , path = None ) -> int :
@@ -804,7 +804,7 @@ def positive_mass(frame_annot: types.FrameAnnotation) -> bool:
804
804
if self .n_frames_per_sequence > 0 :
805
805
print (f"Taking max { self .n_frames_per_sequence } per sequence." )
806
806
keep_idx = []
807
- for seq , seq_indices in self .seq_to_idx .items ():
807
+ for seq , seq_indices in self ._seq_to_idx .items ():
808
808
# infer the seed from the sequence name, this is reproducible
809
809
# and makes the selection differ for different sequences
810
810
seed = _seq_name_to_seed (seq ) + self .seed
@@ -826,20 +826,20 @@ def positive_mass(frame_annot: types.FrameAnnotation) -> bool:
826
826
self ._invalidate_indexes (filter_seq_annots = True )
827
827
828
828
def _invalidate_indexes (self , filter_seq_annots : bool = False ) -> None :
829
- # update seq_to_idx and filter seq_meta according to frame_annots change
830
- # if filter_seq_annots, also uldates seq_annots based on the changed seq_to_idx
829
+ # update _seq_to_idx and filter seq_meta according to frame_annots change
830
+ # if filter_seq_annots, also uldates seq_annots based on the changed _seq_to_idx
831
831
self ._invalidate_seq_to_idx ()
832
832
833
833
if filter_seq_annots :
834
834
self .seq_annots = {
835
- k : v for k , v in self .seq_annots .items () if k in self .seq_to_idx
835
+ k : v for k , v in self .seq_annots .items () if k in self ._seq_to_idx
836
836
}
837
837
838
838
def _invalidate_seq_to_idx (self ) -> None :
839
839
seq_to_idx = defaultdict (list )
840
840
for idx , entry in enumerate (self .frame_annots ):
841
841
seq_to_idx [entry ["frame_annotation" ].sequence_name ].append (idx )
842
- self .seq_to_idx = seq_to_idx
842
+ self ._seq_to_idx = seq_to_idx
843
843
844
844
def _resize_image (
845
845
self , image , mode = "bilinear"
0 commit comments