Skip to content

Instantly share code, notes, and snippets.

@damanm24
Created October 27, 2021 18:34
Show Gist options
  • Save damanm24/cbbe1a276d58a0ff8d72ad5ceb9eb2ae to your computer and use it in GitHub Desktop.
Save damanm24/cbbe1a276d58a0ff8d72ad5ceb9eb2ae to your computer and use it in GitHub Desktop.
from scheduling.misc import *
from scheduling.TaskEntity import *
# read the input bounding box data from file
box_info = read_json_file('../dataset/waymo_ground_truth_flat.json')
frame_num = 0
boxes = {}
def skip(box):
global frame_num
for tuple in boxes.keys():
diffx = abs(box[0] - tuple[0])
diffy = abs(box[1] - tuple[1])
if diffx + diffy < 5:
if frame_num - boxes[tuple] < 10:
return True
else:
boxes.pop(tuple)
boxes[(box[0], box[1])] = frame_num
boxes[(box[0], box[1])] = frame_num
return False
def process_frame(frame):
"""Process frame for scheduling.
Process a image frame to obtain cluster boxes and corresponding scheduling parameters
for scheduling.
Student's code here.
Args:
param1: The image frame to be processed.
Returns:
A list of tasks with each task containing image_path and other necessary information.
"""
cluster_boxes_data = get_bbox_info(frame, box_info)
cluster_boxes_data.sort(key=lambda x : x[4])
task_list = []
# student's code here
for i in range(len(cluster_boxes_data)):
if skip(cluster_boxes_data[i]):
continue
task_list.append(TaskEntity(image_path=frame.path, coord=box[:4], priority=i, depth=box[4]))
global frame_num
frame_num += 1
return task_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment