You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked your box_processing_differance.py. I find out the code complicated. So, I simplified.
defload_box_events(metadata, batch_start_time, duration):
ending=metadata.get_ending()
box_path='_bbox.npy'.join(metadata.path.rsplit(ending, 1))
box_events=np.load(box_path)
# Filter out the events that are outside the desired time framebox_events=box_events[(box_events['t'] >=batch_start_time) & (box_events['t'] <batch_start_time+duration)]
# Initialize the list to hold output event dataout_list= []
# Define the new class_ids for the featuresclass_ids= {
'face_bbox': 0, # Assuming 'face_bbox' is for face'x0y0': 1, # Assuming 'x0y0' is for lip'x1y1': 2, # Assuming 'x1y1' is for eye1'x2y2': 3, # Assuming 'x2y2' is for eye2'x3y3': 4, # Assuming 'x3y3' is for nose'x4y4': 5, # Assuming 'x4y4' is for lips
}
# Define the dtype for the structured arrayout_dtype=np.dtype([
('t', '<i8'), ('x', '<f4'), ('y', '<f4'), ('w', '<f4'), ('h', '<f4'),
('class_id', '<u4'), ('track_id', '<u4'), ('class_confidence', '<f4')
])
# Process each event and create a separate record for each featureforeventinbox_events:
# First add the face bbox eventface_bbox_event= (event['t'], event['x'], event['y'], event['w'], event['h'], class_ids['face_bbox'], event['track_id'], event['class_confidence'])
out_list.append(face_bbox_event)
# Now add the feature eventsforfeaturein ['x0y0', 'x1y1', 'x2y2', 'x3y3', 'x4y4']:
class_id=class_ids[feature]
x_key, y_key=feature[:2], feature[2:]
feature_event= (event['t'],
event[x_key] - ((event['w'] /3) /2),
event[y_key] - ((event['h'] /4) /2),
event['w'] /3,
event['h'] /4,
class_id,
event['track_id'],
event['class_confidence'])
out_list.append(feature_event)
# Now convert out_list to a structured arrayout=np.array(out_list, dtype=out_dtype)
returnout
The text was updated successfully, but these errors were encountered:
I checked your box_processing_differance.py. I find out the code complicated. So, I simplified.
The text was updated successfully, but these errors were encountered: