Skip to content

Getting an error from Example.ipynb #1

@mahaling

Description

@mahaling

Getting the following error while trying to run Example.ipynb... Any ideas?

`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
1 log = []
2 match_fun = fastmatch.match(query_cache, target_img, options = {'log' : log})
----> 3 print(match_fun(0.7))
4 #matches = list(match_fun(0.7))

/home/gayathrim/libraries/Fast-Match/fastmatch.pyx in fastmatch.match.get_matches (fastmatch.c:2002)()
49 thumb_tau = thumb_strategy(tau)
50 positions_iter = itertools.chain(thumb_positions[thumb_ratios<thumb_tau])
---> 51 matches = do_iter(positions_iter, query_cache, target_cache, tau = tau, thumb_tau = thumb_tau, radius = radius, log = log)
52 return matches
53 return get_matches

/home/gayathrim/libraries/Fast-Match/fastmatch.pyx in fastmatch.do_iter (fastmatch.c:3049)()
71 if not has_matched.get((col, row, query_col, query_row), False) :
72 has_matched[(col, row, query_col, query_row)] = True
---> 73 result_pos, ratios, query_idx = match_position((query_pos, target_pos), cache, target_grid, radius = radius)
74 # For each match we don't discard, we might want to examine the neighbor field
75 neighbors = get_neighbors(target_pos, result_pos[ratios<tau], target_grid)

/home/gayathrim/libraries/Fast-Match/fastmatch.pyx in fastmatch.match_position (fastmatch.c:5301)()
150 target_x, target_y = pos[1]
151
--> 152 query_ds, query_pos, query_dis, query_idx = query_cache.get(query_x, query_y, radius)
153
154 target_kp, target_ds = target.get(target_x, target_y)

/home/gayathrim/libraries/Fast-Match/cache.pyx in cache.Metric_Cache.get (cache.c:5159)()
180 cdef object pos_tree = self.original["position_tree"]
181 # Fetch all feature points within radius pixels of position
--> 182 indices, distances = pos_tree.query_radius(numpy.array((x,y)),
183 r = radius,
184 return_distance=True,

sklearn/neighbors/binary_tree.pxi in sklearn.neighbors.ball_tree.BinaryTree.query_radius()

/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.pyc in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
408 "Reshape your data either using array.reshape(-1, 1) if "
409 "your data has a single feature or array.reshape(1, -1) "
--> 410 "if it contains a single sample.".format(array))
411 array = np.atleast_2d(array)
412 # To ensure that array flags are maintained

ValueError: Expected 2D array, got 1D array instead:
array=[299. 517.].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions