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

I am having trouble using your repo due to vague module versions. #2

Open
kroman4 opened this issue Dec 17, 2020 · 10 comments
Open

I am having trouble using your repo due to vague module versions. #2

kroman4 opened this issue Dec 17, 2020 · 10 comments

Comments

@kroman4
Copy link

kroman4 commented Dec 17, 2020

Would you be able to add a requirements.txt with the exact versions you used.

I tried using the following module versions and python 3.6.
numpy==1.19.3
keras==2.2.4
opencv-python
tensorflow==2.0

I am also unsure how to fully run the code as the instructions are not very in depth for someone at my level.
Can you give an example of the commands used to determine the estrus stage of an image that the user submits? Additionally, do the images have to be in .png format or can they be .tiff?

Thanks!

@SanoKyohei
Copy link
Owner

SanoKyohei commented Dec 18, 2020

About requirements.txt:
I added now

About Example code:
Please refer to Example.ipynb

About .tiff file
Actually I didn`t check it, but I think it will work.

@Concrete18
Copy link

opencv-python 4.1.1 did not seem to exist but this was close and installed fine.
opencv-python==4.1.1.26

I found that Keras 2.2.4 is giving this import error. I am running the example (Example.ipynb) in VSCode after installing everything but it gets the following error.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-f457f0f1cf48> in <module>
----> 1 import Secreit
      2 from keras.preprocessing import image
      3 import numpy as np
      4 from matplotlib import pyplot as plt
      5 import matplotlib as mpl

d:\Google Drive\Coding\Python\Scripts\Secreit\Secreit.py in <module>
----> 1 from keras import models
      2 from keras import layers
      3 import pickle
      4 from keras.applications import VGG16
      5 from keras import optimizers

ModuleNotFoundError: No module named 'keras'

@Concrete18
Copy link

Concrete18 commented Dec 18, 2020

Are you using Anaconda? I tried using the following versions using a venv.

numpy==1.19.1
opencv-python==4.1.1.26 # 4.1.1 did not exist
keras==2.2.4
tensorflow==2.2.0

A Pip freeze output might help from your working environment.

@SanoKyohei
Copy link
Owner

Do you really install keras??
"ModuleNotFoundError: No module named 'keras' " means you don't install keras correctly.

You should reinstall keras and type "import keras" to check whether you install it correctly.

@Concrete18
Copy link

This is so strange.

I installed again and same error.
This is what it tells me when I import keras within the venv enviroment using python terminal.

>>> import keras
Using TensorFlow backend.
2020-12-18 13:56:47.936810: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll

@SanoKyohei
Copy link
Owner

How about "from keras import models"
I don`t know why you can import keras, but you cant do the same thing when using Secreit.

How about copying and pasting all the Secreit.py and use it without importing Secreit.

@Concrete18
Copy link

Concrete18 commented Dec 18, 2020

How are you running the Example.ipynb file?
VSCode may be failing to use the VENV which would cause these issues.

It is getting further without errors but now this comes up

RuntimeError: tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead.

due to this line.

grads = K.gradients(P_output, last_conv_layer.output)[0]

@SanoKyohei
Copy link
Owner

I`m using Anaconda, not VENV.

@kroman4
Copy link
Author

kroman4 commented Dec 19, 2020

Keras 2.2.4 does not work well with tensorflow 2.0 (keras-team/keras#12379).
Using anaconda I created an environment with the following versions, which allowed me to successfully run your Example.ipynb with the D.png:

numpy==1.19.1
opencv-python==4.1.1.26
keras==2.2.4
tensorflow==1.13.1
matplotlib

However, when I try to run the jupyter notebook with the E.png, i get the following error:

ValueError Traceback (most recent call last)
in
1 predict=Secreit.predict(img, model)
----> 2 print('D:'+str(round(predict[0]*100))+'%, E:'+str(round(predict[1]*100))+'%, P:'+str(round(predict[2]*100))+'%')

ValueError: cannot convert float NaN to integer

When I add print(predict), the output is [ 0. nan 0.]
I also tested E_a_E0010005_Auto3_train.png and print(predict) resulted in [5.4724413e-11 nan 8.0592477e-12]

@SanoKyohei
Copy link
Owner

It was caused by "inf". Now I fixed Secreit.py.

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

No branches or pull requests

3 participants