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.

`example.py` throws error : erroneous infinity returned

See original GitHub issue

I am trying to run example.py on a video of my own. The only modification made by me is for the path to the folder with the videos : https://github.com/DariusAf/MesoNet/blob/61fe5cde61b2b6f531f55e7007976806fddbbf7a/example.py#L31

I have the same python and keras versions as mentioned in the readme.

The error trace:

Using TensorFlow backend.
2019-05-03 14:32:26.071187: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Found 4 images belonging to 2 classes.
Predicted : [[0.99782073]] 
Real class : [1.]
Dealing with video  fadg0-fram1-roi93.mov
Traceback (most recent call last):
  File "/home/aneesh/Work/MesoNet/example.py", line 31, in <module>
    predictions = compute_accuracy(classifier, '/home/aneesh/Work/data/deepfaketimit/DeepfakeTIMIT/')
  File "/home/aneesh/Work/MesoNet/pipeline.py", line 305, in compute_accuracy
    skipstep = max(floor(face_finder.length / frame_subsample_count), 0)
OverflowError: cannot convert float infinity to integer
Fatal Python error: could not acquire lock for <_io.BufferedReader name=8> at interpreter shutdown, possibly due to daemon threads

Thread 0x00007f08e77fe700 (most recent call first):
  File "/home/aneesh/SoftwareInstall/miniconda3/envs/lab_env/lib/python3.6/site-packages/imageio_ffmpeg/_parsing.py", line 61 in run
  File "/home/aneesh/SoftwareInstall/miniconda3/envs/lab_env/lib/python3.6/threading.py", line 916 in _bootstrap_inner
  File "/home/aneesh/SoftwareInstall/miniconda3/envs/lab_env/lib/python3.6/threading.py", line 884 in _bootstrap

Current thread 0x00007f0949657740 (most recent call first):
  File "/home/aneesh/SoftwareInstall/miniconda3/envs/lab_env/lib/python3.6/subprocess.py", line 1557 in _communicate
  File "/home/aneesh/SoftwareInstall/miniconda3/envs/lab_env/lib/python3.6/subprocess.py", line 863 in communicate
  File "/home/aneesh/SoftwareInstall/miniconda3/envs/lab_env/lib/python3.6/site-packages/imageio_ffmpeg/_io.py", line 193 in read_frames
  File "/home/aneesh/SoftwareInstall/miniconda3/envs/lab_env/lib/python3.6/site-packages/imageio/plugins/ffmpeg.py", line 342 in _close
  File "/home/aneesh/SoftwareInstall/miniconda3/envs/lab_env/lib/python3.6/site-packages/imageio/core/format.py", line 252 in close
  File "/home/aneesh/SoftwareInstall/miniconda3/envs/lab_env/lib/python3.6/site-packages/imageio/core/format.py", line 241 in __del__

I’ve tried debugging it. It seems to be stemming from https://github.com/DariusAf/MesoNet/blob/61fe5cde61b2b6f531f55e7007976806fddbbf7a/pipeline.py#L305

where face_finder.length is returning infinity.

I found a potential solution here : https://stackoverflow.com/questions/54778001/how-to-to-tackle-overflowerror-cannot-convert-float-infinity-to-integer

I may have fixed it in my fork : https://github.com/aneesh-joshi/MesoNet/blob/19749db10561901b0622009d5266046bc967bb10/pipeline.py#L25

But on running it with this “fix”, I get 100% confidence of fakeness in real and fake videos. I suspect I’m doing something wrong.

Could you help me out @DariusAf

Thanks!

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
markzampogloucommented, Jun 6, 2019

It seems the problem is linked to this bug: https://stackoverflow.com/questions/54778001/how-to-to-tackle-overflowerror-cannot-convert-float-infinity-to-integer

The solution is probably to replace line 21 of pipeline.py: Instead of self.length = self.container.get_length() put self.length = self.container.count_frames()

0reactions
aneesh-joshicommented, Jun 6, 2019

@nviable makes sense. If @DariusAf could verify this change, I’ll make a PR and close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

30. Errors and Exception Handling | Python Tutorial
In our example only one, i.e. "ValueError:". After having printed the text of the print statement, the execution does another loop. It starts ......
Read more >
Input contains NaN, infinity or a value too large for dtype ...
I have built an input matrix and I keep getting the following error. ValueError: Input contains NaN, infinity or a value too large...
Read more >
Exception and Error Handling in Python - DataCamp
As the name suggests, recursion error transpires when too many methods, one inside another is executed (one with an infinite recursion), which is...
Read more >
Python Exceptions (With Examples) - Programiz
In this tutorial, we will learn about exceptions in Python. We will cover exceptions and different types of exceptions in Python.
Read more >
Warning: unreachable code after return statement - JavaScript
When an expression exists after a valid return statement, a warning is given to indicate that the code after the return statement is...
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