0
$\begingroup$

I'm currently training my own object detection TFLite model using the TFLite model maker. Theres a variable you can set called 'tflite_max_detections', which is by default set to 25.

Does anyone know if decreasing this value has any impact on the models performance or does it have any positive side effect I should know about? For my use case it would actually be fine, if I would set it to 1, thats why I'm asking.

$\endgroup$

3 Answers 3

1
+50
$\begingroup$

Decreasing tflite_max_detections does not have inherent positive or negative consequences, with the exception that lower values may result in slightly faster inference times. This is something you would have to test to determine whether it is a significant difference in your case; I have never found it to be significant in my own use.

A higher value will allow your model to detect more objects in a single image. If you have an upper bound for the number of objects in an image which you know will not be exceeded, you can use this information to inform your chosen value.

TFLite will discard objects beyond the maximum using a global non-maximum suppression (NMS) algorithm which is designed to be fast but is not as accurate as per-class NMS. This should mean that the surviving objects are the ones most likely to be accurate detections, making it relatively safe to reduce the maximum without losing high-likelihood detections. NMS is based on a combination of the model confidence and factors like overlap with other detections (if two bounding boxes heavily overlap, NMS is likely to remove one of them). Note: the linked NMS function is not exactly what TFLite uses, only an example.

It may not always be as simple as setting the value to your known upper bound exactly as models can erroneously detect objects which are not present.

A hypothetical: if your image has only one object which the model has detected with middling confidence, but the model has also detected one false positive with high confidence, and your maximum is set to 1, the model may only output the false positive. With the maximum set to 2, it may output the false positive and the true positive. Conversely if the maximum is set high, false positives might make it through which would otherwise have been filtered out by NMS.

The decision of where to set the maximum is therefore dependent on your needs and the reliability of your model.

$\endgroup$
1
$\begingroup$

The impact that the number of tflite_max_detections (the max number of output detections in the TFLite model) has is an empirical question best answered through cross-validation. It will probably vary based on the dataset and the goal of the modeling.

$\endgroup$
1
$\begingroup$

tflite_max_detections : The max number of output detections in the TFLite model.

The tflite_max_detections variable determines the maximum number of detections that the TFLite model will output. By default, it is set to 25 to ensure that the model is able to detect a wide range of objects in an image. In other words, it determines how many objects the model will return in its output.

Decreasing the tflite_max_detections variable will likely reduce the performance of the model, as the model will be able to detect fewer objects in an image. A lower number of detections may result in fewer objects being detected in an image, which could lead to a decrease in accuracy and precision. This may not be a problem for your use case, but you should keep in mind that the model will not be able to detect more than the maximum number of objects that you set.

In general, it's a good idea to set the tflite_max_detections variable to a value that is appropriate for your use case. If you don't need the model to detect more than a certain number of objects, then setting the tflite_max_detections variable to that value can help improve the performance of the model. However, if you do need the model to be able to detect more objects, then you should set the tflite_max_detections variable to a higher value.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.