Skip to content

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.

3 participants