parameters: (self, sample_data_token: str)
return_statement: return boxes
docstring: Instantiates Boxes for all annotation for a particular sample_data record. If the sample_data is a
          keyframe, this returns the annotations for that sample. But if the sample_data is an intermediate
          sample_data, a linear interpolation is applied to estimate the location of the boxes at the time the
          sample_data was captured.
          :param sample_data_token: Unique sample_data identifier.
docstring_summary: Instantiates Boxes for all annotation for a particular sample_data record. If the sample_data is a
          keyframe, this returns the annotations for that sample. But if the sample_data is an intermediate
          sample_data, a linear interpolation is applied to estimate the location of the boxes at the time the
          sample_data was captured.
          :param sample_data_token: Unique sample_data identifier.
docstring_tokens: Instantiates Boxes for all annotation for a particular sample_data record . If the sample_data is a keyframe this returns the annotations for that sample . But if the sample_data is an intermediate sample_data a linear interpolation is applied to estimate the location of the boxes at the time the sample_data was captured . : param sample_data_token : Unique sample_data identifier .
function: def get_boxes(self, sample_data_token: str) -> List[Box]:
          """
          Instantiates Boxes for all annotation for a particular sample_data record. If the sample_data is a
          keyframe, this returns the annotations for that sample. But if the sample_data is an intermediate
          sample_data, a linear interpolation is applied to estimate the location of the boxes at the time the
          sample_data was captured.
          :param sample_data_token: Unique sample_data identifier.
          """
  
          # Retrieve sensor & pose records
          sd_record = self.get('sample_data', sample_data_token)
          curr_sample_record = self.get('sample', sd_record['sample_token'])
  
          if curr_sample_record['prev'] == "" or sd_record['is_key_frame']:
              # If no previous annotations available, or if sample_data is keyframe just return the current ones.
              boxes = list(map(self.get_box, curr_sample_record['anns']))
  
          else:
              prev_sample_record = self.get('sample', curr_sample_record['prev'])
  
              curr_ann_recs = [self.get('sample_annotation', token) for token in curr_sample_record['anns']]
              prev_ann_recs = [self.get('sample_annotation', token) for token in prev_sample_record['anns']]
  
              # Maps instance tokens to prev_ann records
              prev_inst_map = {entry['instance_token']: entry for entry in prev_ann_recs}
  
              t0 = prev_sample_record['timestamp']
              t1 = curr_sample_record['timestamp']
              t = sd_record['timestamp']
  
              # There are rare situations where the timestamps in the DB are off so ensure that t0 < t < t1.
              t = max(t0, min(t1, t))
  
              boxes = []
              for curr_ann_rec in curr_ann_recs:
  
                  if curr_ann_rec['instance_token'] in prev_inst_map:
                      # If the annotated instance existed in the previous frame, interpolate center & orientation.
                      prev_ann_rec = prev_inst_map[curr_ann_rec['instance_token']]
  
                      # Interpolate center.
                      center = [np.interp(t, [t0, t1], [c0, c1]) for c0, c1 in zip(prev_ann_rec['translation'],
                                                                                   curr_ann_rec['translation'])]
  
                      # Interpolate orientation. (There is a bug in pyquaternion.slerp() so use external method.)
                      rotation = Quaternion(quaternion_slerp(np.array(prev_ann_rec['rotation']),
                                                             np.array(curr_ann_rec['rotation']),
                                                             (t - t0) / (t1 - t0)))
  
                      box = Box(center, curr_ann_rec['size'], rotation, name=curr_ann_rec['category_name'])
                  else:
                      # If not, simply grab the current annotation.
                      box = self.get_box(curr_ann_rec['token'])
  
                  boxes.append(box)
          return boxes
function_tokens: def get_boxes ( self , sample_data_token : str ) -> List [ Box ] : # Retrieve sensor & pose records sd_record = self . get ( 'sample_data' , sample_data_token ) curr_sample_record = self . get ( 'sample' , sd_record [ 'sample_token' ] ) if curr_sample_record [ 'prev' ] == "" or sd_record [ 'is_key_frame' ] : # If no previous annotations available, or if sample_data is keyframe just return the current ones. boxes = list ( map ( self . get_box , curr_sample_record [ 'anns' ] ) ) else : prev_sample_record = self . get ( 'sample' , curr_sample_record [ 'prev' ] ) curr_ann_recs = [ self . get ( 'sample_annotation' , token ) for token in curr_sample_record [ 'anns' ] ] prev_ann_recs = [ self . get ( 'sample_annotation' , token ) for token in prev_sample_record [ 'anns' ] ] # Maps instance tokens to prev_ann records prev_inst_map = { entry [ 'instance_token' ] : entry for entry in prev_ann_recs } t0 = prev_sample_record [ 'timestamp' ] t1 = curr_sample_record [ 'timestamp' ] t = sd_record [ 'timestamp' ] # There are rare situations where the timestamps in the DB are off so ensure that t0 < t < t1. t = max ( t0 , min ( t1 , t ) ) boxes = [ ] for curr_ann_rec in curr_ann_recs : if curr_ann_rec [ 'instance_token' ] in prev_inst_map : # If the annotated instance existed in the previous frame, interpolate center & orientation. prev_ann_rec = prev_inst_map [ curr_ann_rec [ 'instance_token' ] ] # Interpolate center. center = [ np . interp ( t , [ t0 , t1 ] , [ c0 , c1 ] ) for c0 , c1 in zip ( prev_ann_rec [ 'translation' ] , curr_ann_rec [ 'translation' ] ) ] # Interpolate orientation. (There is a bug in pyquaternion.slerp() so use external method.) rotation = Quaternion ( quaternion_slerp ( np . array ( prev_ann_rec [ 'rotation' ] ) , np . array ( curr_ann_rec [ 'rotation' ] ) , ( t - t0 ) / ( t1 - t0 ) ) ) box = Box ( center , curr_ann_rec [ 'size' ] , rotation , name = curr_ann_rec [ 'category_name' ] ) else : # If not, simply grab the current annotation. box = self . get_box ( curr_ann_rec [ 'token' ] ) boxes . append ( box ) return boxes