WaqasSultani / AnomalyDetectionCVPR2018

503 stars 183 forks source link

Error when running DEMO_GUI.py #27

Closed bigredbug47 closed 5 years ago

bigredbug47 commented 5 years ago

Hello,

I have initialized environments based on your readme file:

But when I try to run Demo_GUI file it occurred an error about the numpy. Can you advise me what happened and how to fix it? I have reinstalled numpy library but it doesn't work.

Thank you.

KERAS_BACKEND=theano python3 Demo_GUI.py 
Using Theano backend.
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
Xlib:  extension "XInputExtension" missing on display ":1".
Traceback (most recent call last):
  File "Demo_GUI.py", line 241, in <module>
    main()
  File "Demo_GUI.py", line 237, in main
    w = PrettyWidget()
  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 "/usr/local/lib/python3.5/dist-packages/keras/models.py", line 197, in model_from_json
    return layer_from_config(config, custom_objects=custom_objects)
  File "/usr/local/lib/python3.5/dist-packages/keras/utils/layer_utils.py", line 36, in layer_from_config
    return layer_class.from_config(config['config'])
  File "/usr/local/lib/python3.5/dist-packages/keras/models.py", line 1025, in from_config
    model.add(layer)
  File "/usr/local/lib/python3.5/dist-packages/keras/models.py", line 308, in add
    output_tensor = layer(self.outputs[0])
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 514, in __call__
    self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 572, in add_inbound_node
    Node.create_node(self, inbound_layers, node_indices, tensor_indices)
  File "/usr/local/lib/python3.5/dist-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 "/usr/local/lib/python3.5/dist-packages/keras/layers/core.py", line 90, in call
    x = K.in_train_phase(K.dropout(x, self.p, noise_shape), x)
  File "/usr/local/lib/python3.5/dist-packages/keras/backend/theano_backend.py", line 1016, in dropout
    random_tensor = rng.binomial(x.shape, p=retain_prob, dtype=x.dtype)
  File "/usr/local/lib/python3.5/dist-packages/theano/sandbox/rng_mrg.py", line 901, in binomial
    x = self.uniform(size=size, nstreams=nstreams, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/theano/sandbox/rng_mrg.py", line 872, in uniform
    rstates = self.get_substream_rstates(nstreams, dtype)
  File "/usr/local/lib/python3.5/dist-packages/theano/configparser.py", line 117, in res
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/theano/sandbox/rng_mrg.py", line 779, in get_substream_rstates
    multMatVect(rval[0], A1p72, M1, A2p72, M2)
  File "/usr/local/lib/python3.5/dist-packages/theano/sandbox/rng_mrg.py", line 62, in multMatVect
    [A_sym, s_sym, m_sym, A2_sym, s2_sym, m2_sym], o, profile=False)
  File "/usr/local/lib/python3.5/dist-packages/theano/compile/function.py", line 317, in function
    output_keys=output_keys)
  File "/usr/local/lib/python3.5/dist-packages/theano/compile/pfunc.py", line 486, in pfunc
    output_keys=output_keys)
  File "/usr/local/lib/python3.5/dist-packages/theano/compile/function_module.py", line 1841, in orig_function
    fn = m.create(defaults)
  File "/usr/local/lib/python3.5/dist-packages/theano/compile/function_module.py", line 1715, in create
    input_storage=input_storage_lists, storage_map=storage_map)
  File "/usr/local/lib/python3.5/dist-packages/theano/gof/link.py", line 699, in make_thunk
    storage_map=storage_map)[:3]
  File "/usr/local/lib/python3.5/dist-packages/theano/gof/vm.py", line 1091, in make_all
    impl=impl))
  File "/usr/local/lib/python3.5/dist-packages/theano/gof/op.py", line 955, in make_thunk
    no_recycling)
  File "/usr/local/lib/python3.5/dist-packages/theano/gof/op.py", line 858, in make_c_thunk
    output_storage=node_output_storage)
  File "/usr/local/lib/python3.5/dist-packages/theano/gof/cc.py", line 1217, in make_thunk
    keep_lock=keep_lock)
  File "/usr/local/lib/python3.5/dist-packages/theano/gof/cc.py", line 1157, in __compile__
    keep_lock=keep_lock)
  File "/usr/local/lib/python3.5/dist-packages/theano/gof/cc.py", line 1609, in cthunk_factory
    key = self.cmodule_key()
  File "/usr/local/lib/python3.5/dist-packages/theano/gof/cc.py", line 1300, in cmodule_key
    c_compiler=self.c_compiler(),
  File "/usr/local/lib/python3.5/dist-packages/theano/gof/cc.py", line 1379, in cmodule_key_
    np.core.multiarray._get_ndarray_c_version())
AttributeError: ('The following error happened while compiling the node', DotModulo(A, s, m, A2, s2, m2), '\n', "module 'numpy.core.multiarray' has no attribute '_get_ndarray_c_version'")
WaqasSultani commented 5 years ago

Could you please try running it with Python 2.7?

bigredbug47 commented 5 years ago

Could you please try running it with Python 2.7?

Hi, I have tried in Python 2.7, but it returns the same error. Could you provide me your numpy and opencv , scikit-image version? Thank you.


Using Theano backend.
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
Xlib:  extension "XInputExtension" missing on display ":1".
Traceback (most recent call last):
  File "Demo_GUI.py", line 241, in <module>
    main()
  File "Demo_GUI.py", line 237, in main
    w = PrettyWidget()
  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 "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 197, in model_from_json
    return layer_from_config(config, custom_objects=custom_objects)
  File "/usr/local/lib/python2.7/dist-packages/keras/utils/layer_utils.py", line 36, in layer_from_config
    return layer_class.from_config(config['config'])
  File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 1025, in from_config
    model.add(layer)
  File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 308, in add
    output_tensor = layer(self.outputs[0])
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 514, in __call__
    self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 572, in add_inbound_node
    Node.create_node(self, inbound_layers, node_indices, tensor_indices)
  File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 90, in call
    x = K.in_train_phase(K.dropout(x, self.p, noise_shape), x)
  File "/usr/local/lib/python2.7/dist-packages/keras/backend/theano_backend.py", line 1016, in dropout
    random_tensor = rng.binomial(x.shape, p=retain_prob, dtype=x.dtype)
  File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/rng_mrg.py", line 901, in binomial
    x = self.uniform(size=size, nstreams=nstreams, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/rng_mrg.py", line 872, in uniform
    rstates = self.get_substream_rstates(nstreams, dtype)
  File "/usr/local/lib/python2.7/dist-packages/theano/configparser.py", line 117, in res
    return f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/rng_mrg.py", line 779, in get_substream_rstates
    multMatVect(rval[0], A1p72, M1, A2p72, M2)
  File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/rng_mrg.py", line 62, in multMatVect
    [A_sym, s_sym, m_sym, A2_sym, s2_sym, m2_sym], o, profile=False)
  File "/usr/local/lib/python2.7/dist-packages/theano/compile/function.py", line 317, in function
    output_keys=output_keys)
  File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 486, in pfunc
    output_keys=output_keys)
  File "/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", line 1841, in orig_function
    fn = m.create(defaults)
  File "/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", line 1715, in create
    input_storage=input_storage_lists, storage_map=storage_map)
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/link.py", line 699, in make_thunk
    storage_map=storage_map)[:3]
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/vm.py", line 1091, in make_all
    impl=impl))
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 955, in make_thunk
    no_recycling)
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 858, in make_c_thunk
    output_storage=node_output_storage)
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1217, in make_thunk
    keep_lock=keep_lock)
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1157, in __compile__
    keep_lock=keep_lock)
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1609, in cthunk_factory
    key = self.cmodule_key()
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1300, in cmodule_key
    c_compiler=self.c_compiler(),
  File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1379, in cmodule_key_
    np.core.multiarray._get_ndarray_c_version())
AttributeError: ('The following error happened while compiling the node', DotModulo(A, s, m, A2, s2, m2), '\n', "'module' object has no attribute '_get_ndarray_c_version'")
Abhijeetchahal commented 5 years ago

hi bigredbug47, i m facing the same problem .please let me know if u have found the solution

Shiny128 commented 5 years ago

I'm also facing the same issue, Please share the Solution

Abhijeetchahal commented 5 years ago

i solved the issue by changing some versions h5py==2.9.0 Keras==1.1.0 numpy==1.16.0 pytz==2018.9 scipy==1.2.1 Theano==1.0.4 it worked for me on windows 10 good luck!

infinity-void6 commented 1 month ago

hi abhijeetchahal can you let me know where we use h5py in the code?