Coder Social home page Coder Social logo

anomalydetectioncvpr2018's People

Contributors

waqassultani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anomalydetectioncvpr2018's Issues

Feature Extraction

Thank you for such an inspiring contribution to the CV field,
Is it possible if you could elaborate a bit on how you extracted the features for your dataset?

because I've been trying to wrap my head around the 32 temporal segments in a video where each is a 16 frame clip but from which part of the video do these 32 segments have to be?
Any guidance regarding this would be really appreciated.

error in running Demo.py

Hi,
when I try to run Demo.py I get an error in line of model_from_json(open('model.json').read())
the error is as bellow:
Exception has occurred: ValueError
Improper config format: {'l2': 0.0010000000474974513, 'name': 'WeightRegularizer', 'l1': 0.0}
File "/home/bardia/Desktop/Untitled-1.py", line 3, in
model = model_from_json(open(json_path).read())

the error is in model.json file in line of W_regularizer:

W_regularizer": {"l2": 0.0010000000474974513, "name": "WeightRegularizer", "l1": 0.0}

I search the error and it looks like that for version 2.2 Keras I have to use custome_object paramter inside model_from_json(open('model.json').read()) .

So In a new file, I changed the code to:

from keras.models import model_from_json
model = model_from_json(open('model.json').read(), custom_objects={'WeightRegularizer':W_regularizer}

However, I get the following error:
Exception has occurred: NameError
name 'W_regularizer' is not defined

I would really appreciate it if you share a solution
thanks a lot

How to train this net

How to prepare the features? What should be the structure of the project for learning neural network? In which folder should the training video be stored? Where should I use the Anomaly_Train.txt file?

request of data in the Path "Model_Score_Folder"

Thanks for the nice work!
could you please share the data in the Path "Model_Score_Folder" , where contains Pretrained Model score on Testing videos (32 numbers for 32 temporal segments). Then i can run the Evaluate_Anomaly_Detector.m

Besides, i did not know why only sample the scores of 32 Shots in the Evaluate_Anomaly_Detector.m
In my view, all shots' scores should be used to calculate the AUC.

Last ,what's your version of the keras and theano?

Thanks again for your real wonderful job! @WaqasSultani

saving features to '_C.txt' file w/o converting to binary blob data

I am saving directly w/o converting the raw data to binary blob format as the length of the data is varying. Using these values, I am not able to train my network. Its not learning at all, what learning rates and hyperparam values should I change? Also, should I add layers and do more or less dropout?

The program works inversely

Hello!
I try to test the video for anomalies. For testing I use video Vandalism046_x264. After extracting features, I run the program Demo_GUI.py. I get the following result.
2018-10-18 10-58-32

The program works with the exact opposite. When there are no anomalies, she sees them, and when there are anomalies, she says that they are not there. What could be the reason for this behavior?

File with features.
Vandalism046_x264.txt

question about training

Hi,thanks for your inspiring work.
When running the code of training(TrainingAnomalyDetector_public.py),whether we need to add some parameters?such as path of videos.And I want to know whether we first extract C3D feature before training?Thanks so much

'/*.fc6-1' and '*_C.txt'

Hi, could you please provide the examples of *.fc6-1 and *_C.txt? For your information, we are reproducing your experimental results, but we cannot find a way to use Save_C3DFeatures_32Segments.m without knowing the input. Thanks.

The paper says you used a C3D pretrained model but we can't find it anywhere

Figure 1. You use a pre-trained C3D convnet. On which database have you pretrained your C3D network?

I found a pretrained model based on UCF101 and another one based on Sports1m but your paper does not provide any further explanations regarding the pretraining. Your code does not show how you have extracted features also.

Could you please give us a link technically explaining how you extracted the features?

Thank you

Where can we find the find the .fc6-1 files?

Hello,

First of all, I want to thank you for your great article. It gives amazing results and I have decided for my master thesis to work on anomaly detection in CCTV videos as well thanks to you. Currently, I am trying to replicate your work.

However, I always run out of memory when I try to generate the features of the videos using C3D. Even with my GTX 970 4GO VRAM and a batch-size of 1... And it has been like that for month now... I don't have the money to buy a better GPU.

I am then asking for an archive where one can find the features of the videos (fc6-1 files) or the txt files containing the 32 segments of each videos for all the dataset.

Is it possible please? Thank you!

About Save_C3DFeatures_32Segments.m

Hi,I have a confusion,if the video is short,It contains 320 frames.Then it have 320/16 =20clips.Howeverr,the code shows divide the video to 32segments,I don't understand how it divided into 32(20<32)segments

Best Wishes
Thanks

Some questions regarding the loss function and other aspects in the article

I have never seen a loss function which compare positive examples and negative examples. All the loss function I have seen so far (i'm still a student) compare the true value of y with an estimated value of y.

I am a bit confused, thus I have some questions :

(I will re-read the paper again and delete some questions if I find an anwser.)

  • Is it a common way to implement loss functions like yours (by comparing a positive example with a negative one)? Why is it more efficient than simply comparing the true value of y with the estimated value of y as in classical statistical methods.

  • Is there a technical term for that kind of loss function? I have searched on Google about "ranking learning" and found a book called "Learning to Rank for Information Retrieval". Am I searching in the right direction?

  • You say in the article: "Recently, deep ranking networks have been used in several computer vision applications and have shown state-of-the-art performances." I have never encountered the notion of "deep ranking networks" in my degree. Does that notion mean "A deep neural network where the loss function gives a ranking score." ? If not, what is it then? When I search on Google, the only thing I find is a paper called Learning Fine-grained Image Similarity with Deep Ranking but no Wiki page, nor any webpage explaining what is a ranking network.

Two simple questions.

Thanks a lot for the nice work! It is very interesting and I decide to reproduce your work.
However, I am new to action detection (only have action classification experience). Before I start, may I ask two simple questions?

  1. In your paper you mentioned that you "compute features for every 16-frame video clip". However, for evaluation, you "use frame based ROC". What is the relationship between the 16-frame clip and the each frame you used in evaluation?

  2. For reproduce all your experiment, do I need to both implement both Theano and Keras? Or I can use one of them?

Error

Error in Test_Anomaly_Detector_public.py
theano.sandbox.cuda.use('gpu0')
AttributeError: 'module' object has no attribute 'cuda'

This is my .theanorc file:
[global]
floatX = float32
device = cuda0

[gpuarray]
preallocate = 0.8

training.py

In the train_public.py, there are 1610 normal and abnormal video, batchsize*32=1920. When loop1<960, the abnormal video is given a 0 label, but the abnormal video is only 810. The extra 150 will cause the normal video to be labeled as abnormal video.Can you help me solve this problem?

Extracting c3d features error

When i tried to extract c3d features,i got this error.
Screenshot (error)

After this,I have installed caffe and while i make 'build caffe' in visual studio,i got all the caffe projects unloaded.
How can I overcome this issue?Help me,

Error when running DEMO_GUI.py

Hello,

I have initialized environments based on your readme file:

  • Keras version 1.1.0

  • Theano 1.0.2

  • Python 3

  • Ubuntu 16.04

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'")

Sequence of execution

Hey @WaqasSultani,

What is the sequence of execution of the scripts?
Is it Training_Anomaly_detector, Testing and then evaluate_anomaly_detector.m? Please correct me if I'm wrong.

problem when excute Demo_Gui.py

Hi,
I get this question when I run Demo_Gui.py :
('/home/lab118/jck/AnomalyDetectionCVPR2018-master/SampleVideos/Explosion008_x264.mp4', '')
Traceback (most recent call last):
File "Demo_GUI.py", line 170, in SingleBrowse
cap = cv2.VideoCapture(video_path)
TypeError: an integer is required (got type tuple)
could you tell me why?
thanks so much

C3D model used in tests

According to what I have been able to review of the article and the source code, you did not perform training of the C3D neural network. I would like to know where I find the model files in the C3D directory tree. Thank you.

Temporal_Annotations

Hello! Where can I get the temporal annotations for the testing videos? The paper says that you annotate the start time and end time for testing the performance on the test set, but I can not find the annotations from the dataset link. Thank you!

Some problems about DEMO.GUI & TrainingAnomalyDetector_public

hi
I want to run the demo_Gui ,but i met some problems
First, PyQt4 can't work .So I replace it with PyQt5.
Then I met that.

('/home/victor/PycharmProjects/AnomalyDetectionCVPR2018/SampleVideos/Abuse/Abuse002_x264.mp4', 'All Files (*)')
Traceback (most recent call last):
File "/home/victor/PycharmProjects/AnomalyDetectionCVPR2018/Demo_GUI.py", line 168, in SingleBrowse
cap = cv2.VideoCapture(video_path)
TypeError: an integer is required (got type tuple)

I have no idea with that.

Then I also met some problem in the TrainingAnomalyDetector_public.

/home/victor/anaconda3/envs/AnomalyDetectionCVPR2018/bin/python /home/victor/PycharmProjects/AnomalyDetectionCVPR2018/TrainingAnomalyDetector_public.py
Using Theano backend.
/home/victor/.local/lib/python3.5/site-packages/theano/gpuarray/dnn.py:184: UserWarning: Your cuDNN version is more recent than Theano. If you encounter problems, try updating Theano or downgrading cuDNN to a version >= v5 and <= v7.
warnings.warn("Your cuDNN version is more recent than "
Using cuDNN version 7301 on context None
Mapped name None to device cuda: GeForce GTX 960M (0000:01:00.0)
Create Model
Traceback (most recent call last):
File "/home/victor/PycharmProjects/AnomalyDetectionCVPR2018/TrainingAnomalyDetector_public.py", line 279, in
model.compile(loss=custom_objective, optimizer=adagrad)
File "/home/victor/.local/lib/python3.5/site-packages/keras/models.py", line 547, in compile
**kwargs)
File "/home/victor/.local/lib/python3.5/site-packages/keras/engine/training.py", line 622, in compile
sample_weight, mask)
File "/home/victor/.local/lib/python3.5/site-packages/keras/engine/training.py", line 324, in weighted
score_array = fn(y_true, y_pred)
File "/home/victor/PycharmProjects/AnomalyDetectionCVPR2018/TrainingAnomalyDetector_public.py", line 253, in custom_objective
sub_sum_l1 = sub_sum_l1[:n_exp]
File "/home/victor/.local/lib/python3.5/site-packages/theano/tensor/var.py", line 572, in getitem
return theano.tensor.subtensor.advanced_subtensor(self, *args)
File "/home/victor/.local/lib/python3.5/site-packages/theano/gof/op.py", line 615, in call
node = self.make_node(*inputs, **kwargs)
File "/home/victor/.local/lib/python3.5/site-packages/theano/tensor/subtensor.py", line 2227, in make_node
return super(AdvancedSubtensor, self).make_node(x, *index)
File "/home/victor/.local/lib/python3.5/site-packages/theano/tensor/subtensor.py", line 2178, in make_node
index = tuple(map(as_index_variable, index))
File "/home/victor/.local/lib/python3.5/site-packages/theano/tensor/subtensor.py", line 2072, in as_index_variable
return make_slice(idx)
File "/home/victor/.local/lib/python3.5/site-packages/theano/gof/op.py", line 615, in call
node = self.make_node(*inputs, **kwargs)
File "/home/victor/.local/lib/python3.5/site-packages/theano/tensor/type_other.py", line 39, in make_node
list(map(as_int_none_variable, inp)),
File "/home/victor/.local/lib/python3.5/site-packages/theano/tensor/type_other.py", line 20, in as_int_none_variable
raise TypeError('index must be integers')
TypeError: index must be integers


I can't fix it.And I think the version can't match between the cudnn and Theano wasn't the reason casue
it.
I would really really appreciate it if you share a solution
thanks a lot !

Error in running Demo.py and TrainingAnomalyDetector_public.py

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?

custom loss function bug

Hello,
seems like you have a bug in line 267 in TrainingAnomalyDetector_public.py

sub_z = T.maximum(1 - Sub_Abn + Sub_Nor[ii], 0)

shouldn't it be Sub_Abn[ii]?

python module error

Hi,

I am using python 2.7, theano 1.0.2 and keras 1.1.0 and facing the below error while running the training module.

Connected to pydev debugger (build 182.4129.34)
Using TensorFlow backend.
Create Model
2018-08-30 15:19:32.201695: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Traceback (most recent call last):
File "/opt/pycharm-2018.2.2/helpers/pydev/pydevd.py", line 1664, in
main()
File "/opt/pycharm-2018.2.2/helpers/pydev/pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/opt/pycharm-2018.2.2/helpers/pydev/pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/msiddiqui/algorythma/AnomalyDetection_CVPR2018/TrainingAnomalyDetector_public.py", line 32, in
model.add(Dropout(0.6))
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/tensorflow_backend.py", line 1304, in in_train_phase
x = tf.python.control_flow_ops.cond(tf.cast(_LEARNING_PHASE, 'bool'),
AttributeError: 'module' object has no attribute 'python'
Exception TypeError: TypeError("'NoneType' object is not callable",) in <function _remove at 0x7f9bf157a7d0> ignored

About environments

Hello!
I have been studying your paper and I'd like to demo your code.
But I have trouble in about python environments.
Could you please upload the environmnets list that you used?
Thank you in advance.

Demo

Hello Sir,
Could you please provide a Demo for the execution of this project

Thank You

dataset download error

hi, I'm studying your paper recently, and found the question that: ucf crime dataset can not be downloaded, the error information is "You don't have permission to access /cchen/UCF_Crimes.tar.gz on this server.Apache/2.4.7 (Ubuntu) Server at crcv.ucf.edu Port 80"?
what cause this issue?
thanks a lot~

Extract features without using C3D

Hi @WaqasSultani and @lrd8715923,

I am a starter on deep learning, I noticed you mentioned to replace C3D feature extraction with I3D or Multifiber or R(2+1)D methods. May I know is there any guides or sample codes to extract features by these methods? Like the input data format and how to export the result from other models. Thanks in advance.

Results don't match for same videos in dataset

Dear sir,

Thank you for your great work, it is really amazing. I have been able to extract features using c3d (caffe2) version. After getting the features for 32 segments, Segment_Features (32x4096). When I tested this for random robbery or accident videos from youtube. the anomaly scores were in e-06 or e-07. So I downloaded the dataset and tested for explosion008 video in dataset. I got different feature matrix and anomaly scores from those provided in sample videos of explosion8. I have shared feature vectors of sample and computed features. Kindly suggest what I could be doing wrong here and how I can reproduce exactly same results. Thank you.
output_segment_explosion8.txt
Explosion008_x264.txt

Training error

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?

Implementation details

@WaqasSultani Hi, thank you for the awesome code base. I'm trying to train the model, but notice some minor differences between your code and the paper.

  1. Learning rate: You mentioned in your paper that you use a lr=0.001, but in here, you set lr to 0.01.

  2. Model weight L2 regularization. In your paper, you specified lambda3=0.01, but in here, you set it to 0.001.

  3. Did you use learning rate decay? Or you just use constant learning rate during all 20K iterations? Thanks.

  4. Is there a possibility to share your training log with me? I can get a AUC score of 74.4 really quick, like within 2K iterations, and then the accuracy remains the same. I couldn't get to 75.41 as you report in your paper. It would be really helpful if you can share your training log.

Thank you very much, looking forward to your reply.

[C3D v.1.0] Failed to execute: sh c3d_sport1m_feature_extraction_frm.sh

I'm running the project in a docker container, but I can not execute the command sh c3d_sport1m_feature_extraction_frm.sh from the C3D Feature Extraction session of the C3D User Guide.

I have cuda_8.0.44_linux-ubuntu-16.04 installed.

I've also tried the Google Colabotative project, and it gives the same execution error when it arrives at that step. Google Colabotative project

Can anybody help me?

$user:/C3D/C3D-v1.0/examples/c3d_feature_extraction# sh c3d_sport1m_feature_extraction_frm.sh

[...]
v_BaseballPitch_g01_c01/000103.jpg
v_BaseballPitch_g01_c01/000104.jpg
v_BaseballPitch_g01_c01/000105.jpg
v_BaseballPitch_g01_c01/000106.jpg
v_BaseballPitch_g01_c01/000107.jpg
WARNING: Logging before InitGoogleLogging() is written to STDERR
E0613 21:09:21.729588 30662 common.cpp:31] Cannot create Cublas handle. Cublas won't be available.
E0613 21:09:21.738553 30662 common.cpp:38] Cannot create Curand generator. Curand won't be available.
F0613 21:09:21.747910 30662 common.cpp:68] Check failed: error == cudaSuccess (30 vs. 0) unknown error
*** Check failure stack trace: ***
Aborted (core dumped)

error about theano reshape and other things

Hi Mr.Sultani, very like your paper and idea, but I ran into some problems while I'm trying to run your code. I think the main problem is that my packages' version are different from yours. I've installed keras, theano and python etc using anaconda, here's my packages info:
theano 1.0.2 py35h6bb024c_0
keras 1.1.1 py35_0
python 3.5.5 hc3d631a_4
this is the main packages you mentioned and i didn't find keras 1.1.0 so I used 1.1.1 instead. I suppose tensorflow is not required but anaconda installed it while I was trying to install keras. And here's tensorflow's info:
tensorflow 1.9.0 mkl_py35h5be851a_1

There's some else packages that are required, such as path.py. I created a new enviroment for this paper, so I need to install everything this work needs.
After install everything I think may be of help, I ran "python TrainingAnomalyDetector_public.py " ans I ran this problem:
Traceback (most recent call last): File "TrainingAnomalyDetector_public.py", line 281, in <module> model.compile(loss=custom_objective, optimizer=adagrad) File "/home/xwbian/anaconda2/envs/keras/lib/python3.5/site-packages/keras/models.py", line 553, in compile **kwargs) File "/home/xwbian/anaconda2/envs/keras/lib/python3.5/site-packages/keras/engine/training.py", line 630, in compile sample_weight, mask) File "/home/xwbian/anaconda2/envs/keras/lib/python3.5/site-packages/keras/engine/training.py", line 332, in weighted score_array = fn(y_true, y_pred) File "TrainingAnomalyDetector_public.py", line 204, in custom_objective y_true = T.flatten(y_true) File "/home/xwbian/anaconda2/envs/keras/lib/python3.5/site-packages/theano/tensor/basic.py", line 5276, in flatten x_reshaped = x.reshape(dims) AttributeError: 'Tensor' object has no attribute 'reshape'

I'm not sure what is causing this problem, so would you mind to take a look?
Look forward to your concern and really hope that you can make a more detailed README. Great work, please let me say it again.

Ambiguity in the paper regarding the generations of bags (txt file)

It is written: (in the implementation details section): "We compute C3D features for every 16-frame video clip." - However, the flow diagram shows that there are 32 segments videos ( = 32 instances) per video (per bag). Does it means that the frames per instances is related to the number of frames of the video being processed. Am I wrong somewhere? (that is, only some frames for a short video and a huge amount of frame for a very long video)

I am confused since I don't know how you exactly generated the txt files durig the C3D features. By looking at your samples, it seems that all files contain 32 x 4096D. Can I assume that you did something like :

for each video V
    1. bag = list()
    2. nb_frames_in_one_instance = int (nb_frames in V / 32)
    3. for i in range(32)
        3.1. f = generate C3D features for the frames (i*nb_frames_in_one_instance) to (i*nb_frames_in_one_instance) + nb_frames_in_one_instance.
        3.2. bag.append(f)
    4. save bag in a text file

?

I do not understand why they say "every 16-frame video clip".

confusion matrix

Hi,
I was just wondering how the confusion matrix of the model looks like.

Thanks

loss when training

Hi,WaqasSultani
What is the loss value when you train the network?I don't know whether my loss value is right.It's 0.29 after training。
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.