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

will there be a new version for Python 3 #23

Open
darotchou opened this issue Jun 8, 2017 · 2 comments
Open

will there be a new version for Python 3 #23

darotchou opened this issue Jun 8, 2017 · 2 comments

Comments

@darotchou
Copy link

Hi, I tried to use your code on Win10 Python 3 environment.
But it returned

Traceback (most recent call last):
File "sstest.py", line 43, in
main()
File "sstest.py", line 15, in main
img, scale=500, sigma=0.9, min_size=10)
File "D:\TFCNN\selectivesearch.py", line 274, in selective_search
neighbours = _extract_neighbours(R)
File "D:\TFCNN\selectivesearch.py", line 208, in _extract_neighbours
for cur, a in enumerate(R[:-1]):

in python 3, it seems I have to convert some region data to list and for sorted() function, cmp is no longer used in python 3.
Will there be a python 3 version selective search in near days?

@yanshui177
Copy link

Hey bro, you can change the file like this:
1、locate directory to your package: C:\Anaconda3\Lib\site-packages\selectivesearch
2、then open the file:"_init.py" and add "." behand selectivesearch like this: from .selectivesearch import selective_search # NOQA
3、open the file named "selectivesearch.py", and then import header: from functools import cmp_to_key
4、change the 206 lines like this: R = list(regions.items())
5、change the 289 lines like this: i, j = sorted(S.items(), key=cmp_to_key(lambda a, b: a[1]-b[1]))[-1][0]
Last: enjoy your work now!

@danta666
Copy link

danta666 commented Feb 1, 2018

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

3 participants