When using TensorRT to speed up computer vision models, the key metrics to watch are inference latency and throughput. Latency means how fast the model gives a result for one image. Throughput means how many images the model can process in a second. These metrics matter because TensorRT aims to make models run faster on GPUs without losing accuracy. We also check if the accuracy stays the same after acceleration to ensure the model still makes good predictions.
TensorRT acceleration in Computer Vision - Model Metrics & Evaluation
TensorRT acceleration does not change the confusion matrix directly because it speeds up the model but does not change predictions if done correctly. Here is an example confusion matrix from a computer vision model before and after TensorRT acceleration:
Before TensorRT:
TP=90 FP=10
FN=15 TN=85
After TensorRT:
TP=90 FP=10
FN=15 TN=85
The numbers stay the same, showing no loss in prediction quality.
TensorRT focuses on speed, not changing precision or recall. But sometimes, small changes in model precision or recall can happen if the model is converted incorrectly. For example, if precision drops, the model makes more false alarms. If recall drops, it misses more true cases. The goal is to keep precision and recall stable while improving speed.
Example:
- Original model: Precision = 0.90, Recall = 0.85, Latency = 100 ms
- TensorRT model: Precision = 0.90, Recall = 0.85, Latency = 30 ms
This shows a big speed gain without hurting precision or recall.
Good:
- Latency reduced by 2-4 times or more
- Throughput increased proportionally
- Accuracy, precision, recall unchanged or very close (within 1%)
Bad:
- Latency barely improved or slower
- Throughput unchanged or worse
- Accuracy drops by more than 2-3%
- Precision or recall drops significantly, causing wrong or missed detections
- Data leakage: Testing speed on different hardware than deployment can mislead results.
- Overfitting to speed: Optimizing only for latency might cause accuracy loss.
- Ignoring batch size: Speed gains depend on batch size; small batches may not show improvement.
- Incorrect precision mode: Using lower precision (FP16 or INT8) without calibration can reduce accuracy.
- Not validating outputs: Assuming TensorRT outputs match original model without checking can hide errors.
Your model has 98% accuracy but after TensorRT acceleration, recall on a key class drops to 12%. Is it good for production? Why or why not?
Answer: No, it is not good. Even though overall accuracy is high, a recall of 12% means the model misses most true cases of that class. This is critical in applications like defect detection or medical imaging where missing true cases is costly. TensorRT acceleration should not cause such a big drop in recall.