parameters: (cls, trajectory)
return_statement: return trajectory
docstring: label feature trajectory according to real future lane sequence in 3s
docstring_summary: label feature trajectory according to real future lane sequence in 3s
docstring_tokens: label feature trajectory according to real future lane sequence in 3s
function: def label(cls, trajectory):
          '''
          label feature trajectory according to real future lane sequence in 3s
          '''
          traj_len = len(trajectory)
          for i, fea in enumerate(trajectory):
              if not fea.HasField('lane') or \
                 not fea.lane.HasField('lane_feature'):
                  print("No lane feature, cancel labeling")
                  continue
  
              future_lane_ids = []
              for j in range(i, traj_len):
                  time_span = trajectory[j].timestamp - fea.timestamp
                  if time_span > param_fea['prediction_label_timeframe']:
                      break
                  if not trajectory[j].HasField('lane') or \
                     not trajectory[j].lane.HasField('lane_feature'):
                      continue
  
                  lane_id_j = trajectory[j].lane.lane_feature.lane_id
                  trajectory[i].label_update_time_delta = time_span
                  if lane_id_j in future_lane_ids:
                      continue
                  else:
                      future_lane_ids.append(lane_id_j)
  
              if len(future_lane_ids) < 1:
                  print("No lane id")
                  continue
  
              seq_size = len(fea.lane.lane_graph.lane_sequence)
              for j in range(seq_size):
                  seq = fea.lane.lane_graph.lane_sequence[j]
                  if len(seq.lane_segment) == 0:
                      continue
                  predict_lane_ids = []
                  for k in range(len(seq.lane_segment)):
                      if seq.lane_segment[k].HasField('lane_id'):
                          predict_lane_ids.append(seq.lane_segment[k].lane_id)
  
                  seq.label = cls.cmp_lane_seq(future_lane_ids, predict_lane_ids)
          return trajectory
function_tokens: def label ( cls , trajectory ) : traj_len = len ( trajectory ) for i , fea in enumerate ( trajectory ) : if not fea . HasField ( 'lane' ) or not fea . lane . HasField ( 'lane_feature' ) : print ( "No lane feature, cancel labeling" ) continue future_lane_ids = [ ] for j in range ( i , traj_len ) : time_span = trajectory [ j ] . timestamp - fea . timestamp if time_span > param_fea [ 'prediction_label_timeframe' ] : break if not trajectory [ j ] . HasField ( 'lane' ) or not trajectory [ j ] . lane . HasField ( 'lane_feature' ) : continue lane_id_j = trajectory [ j ] . lane . lane_feature . lane_id trajectory [ i ] . label_update_time_delta = time_span if lane_id_j in future_lane_ids : continue else : future_lane_ids . append ( lane_id_j ) if len ( future_lane_ids ) < 1 : print ( "No lane id" ) continue seq_size = len ( fea . lane . lane_graph . lane_sequence ) for j in range ( seq_size ) : seq = fea . lane . lane_graph . lane_sequence [ j ] if len ( seq . lane_segment ) == 0 : continue predict_lane_ids = [ ] for k in range ( len ( seq . lane_segment ) ) : if seq . lane_segment [ k ] . HasField ( 'lane_id' ) : predict_lane_ids . append ( seq . lane_segment [ k ] . lane_id ) seq . label = cls . cmp_lane_seq ( future_lane_ids , predict_lane_ids ) return trajectory