WaqasSultani / AnomalyDetectionCVPR2018

503 stars 185 forks source link

Training error #42

Open qwdr7777 opened 5 years ago

qwdr7777 commented 5 years ago

I ran "python TrainingAnomalyDetector_public.py " ans I ran this problem:

File "", line 1, in runfile('C:/Users/Allen/Desktop/論文/code/AnomalyDetectionCVPR2018-master/AnomalyDetectionCVPR2018-master/TrainingAnomalyDetector_public.py', wdir='C:/Users/Allen/Desktop/論文/code/AnomalyDetectionCVPR2018-master/AnomalyDetectionCVPR2018-master')

File "C:\Users\Allen\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile execfile(filename, namespace)

File "C:\Users\Allen\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Allen/Desktop/論文/code/AnomalyDetectionCVPR2018-master/AnomalyDetectionCVPR2018-master/TrainingAnomalyDetector_public.py", line 279, in model.compile(loss=custom_objective, optimizer=adagrad)

File "C:\Users\Allen\Anaconda3\lib\site-packages\keras\engine\training.py", line 342, in compile sample_weight, mask)

File "C:\Users\Allen\Anaconda3\lib\site-packages\keras\engine\training_utils.py", line 404, in weighted score_array = fn(y_true, y_pred)

File "C:/Users/Allen/Desktop/論文/code/AnomalyDetectionCVPR2018-master/AnomalyDetectionCVPR2018-master/TrainingAnomalyDetector_public.py", line 202, in custom_objective y_true = T.flatten(y_true)

File "C:\Users\Allen\Anaconda3\lib\site-packages\theano\tensor\basic.py", line 5276, in flatten x_reshaped = x.reshape(dims)

AttributeError: 'Tensor' object has no attribute 'reshape'

I've installed keras, theano and python etc using anaconda, here's my packages info: theano 1.0.3 keras 2.2.4 python 3.7.3 Do i change packages version?

draxler1 commented 5 years ago

Any solution to this??

mvk07 commented 4 years ago

Please use theano backend. This is due to tensorflow vector being passed to theano flatten.

Use this link for more information: https://keras.io/backend/

NitinDatta8 commented 4 years ago

I solved the problem using

import os
os.environ['KERAS_BACKEND'] = 'theano'
Mohamed-Salah62 commented 4 years ago

I tried it and it didn't work

I solved the problem using

import os
os.environ['KERAS_BACKEND'] = 'theano'
mvk07 commented 4 years ago

I tried it and it didn't work

I solved the problem using

import os
os.environ['KERAS_BACKEND'] = 'theano'

could you post the error you encounter

Mohamed-Salah62 commented 3 years ago

AttributeError: 'Tensor' object has no attribute 'reshape'

import os os.environ['KERAS_BACKEND'] = 'theano'

could you post the error you encounter

yassinesamet commented 3 years ago

@mvk07 @NitinDatta8 @draxler1 @Mohamed-Salah62 @qwdr7777 any solution pleaaase

import os os.environ['KERAS_BACKEND'] = 'theano'

----------------------------->I tried it and it didn't work