AdneneBoumessouer / MVTec-Anomaly-Detection

This project proposes an end-to-end framework for semi-supervised Anomaly Detection and Segmentation in images based on Deep Learning.
278 stars 59 forks source link

keras.__version__ #31

Closed yzyzju closed 4 years ago

yzyzju commented 4 years ago

great job! in your code, you use "from tensorflow import keras", so the keras__version is 2.2.4_tf. However, in requirements.txt file, the keras version is 2.3.1, so i use "import keras" directly instead of using "from tensorflow import keras", but it will cause some problems, so i wish you to give some advices, thx!

AdneneBoumessouer commented 4 years ago

Hi. There are two variants or implementations of the Keras API. The first one can be referred to as "multibackend Keras" that supports multiple Deep Learning libraries like TensorFlow, CNTK, Theano, Apache MXNet and so on in order to perform the backend computation. By writing import Keras, you are actually importing this variant (This is the version 2.3.1 that you are referring to). The second variant (which I am using in this project) is the Tensorflow's own implementation of the Keras API, commonly referred to as "tf.keras", which only support TensorFlow as backend. That is why I am writing from tensorflow import keras (This is the version 2.2.4). Please keep the imports unmodofied for the code to execute properly. I hope this helps, cheers!

yzyzju commented 4 years ago

thank you, and i have installed cuda==10.1, cudnn==7.6.3 and tensorflow-gpu==2.1.0, but while run train.py, i got an error tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above. what should i do?

AdneneBoumessouer commented 4 years ago

What GPU are you using?

yzyzju commented 4 years ago

GTX 1660Ti. it's maybe not because of the gpu memory problems, because i have tried changing the model's capacity to a very very low level, but it dose not work

yzyzju commented 4 years ago

I have solved this problem by adding the code config = tf.compat.v1.ConfigProto(gpu_options=tf.compat.v1.GPUOptions(allow_growth=True)) sess = tf.compat.v1.Session(config=config) thans

yzyzju commented 4 years ago

I have solved this problem by adding the code config = tf.compat.v1.ConfigProto(gpu_options=tf.compat.v1.GPUOptions(allow_growth=True)) sess = tf.compat.v1.Session(config=config) thans