WaqasSultani / AnomalyDetectionCVPR2018

502 stars 182 forks source link

Error in running Demo.py and TrainingAnomalyDetector_public.py #50

Open SH95 opened 5 years ago

SH95 commented 5 years ago

Hi, When i run Demo.py, I get an strange error. The error is as bellow:

(py35) D:\work\AIRIA\program\AnomalyDetectionCVPR2018-master>python Demo_GUI.py Using TensorFlow backend. D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\tensorflow\python\framework\dtypes.py:521: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) WARNING (theano.configdefaults): g++ not available, if using conda: conda install m2w64-toolchain D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory warnings.warn("DeprecationWarning: there is no c++ compiler." WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string. WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions. 2019-07-31 10:22:49.870409: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\35\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 Traceback (most recent call last): File "Demo_GUI.py", line 241, in main() File "Demo_GUI.py", line 237, in main w = PrettyWidget() #创建窗口对象,QWidget窗口组件是PyQt4中所有用户界面对象的基类,这里直接使用QWidget默认的构造。 File "Demo_GUI.py", line 126, in init self.initUI() File "Demo_GUI.py", line 139, in initUI model = load_model(model_path) File "Demo_GUI.py", line 38, in load_model model = model_from_json(open(json_path).read()) File "D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\keras\models.py", line 197, in model_from_json return layer_from_config(config, custom_objects=custom_objects) File "D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\keras\utils\layer_utils.py", line 36, in layer_from_config return layer_class.from_config(config['config']) File "D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\keras\models.py", line 1025, in from_config model.add(layer) File "D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\keras\models.py", line 308, in add output_tensor = layer(self.outputs[0]) File "D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\keras\engine\topology.py", line 514, in call self.add_inbound_node(inbound_layers, node_indices, tensor_indices) File "D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\keras\engine\topology.py", line 572, in add_inbound_node Node.create_node(self, inbound_layers, node_indices, tensor_indices) File "D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\keras\engine\topology.py", line 149, in create_node output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0])) File "D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\keras\layers\core.py", line 90, in call x = K.in_train_phase(K.dropout(x, self.p, noise_shape), x) File "D:\soft\Anaconda\Anaconda\envs\py35\lib\site-packages\keras\backend\tensorflow_backend.py", line 1304, in in_train_phase x = tf.python.control_flow_ops.cond(tf.cast(_LEARNING_PHASE, 'bool'), AttributeError: module 'tensorflow' has no attribute 'python'

Can you advise me what happened and how to fix it?

VivaainNg commented 5 years ago

Using TensorFlow backend.

Based on the message above, you might wanna switch your back-end from tensorflow into theano.

SH95 commented 5 years ago

Using TensorFlow backend.

Based on the message above, you might wanna switch your back-end from tensorflow into theano.

Hi, Thanks a lot for your kind reply, which is very helpful for me.

nitincs commented 5 years ago

on importing--> from PyQt5 import QtGui

getting error: class PrettyWidget(QtGui.QWidget): AttributeError: module 'PyQt5.QtGui' has no attribute 'QWidget'

iShahad97 commented 4 years ago

@nitincs from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QFileDialog removed all (QtGui) like line 122: class PrettyWidget(QWidget): ling 131: btn = QPushButton('ANOMALY DETECTION SYSTEM \n Please select video', self) and so on