Processes the video sequence given and provides the output of tracking result (write the results in video file) It uses JDE model for getting information about the online targets present. Parameters ---------- opt : Namespace Contains information pa
(opt, dataloader, data_type, result_filename, save_dir=None, show_image=True, frame_rate=30)
| 40 | |
| 41 | |
| 42 | def eval_seq(opt, dataloader, data_type, result_filename, save_dir=None, show_image=True, frame_rate=30): |
| 43 | ''' |
| 44 | Processes the video sequence given and provides the output of tracking result (write the results in video file) |
| 45 | |
| 46 | It uses JDE model for getting information about the online targets present. |
| 47 | |
| 48 | Parameters |
| 49 | ---------- |
| 50 | opt : Namespace |
| 51 | Contains information passed as commandline arguments. |
| 52 | |
| 53 | dataloader : LoadVideo |
| 54 | Instance of LoadVideo class used for fetching the image sequence and associated data. |
| 55 | |
| 56 | data_type : String |
| 57 | Type of dataset corresponding(similar) to the given video. |
| 58 | |
| 59 | result_filename : String |
| 60 | The name(path) of the file for storing results. |
| 61 | |
| 62 | save_dir : String |
| 63 | Path to the folder for storing the frames containing bounding box information (Result frames). |
| 64 | |
| 65 | show_image : bool |
| 66 | Option for shhowing individial frames during run-time. |
| 67 | |
| 68 | frame_rate : int |
| 69 | Frame-rate of the given video. |
| 70 | |
| 71 | Returns |
| 72 | ------- |
| 73 | (Returns are not significant here) |
| 74 | frame_id : int |
| 75 | Sequence number of the last sequence |
| 76 | ''' |
| 77 | |
| 78 | if save_dir: |
| 79 | mkdir_if_missing(save_dir) |
| 80 | tracker = BYTETracker(opt, frame_rate=frame_rate) |
| 81 | timer = Timer() |
| 82 | results = [] |
| 83 | len_all = len(dataloader) |
| 84 | start_frame = int(len_all / 2) |
| 85 | frame_id = int(len_all / 2) |
| 86 | for i, (path, img, img0) in enumerate(dataloader): |
| 87 | if i < start_frame: |
| 88 | continue |
| 89 | if frame_id % 20 == 0: |
| 90 | logger.info('Processing frame {} ({:.2f} fps)'.format(frame_id, 1./max(1e-5, timer.average_time))) |
| 91 | |
| 92 | # run tracking |
| 93 | timer.tic() |
| 94 | blob = torch.from_numpy(img).cuda().unsqueeze(0) |
| 95 | online_targets = tracker.update(blob, img0) |
| 96 | online_tlwhs = [] |
| 97 | online_ids = [] |
| 98 | for t in online_targets: |
| 99 | tlwh = t.tlwh |
no test coverage detected