OpenDriveLab / UniAD

[CVPR'23 Best Paper Award] Planning-oriented Autonomous Driving
Apache License 2.0
3.11k stars 335 forks source link

Question about tracker.py & performance #167

Open Valerianding opened 4 months ago

Valerianding commented 4 months ago

Hi ! Thanks for your great work.

After reading your paper, I was interested in the performance of UniAD. And I used nvidia Nsight System to profile the model and found there is a period which both compute and memory throughput is very low. (only about 5%).

And The stack trace shows it might be something perform inefficiently with ~/UniAD/projects/mmdet3d_plugin/uniad/dense_heads/track_head_plugin/tracker.py。 I look into the code and found somthing i can't understand: the parameter "iou_thre" is set to be None and also passed None when the function is called.

And within this function it doesn't update iou_thre. So what's the point of parameter "iou_thre" and the code following if iou_thre is not None ...

Is there somthing I missed? Can You help me? Thanks a lot! (ps: This is my first time to write a issue, so feel free to point out any mistakes or stupid things i have done. Thx).

The following is the result of performance from the overall view

Screen Shot 2024-02-28 at 7 35 01 PM
Valerianding commented 4 months ago

Hi, @YTEP-ZHI I actually insert a assert False in the if,as below:

   def update(self, track_instances: Instances, iou_thre=None):
        track_instances.disappear_time[track_instances.scores >= self.score_thresh] = 0
        for i in range(len(track_instances)):
            print(len(track_instances))
            if (
                track_instances.obj_idxes[i] == -1
                and track_instances.scores[i] >= self.score_thresh
            ):  
                if iou_thre is not None and track_instances.pred_boxes[track_instances.obj_idxes>=0].shape[0]!=0:
                    assert False #WITHOUT GOING WRONG
                    iou3ds = iou_3d(denormalize_bbox(track_instances.pred_boxes[i].unsqueeze(0), None)[...,:7], denormalize_bbox(track_instances.pred_boxes[track_instances.obj_idxes>=0], None)[...,:7])
                    if iou3ds.max()>iou_thre:
                        continue
                # new track
                # print("track {} has score {}, assign obj_id {}".format(i, track_instances.scores[i], self.max_obj_id))
                track_instances.obj_idxes[i] = self.max_obj_id
                self.max_obj_id += 1
            elif (
                track_instances.obj_idxes[i] >= 0
                and track_instances.scores[i] < self.filter_score_thresh
            ):
                # sleep time ++
                track_instances.disappear_time[i] += 1
                if track_instances.disappear_time[i] >= self.miss_tolerance:
                    # mark deaded tracklets: Set the obj_id to -1.
                    # TODO: remove it by following functions
                    # Then this track will be removed by TrackEmbeddingLayer.
                    track_instances.obj_idxes[i] = -1

And it didn't goes wrong. so Is it possible we can remove this code? or is something wrong?