Foreground Detector - how do I save/load an existing background model?

8 ビュー (過去 30 日間)
Jonathan
Jonathan 2014 年 10 月 14 日
コメント済み: Birju Patel 2018 年 4 月 16 日
Hi all, I am trying to come up with a way of saving and re-loading the Gaussian mixture model generated by the vision.ForegroundDetector. Basically I want to be able to:
  • Run the foreground detector
  • Train it on an empty scene to learn the background of the scene
  • SAVE this trained foreground detector so that I can use it in the future without re-training
  • LOAD this trained foreground detector and use it on new data.
Would anyone have any idea how this can be done? I have tried saving and loading a trained foreground detector instance to/from a .mat file, but all this does it copy the public properties, and does not appear to save the trained model. If I can't get this to work I will need to completely change my approach, this is literally the last step in what I am needing to do. Your help would be really, really appreciated.

採用された回答

Birju Patel
Birju Patel 2014 年 10 月 14 日
Hi,
You'll need to execute:
feature('SystemObjectsFullSaveLoad',1);
to enable the save/load to work correctly for vision.ForegroundDetector. You should use that command right before you call SAVE on the vision.ForegroundDetector object.
Also, you should save the “locked” object (i.e. do not call release prior to saving). You can execute the isLocked method on the vision.ForegroundDetector object to check if it's locked or not.
Hope that helps.
  3 件のコメント
Keir Bowater
Keir Bowater 2018 年 4 月 7 日
Birju, has feature('SystemObjectsFullSaveLoad',1) been deprecated in more recent versions of MATLAB? I searched the documentation and couldn't find any new function to allow the same thing. If I run feature('SystemObjectsFullSaveLoad',1);, MATLAB throws an error: Error using feature Feature SystemObjectsFullSaveLoad not found.
Birju Patel
Birju Patel 2018 年 4 月 16 日
Hi Keir,
You don't need to enable the SystemObjectsFullSaveLoad feature any longer. Saving and loading the vision.ForegroundDetector should work without it.
The command errors out now because that feature keyword has been removed.
Birju

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by