-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluation of TP and TN for Tusimple #172
Comments
A brief intro: FP, FN, TP, and TN, are used lane-wise. These terms are similarly defined as any other F1 metrics. For each GT lane, the closest predicted lane is found, and the condition for TP is at least 85% points have a pixel distance within 20 pixels compared to GT. Also, they consider only 4 valid GT lanes in one image. @CSenthusiast01 For the exact logics, you better refer to the official evaluation codes for details here:
|
Hi @voldemortX, def bench(pred, gt, y_samples, running_time):
if any(len(p) != len(y_samples) for p in pred):
raise Exception('Format of lanes error.')
if running_time > 200 or len(gt) + 2 < len(pred):
return 0., 0., 1., 0., 0.
angles = [LaneEval.get_angle(np.array(x_gts), np.array(y_samples)) for x_gts in gt]
threshs = [LaneEval.pixel_thresh / np.cos(angle) for angle in angles]
line_accs = []
tp, fp, fn, tn = 0., 0., 0., 0.
matched = 0.
for x_gts, thresh in zip(gt, threshs):
accs = [LaneEval.line_accuracy(np.array(x_preds), np.array(x_gts), thresh) for x_preds in pred]
max_acc = np.max(accs) if len(accs) > 0 else 0.
if max_acc < LaneEval.pt_thresh:
fn += 1
else:
tp += 1 # for TP
matched += 1
line_accs.append(max_acc)
fp = len(pred) - matched
if len(gt) > 4 and fn > 0:
fn -= 1
tn = 4 - (tp + fp + fn) # for TN
s = sum(line_accs)
if len(gt) > 4:
s -= min(line_accs)
return s / max(min(4.0, len(gt)), 1.), fp / len(pred) if len(pred) > 0 else 0., fn / max(min(len(gt), 4.) , 1.), tp/len(pred), tn/max(min(len(gt), 4.) , 1.) Could you please check if this code is correct and give me some feedback? I appreciate your help and guidance. |
@CSenthusiast01 I think there is a problem about TN. Others seem to be correct, but you might want to check some balance, e.g., TP+FN=#GT |
Can we use an equation, perhaps involving the final TP, FN, and FP values, to determine the True Negatives (TN) at the conclusion of an evaluation, ensuring a balanced consideration among TP, FN, and the Ground Truth with something like |
I am not very good at math, but I believe it is possible. You should know GT is not necessarily 4 lanes, it could be 3 |
Would it be more accurate to replace the fixed value 4 with the length of the ground truth (len(gt))?" |
yes. You sure the equation is correct? |
@CSenthusiast01 On second thought, I don't think TN is well-defined here. Since we only have positive GT. |
Are there alternative approaches to determine the TN (True Negative) values for TuSimple? I'm curious if there are other methods, apart from mathematical computations, or if there are different strategies to acquire the negative Ground Truth values. Access to TN values would make plotting ROC curve and Confusion matrix easier. |
@CSenthusiast01 Unfortunately, there is no definition of GT negatives in a typical detection task. It does not affect the calculation of common metrics like F1. Confusion matrix is more of a thing for classification/segmentation tasks. |
Hello, I'm curious about calculating True Negatives (TN) within the bench method of lane.py, similar to how False Positives (FP) and False Negatives (FN) are computed. Could you please provide guidance on how to perform this calculation?
The text was updated successfully, but these errors were encountered: