Open kroman4 opened 3 years ago
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.
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'
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.
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.
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
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.
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]
I`m using Anaconda, not VENV.
Keras 2.2.4 does not work well with tensorflow 2.0 (https://github.com/keras-team/keras/issues/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
ValueError Traceback (most recent call last)
It was caused by "inf". Now I fixed Secreit.py.
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!