It is well known that different batteries have different discharge curves (see
https://blog.lexa.ru/2017/04/03/o_sortah_lp_e6.html for some examples—text is in Russian but plots are quite self-explanatory). This fact leads to errors in predicting remaining battery life.
My idea is to calibrate batteries by measuring their actual characteristics and storing them, say, in ML config file. It would be possible if a battery has any unique ID readable by ML. The workflow for calibration may be as following:
1. Fully charge a battery.
2. Put camera in some special calibration mode—discharge the battery in a controlled manner and write its properties to file.
3. When a battery is exhausted, the calibration is complete.
4. Repeat for all batteries in use with the camera.
5. Copy config to all memory cards in use with the camera.
This approach allows not only to show correct percentage values but also to estimate an approximate remaining time of the battery operation.