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

Cast as int #341

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

zswitten
Copy link

@zswitten zswitten commented Aug 2, 2018

Calling python gen_anchors.py -c config.json --anchors=3 errors out as below:

Traceback (most recent call last):
  File "gen_anchors.py", line 138, in <module>
    main(args)
  File "gen_anchors.py", line 130, in main
    centroids = run_kmeans(annotation_dims, num_anchors)
  File "gen_anchors.py", line 72, in run_kmeans
    old_distances = np.zeros((ann_num, anchor_num))
TypeError: 'str' object cannot be interpreted as an integer

This is because argparse casts command line inputs as strings. This PR fixes the problem by casting them as an int within the main method.

@jbrambleDC
Copy link

LGTM

@robertlugg
Copy link

You might also consider changing the argparser line instead:

argparser.add_argument(
'-a',
'--anchors',
*** type=int ***,
default=5,
help='number of anchors to use')

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

Successfully merging this pull request may close these issues.

None yet

3 participants