Python features.Features() Examples

The following are 8 code examples of features.Features(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module features , or try the search function .
Example #1
Source File: main.py    From SaltwashAR with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self):
        # initialise config
        self.config_provider = ConfigProvider()

        # initialise robots
        self.rocky_robot = RockyRobot()
        self.sporty_robot = SportyRobot()

        # initialise webcam
        self.webcam = Webcam()

        # initialise markers
        self.markers = Markers()
        self.markers_cache = None

        # initialise features
        self.features = Features(self.config_provider)

        # initialise texture
        self.texture_background = None 
Example #2
Source File: strategy.py    From trading-server with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, exchanges, logger, db_prices, db_other, db_client):
        self.exchanges = exchanges
        self.logger = logger
        self.db_prices = db_prices
        self.db_other = db_other
        self.db_client = db_client
        self.db_collections_price = {
            i.get_name(): db_prices[i.get_name()] for i in self.exchanges}

        # Save-later queue.
        self.signals_save_to_db = queue.Queue(0)

        # DataFrame container: data[exchange][symbol][timeframe].
        self.data = {}
        self.init_dataframes(empty=True)

        # Strategy models.
        self.models = self.load_models(self.logger)

        # Signal container: signals[exchange][symbol][timeframe].
        self.signals = {}

        # persistent reference to features library.
        self.feature_ref = Features() 
Example #3
Source File: selective_search.py    From selective_search_py with MIT License 5 votes vote down vote up
def hierarchical_segmentation(I, k = 100, feature_mask = features.SimilarityMask(1, 1, 1, 1)):
    F0, n_region = segment.segment_label(I, 0.8, k, 100)
    adj_mat, A0 = _calc_adjacency_matrix(F0, n_region)
    feature_extractor = features.Features(I, F0, n_region)

    # stores list of regions sorted by their similarity
    S = _build_initial_similarity_set(A0, feature_extractor)

    # stores region label and its parent (empty if initial).
    R = {i : () for i in range(n_region)}

    A = [A0]    # stores adjacency relation for each step
    F = [F0]    # stores label image for each step

    # greedy hierarchical grouping loop
    while len(S):
        (s, (i, j)) = S.pop()
        t = feature_extractor.merge(i, j)

        # record merged region (larger region should come first)
        R[t] = (i, j) if feature_extractor.size[j] < feature_extractor.size[i] else (j, i)

        Ak = _new_adjacency_dict(A[-1], i, j, t)
        A.append(Ak)

        S = _merge_similarity_set(feature_extractor, Ak, S, i, j, t)

        F.append(_new_label_image(F[-1], i, j, t))

    # bounding boxes for each hierarchy
    L = feature_extractor.bbox

    return (R, F, L) 
Example #4
Source File: test_features.py    From selective_search_py with MIT License 5 votes vote down vote up
def setup_method(self, method = None, w = 10, h = 10):
        self.h, self.w = h, w
        image = numpy.zeros((self.h, self.w, 3), dtype=numpy.uint8)
        label = numpy.zeros((self.h, self.w), dtype=int)
        self.f = features.Features(image, label, 1) 
Example #5
Source File: test_features.py    From selective_search_py with MIT License 5 votes vote down vote up
def setup_method(self, method):
        image = numpy.zeros((10, 10, 3), dtype=numpy.uint8)
        label = numpy.zeros((10, 10), dtype=int)
        self.f = features.Features(image, label, 1) 
Example #6
Source File: test_features.py    From selective_search_py with MIT License 5 votes vote down vote up
def setup_method(self, method):
        image = numpy.zeros((10, 10, 3), dtype=numpy.uint8)
        label = numpy.zeros((10, 10), dtype=int)
        self.f = features.Features(image, label, 1) 
Example #7
Source File: test_features.py    From selective_search_py with MIT License 5 votes vote down vote up
def setup_method(self, method):
        self.dummy_image = numpy.zeros((10, 10, 3), dtype=numpy.uint8)
        self.dummy_label = numpy.zeros((10, 10), dtype=int)
        self.f = features.Features(self.dummy_image, self.dummy_label, 1) 
Example #8
Source File: test_features.py    From selective_search_py with MIT License 5 votes vote down vote up
def setup_method(self, method):
        dummy_image = numpy.zeros((10, 10, 3), dtype=numpy.uint8)
        dummy_label = numpy.zeros((10, 10), dtype=int)
        self.f = features.Features(dummy_image, dummy_label, 1)