(id, res, weights, params)
| 63 | |
| 64 | |
| 65 | def process_single_id(id, res, weights, params): |
| 66 | run_type = params['run_type'] |
| 67 | verbose = params['verbose'] |
| 68 | |
| 69 | if verbose: |
| 70 | print('Go for ID: {}'.format(id)) |
| 71 | boxes_list = [] |
| 72 | scores_list = [] |
| 73 | labels_list = [] |
| 74 | labels_to_use_forward = dict() |
| 75 | labels_to_use_backward = dict() |
| 76 | |
| 77 | for i in range(len(res[id])): |
| 78 | boxes = [] |
| 79 | scores = [] |
| 80 | labels = [] |
| 81 | |
| 82 | dt = res[id][i] |
| 83 | if str(dt) == 'nan': |
| 84 | boxes = np.zeros((0, 4), dtype=np.float32) |
| 85 | scores = np.zeros((0, ), dtype=np.float32) |
| 86 | labels = np.zeros((0, ), dtype=np.int32) |
| 87 | boxes_list.append(boxes) |
| 88 | scores_list.append(scores) |
| 89 | labels_list.append(labels) |
| 90 | continue |
| 91 | |
| 92 | pred = dt.strip().split(' ') |
| 93 | |
| 94 | # Empty preds |
| 95 | if len(pred) <= 1: |
| 96 | boxes = np.zeros((0, 4), dtype=np.float32) |
| 97 | scores = np.zeros((0,), dtype=np.float32) |
| 98 | labels = np.zeros((0,), dtype=np.int32) |
| 99 | boxes_list.append(boxes) |
| 100 | scores_list.append(scores) |
| 101 | labels_list.append(labels) |
| 102 | continue |
| 103 | |
| 104 | # Check correctness |
| 105 | if len(pred) % 6 != 0: |
| 106 | print('Erorr % 6 {}'.format(len(pred))) |
| 107 | print(dt) |
| 108 | exit() |
| 109 | |
| 110 | for j in range(0, len(pred), 6): |
| 111 | lbl = pred[j] |
| 112 | scr = float(pred[j + 1]) |
| 113 | box_x1 = float(pred[j + 2]) |
| 114 | box_y1 = float(pred[j + 3]) |
| 115 | box_x2 = float(pred[j + 4]) |
| 116 | box_y2 = float(pred[j + 5]) |
| 117 | |
| 118 | if box_x1 >= box_x2: |
| 119 | if verbose: |
| 120 | print('Problem with box x1 and x2: {}. Skip it'.format(pred[j:j+6])) |
| 121 | continue |
| 122 | if box_y1 >= box_y2: |
nothing calls this directly
no test coverage detected