giddyyupp/coco-minitrain

TypeError: slice indices must be integers or None or have an __index__ method

Closed this issue · 6 comments

Traceback (most recent call last):
  File "sample_coco.py", line 156, in <module>
    main()
  File "sample_coco.py", line 62, in main
    for i in keys[:parser.sample_image_count]:
TypeError: slice indices must be integers or None or have an __index__ method

when running sample_coco.py script.

Just made a pull request. It simply casts input type from str to int.

I solved this problem by change
for i in keys[:parser.sample_image_count]:
to
for i in keys[:int(parser.sample_image_count)]:

It simply casts input type from str to int.

Yes, as mentioned.

this debug could be pushed to project, thanks for your bug mentioned.

Fix merged.