@@ -210,7 +210,7 @@ class ImplicitronDatasetBase(torch.utils.data.Dataset[FrameData]):
210210 # Maps sequence name to the sequence's global frame indices.
211211 # It is used for the default implementations of some functions in this class.
212212 # 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 )
214214
215215 def __len__ (self ) -> int :
216216 raise NotImplementedError
@@ -223,7 +223,7 @@ def get_frame_numbers_and_timestamps(
223223 unordered views, then the dataset should override this method to
224224 return the index and timestamp in their videos of the frames whose
225225 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.
227227 If timestamps are absent, they should be replaced with a constant.
228228
229229 This is used for letting SceneBatchSampler identify consecutive
@@ -244,7 +244,7 @@ def get_eval_batches(self) -> Optional[List[List[int]]]:
244244
245245 def sequence_names (self ) -> Iterable [str ]:
246246 """Returns an iterator over sequence names in the dataset."""
247- return self .seq_to_idx .keys ()
247+ return self ._seq_to_idx .keys ()
248248
249249 def sequence_frames_in_order (
250250 self , seq_name : str
@@ -262,7 +262,7 @@ def sequence_frames_in_order(
262262 `dataset_idx` is the index within the dataset.
263263 `None` timestamps are replaced with 0s.
264264 """
265- seq_frame_indices = self .seq_to_idx [seq_name ]
265+ seq_frame_indices = self ._seq_to_idx [seq_name ]
266266 nos_timestamps = self .get_frame_numbers_and_timestamps (seq_frame_indices )
267267
268268 yield from sorted (
@@ -411,7 +411,7 @@ def seq_frame_index_to_dataset_index(
411411 self .frame_annots [idx ]["frame_annotation" ].frame_number : idx
412412 for idx in seq_idx
413413 }
414- for seq , seq_idx in self .seq_to_idx .items ()
414+ for seq , seq_idx in self ._seq_to_idx .items ()
415415 }
416416
417417 def _get_batch_idx (seq_name , frame_no , path = None ) -> int :
@@ -804,7 +804,7 @@ def positive_mass(frame_annot: types.FrameAnnotation) -> bool:
804804 if self .n_frames_per_sequence > 0 :
805805 print (f"Taking max { self .n_frames_per_sequence } per sequence." )
806806 keep_idx = []
807- for seq , seq_indices in self .seq_to_idx .items ():
807+ for seq , seq_indices in self ._seq_to_idx .items ():
808808 # infer the seed from the sequence name, this is reproducible
809809 # and makes the selection differ for different sequences
810810 seed = _seq_name_to_seed (seq ) + self .seed
@@ -826,20 +826,20 @@ def positive_mass(frame_annot: types.FrameAnnotation) -> bool:
826826 self ._invalidate_indexes (filter_seq_annots = True )
827827
828828 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
831831 self ._invalidate_seq_to_idx ()
832832
833833 if filter_seq_annots :
834834 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
836836 }
837837
838838 def _invalidate_seq_to_idx (self ) -> None :
839839 seq_to_idx = defaultdict (list )
840840 for idx , entry in enumerate (self .frame_annots ):
841841 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
843843
844844 def _resize_image (
845845 self , image , mode = "bilinear"
0 commit comments