question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ZeroDivisionError: integer division or modulo by zero

See original GitHub issue

So I am reusing the same codes from this repo for retraining. It was all working for me for the past few days until now. I received the issue below:

Traceback (most recent call last):
  File "/tensorflow/tensorflow/examples/image_retraining/retrain.py", line 1486, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "/tensorflow/tensorflow/examples/image_retraining/retrain.py", line 1252, in main
    FLAGS.architecture))
  File "/tensorflow/tensorflow/examples/image_retraining/retrain.py", line 549, in get_random_cached_bottlenecks
    image_dir, category)
  File "/tensorflow/tensorflow/examples/image_retraining/retrain.py", line 254, in get_image_path
    mod_index = index % len(category_list)
ZeroDivisionError: integer division or modulo by zero

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
oninrosscommented, Jun 13, 2018

Thank you @tushuhei, that worked perfectly! 😃

0reactions
tushuheicommented, Jul 6, 2020

Hi nidhishgandhi,

From seeing the error saying “Label yawning has no images in the category training”, I assume it’s caused by a lack of images for training. Could you check if there are multiple images under data/images/yawning directory? Please refer to https://github.com/google/emoji-scavenger-hunt#build-your-own-model for more details about data setup.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ZeroDivisionError: integer division or modulo by zero
The Python "ZeroDivisionError: integer division or modulo by zero" occurs when we use the modulo % operator with an integer and a zero....
Read more >
getting ZeroDivisionError: integer division or modulo by zero
ZeroDivisionError means that you were trying to divide or modulo, a number n with 0. in your case, z = (a/(b*d)) resulted in...
Read more >
integer division or modulo by zero" error. How do I solve it?
The error is integer division or modulo by zero. Your code uses modulo by zero. What is the point of checking that? def...
Read more >
ZeroDivisionError: division by zero - Yawin Tutor
The zero division error is due to either a number being divided by zero, or a number being modulo by zero. The denominator...
Read more >
[Solved] ZeroDivisionError: integer division or modulo by zero
The error message is self explanatory: You are dividing (or taking the modulus of) a value by zero. If the error reports a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found