Git Product home page Git Product logo

human-action-recognition-with-keras's Issues

Update your `Conv2D` call to the Keras 2 API

When i run the code i get the following warnings. Which leads to an error at the end.

Using TensorFlow backend.
/home/farshid/PycharmProjects/HumanActionRecognition/Main.py:67: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), name="conv1_1", activation="relu")`
  model.add(Convolution2D(64, 3, 3, activation='relu', name='conv1_1'))
/home/farshid/PycharmProjects/HumanActionRecognition/Main.py:69: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), name="conv1_2", activation="relu")`
  model.add(Convolution2D(64, 3, 3, activation='relu', name='conv1_2'))
/home/farshid/PycharmProjects/HumanActionRecognition/Main.py:73: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), name="conv2_1", activation="relu")`
  model.add(Convolution2D(128, 3, 3, activation='relu', name='conv2_1'))
/home/farshid/PycharmProjects/HumanActionRecognition/Main.py:75: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), name="conv2_2", activation="relu")`
  model.add(Convolution2D(128, 3, 3, activation='relu', name='conv2_2'))
Traceback (most recent call last):
  File "/home/farshid/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 671, in _call_cpp_shape_fn_impl
    input_tensors_as_shapes, status)
  File "/home/farshid/anaconda3/lib/python3.5/contextlib.py", line 66, in __exit__
    next(self.gen)
  File "/home/farshid/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_2/MaxPool' (op: 'MaxPool') with input shapes: [?,1,112,128].

"whole_model.h5" not found

Hi,
I noticed that in row 36 the pre-trained model whole_model.h5 is used. I can't find it in your depository. Anyone ones where to find it? Thanks.

tensorflow.python.framework.errors_impl.InvalidArgumentError: Negative dimension size caused by subtracting 2 from 1 for 'MaxPool_1' (op: 'MaxPool') with input shapes: [?,1,112,128].

Hi,I run 'python3 HumanActionRecognition.py', then get this, have you ever happened?

Using TensorFlow backend.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 670, in _call_cpp_shape_fn_impl
status)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py", line 66, in exit
next(self.gen)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 469, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Negative dimension size caused by subtracting 2 from 1 for 'MaxPool_1' (op: 'MaxPool') with input shapes: [?,1,112,128].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "HumanActionRecognition.py", line 75, in
model.add(MaxPooling2D((2, 2), strides=(2, 2)))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/models.py", line 332, in add
output_tensor = layer(self.outputs[0])
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/engine/topology.py", line 572, in call
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/engine/topology.py", line 635, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/engine/topology.py", line 166, in create_node
output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/layers/pooling.py", line 160, in call
dim_ordering=self.dim_ordering)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/layers/pooling.py", line 210, in _pooling_function
pool_mode='max')
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2866, in pool2d
x = tf.nn.max_pool(x, pool_size, strides, padding=padding)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/ops/nn_ops.py", line 1793, in max_pool
name=name)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 1598, in _max_pool
data_format=data_format, name=name)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
op_def=op_def)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2397, in create_op
set_shapes_for_outputs(ret)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1757, in set_shapes_for_outputs
shapes = shape_func(op)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1707, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn
debug_python_shape_fn, require_shape_fn)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/python/framework/common_shapes.py", line 675, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Negative dimension size caused by subtracting 2 from 1 for 'MaxPool_1' (op: 'MaxPool') with input shapes: [?,1,112,128].

ValueError: Layer weight shape (3, 3, 224, 64) not compatible with provided weight shape (64, 3, 3, 3)

Using Theano backend.
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
Traceback (most recent call last):
File "HumanActionRecognition.py", line 110, in
model.layers[k].set_weights(weights)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/engine/topology.py", line 985, in set_weights
'provided weight shape ' + str(w.shape))
ValueError: Layer weight shape (3, 3, 224, 64) not compatible with provided weight shape (64, 3, 3, 3)

ImportError: No module named regularizers

Using Theano backend.
Traceback (most recent call last):
File "HumanActionRecognition.py", line 18, in
from regularizers import EigenvalueRegularizer
ImportError: No module named regularizers

I have used the command ¨sudo pip install git+git://github.com/fchollet/keras.git --upgrade¨ to get the new keras,but still come up this problem?help!

Question regarding top_model_weights_path

Hi, I'm pretty new to deep-learning and keras in general. I want to know about that top-model weights file (Line No: 34). Where do I get that file (can you attach it)? or how do I train to get that .h5 file? I followed that blog.keras.io post but his top layer is different from yours and also he is training on dog vs cat (only 2 labels) whereas you are training on a dataset having ten output labels. I in fact tried modifying his code by replacing his top layer with your specifications. When I use the resulting bottleneck_fc_model.h5 as the file for your program, some dimension mismatch error is occurring. Any help?

ZeroDivisionError: integer division or modulo by zero

I ran the line:
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,exception_verbosity=high python HumanActionRecognition.py

for 160 epochs initially, then for 120 and finally for 10. Each time I keep getting this error:

22424/22424 [==============================] - 620s - loss: 12.7184 - mean_squared_logarithmic_error: 0.0349 - acc: 0.4296 - val_loss: 1.5969 - val_mean_squared_logarithmic_error: 0.0334 - val_acc: 0.4687
Traceback (most recent call last):
  File "HumanActionRecognition.py", line 173, in <module>
    aux = model.predict_generator(test_generator, nb_test_samples)
  File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 945, in predict_generator
    pickle_safe=pickle_safe)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1634, in predict_generator
    outs = self.predict_on_batch(x)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1268, in predict_on_batch
    self.internal_input_shapes)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 70, in standardize_input_data
    'Found: ' + str(data)[:200] + '...')
Exception: Error when checking : data should be a Numpy array, or list/dict of Numpy arrays. Found: None

...
Exception in thread Thread-12:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 425, in data_generator_task
    generator_output = next(generator)
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 596, in next
    index_array, current_index, current_batch_size = next(self.index_generator)
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 444, in _flow_index
    current_index = (self.batch_index * batch_size) % N
ZeroDivisionError: integer division or modulo by zero

However, I did get a 65.3 MB whole_model.h5 file at the end of it. Could you guide me if this error is worth ignoring? How does this actually work?

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.