Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure when running this function through pytest #140

Open
Sandermfc opened this issue Dec 14, 2020 · 0 comments
Open

Failure when running this function through pytest #140

Sandermfc opened this issue Dec 14, 2020 · 0 comments

Comments

@Sandermfc
Copy link

My code calls image_match.signature_database_base.get_words directly. I am getting this failure during pytest unit tests:

        words = np.zeros((N, k)).astype('int8')
    
        for i, pos in enumerate(word_positions):
            if pos + k <= array.shape[0]:
                words[i] = array[pos:pos+k]
            else:
                temp = array[pos:].copy()
>               temp.resize(k)
E               ValueError: cannot resize an array that references or is referenced
E               by another array in this way.
E               Use the np.resize function or refcheck=False

venv/lib/python3.8/site-packages/image_match/signature_database_base.py:407: ValueError

I have solved this locally by simply adding refcheck=False to the resize line. However, https://stackoverflow.com/questions/20730366/numpy-resize-method seems to suggest that using a temp buffer in this way may not be appropriate.

@Sandermfc Sandermfc changed the title Failure when running tests Failure when running this function through pytest Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant