__init__.py 1.14 KB
Newer Older
1 2 3 4
from .segmenter import Segmenter
from .felzenszwalb import Felzenszwalb
from .quickshift import Quickshift
from .slic import Slic
5 6

__all__ = ["segmenter",
7 8
           "felzenszwalb"
           "quickshift"
9 10 11 12 13 14 15
            "slic"]


from collections import OrderedDict
from util.config import Config


16 17 18 19 20 21
_segmenter_list = OrderedDict( [ 
                            ["felzenszwalb", Config(Felzenszwalb().get_name(), False, bool, meta=Felzenszwalb)],
                            ["quickshift", Config(Quickshift().get_name(), False, bool, meta=Quickshift)],
                            ["slic", Config(Slic().get_name(), True, bool, meta=Slic)],
                            ["invalid", Config("Invalid", False, bool, meta=None, hidden=True)]
                        ] )
22 23 24 25 26

def get_segmenter_config():
    return _segmenter_list

def set_segmenter_config(configs):
27 28
    _segmenter_list["felzenszwalb"] = Config.nvl_config(configs["felzenszwalb"], _segmenter_list["felzenszwalb"])
    _segmenter_list["quickshift"] = Config.nvl_config(configs["quickshift"], _segmenter_list["quickshift"])
29
    _segmenter_list["slic"] = Config.nvl_config(configs["slic"], _segmenter_list["slic"])