photonvision icon indicating copy to clipboard operation
photonvision copied to clipboard

Properly serialize ML models

Open mcm001 opened this issue 1 year ago • 4 comments

Actually use the whole models folder for things. Expose a way to CRUD new model files and change their type in a card in the UI, and allow object detection pipelines to choose between different models.

In the backend, we could store models as binary blobs inside a new sql database, or in the models folder and keep a list of (model path, parameters) in the main config database. Or something new I haven't thought of

mcm001 avatar Feb 01 '24 19:02 mcm001

How are models structures? Is there any performance/quality loss if we blob them into the database? Implementing this into the UI should be fairly trivial (don't quote me)

srimanachanta avatar Feb 02 '24 02:02 srimanachanta

They're just binary blobs of (sometimes several MB of) data. No quality loss in a database, just the tradeoff of increased filesystem robustness vs slowness.

mcm001 avatar Feb 02 '24 02:02 mcm001

But yeah the frontend seems to be super straightforward of a project as things go. I'll try sql first and if that's too slow, move to files in a folder?

mcm001 avatar Feb 02 '24 04:02 mcm001

Backend recipe proposal:

The current sql db can store a list of known ML model relative paths and their type/backend. On startup the NNModelManager can add any new ones that appear as UNKNOWN or something as well. Users would be able to see the model name in the UI and set the backend (eg RKNN) and type (eg, YOLOV5)

mcm001 avatar Feb 05 '24 13:02 mcm001

Duplicate of #1748

samfreund avatar Feb 09 '25 16:02 samfreund