asingh33 / CNNGestureRecognizer

Gesture recognition via CNN. Implemented in Keras + Tensorflow/Theano + OpenCV
MIT License
981 stars 358 forks source link

load weights error #35

Closed TyrionZK closed 5 years ago

TyrionZK commented 5 years ago

Using TensorFlow backend.

What would you like to do ? 1- Use pretrained model for gesture recognition & layer visualization 2- Train the model (you will require image samples for training under .\imgfolder) 3- Visualize feature maps of different layers of trained model 4- Exit 1 Will load default weight file


Layer (type) Output Shape Param #

conv2d_1 (Conv2D) (None, 32, 198, 198) 320


activation_1 (Activation) (None, 32, 198, 198) 0


conv2d_2 (Conv2D) (None, 32, 196, 196) 9248


activation_2 (Activation) (None, 32, 196, 196) 0


max_pooling2d_1 (MaxPooling2 (None, 32, 98, 98) 0


dropout_1 (Dropout) (None, 32, 98, 98) 0


flatten_1 (Flatten) (None, 307328) 0


dense_1 (Dense) (None, 128) 39338112


activation_3 (Activation) (None, 128) 0


dropout_2 (Dropout) (None, 128) 0


dense_2 (Dense) (None, 5) 645


activation_4 (Activation) (None, 5) 0

Total params: 39,348,325.0 Trainable params: 39,348,325.0 Non-trainable params: 0.0


loading ori_4015imgs_weights.hdf5 Traceback (most recent call last):

File "", line 1, in runfile('E:/CNNGestureRecognizer-master/trackgesture.py', wdir='E:/CNNGestureRecognizer-master')

File "D:\ProgramData\Anaconda3\envs\gesture\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 704, in runfile execfile(filename, namespace)

File "D:\ProgramData\Anaconda3\envs\gesture\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "E:/CNNGestureRecognizer-master/trackgesture.py", line 375, in Main()

File "E:/CNNGestureRecognizer-master/trackgesture.py", line 214, in Main mod = myNN.loadCNN(0)

File "E:\CNNGestureRecognizer-master\gestureCNN.py", line 208, in loadCNN model.load_weights(fname)

File "D:\ProgramData\Anaconda3\envs\gesture\lib\site-packages\keras\models.py", line 706, in load_weights topology.load_weights_from_hdf5_group(f, layers)

File "D:\ProgramData\Anaconda3\envs\gesture\lib\site-packages\keras\engine\topology.py", line 2895, in load_weights_from_hdf5_group original_backend)

File "D:\ProgramData\Anaconda3\envs\gesture\lib\site-packages\keras\engine\topology.py", line 2836, in preprocess_weights_for_loading weights[0] = conv_utils.convert_kernel(weights[0])

File "D:\ProgramData\Anaconda3\envs\gesture\lib\site-packages\keras\utils\conv_utils.py", line 86, in convert_kernel return np.copy(kernel[slices])

File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper

File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper

File "D:\ProgramData\Anaconda3\envs\gesture\lib\site-packages\h5py_hl\dataset.py", line 553, in getitem selection = sel.select(self.shape, args, dsid=self.id)

File "D:\ProgramData\Anaconda3\envs\gesture\lib\site-packages\h5py_hl\selections.py", line 90, in select sel[args]

File "D:\ProgramData\Anaconda3\envs\gesture\lib\site-packages\h5py_hl\selections.py", line 367, in getitem raise TypeError("Indexing elements must be in increasing order")

TypeError: Indexing elements must be in increasing order


how to solve it? thanks.

psusmit commented 5 years ago

I think this "ori_4015imgs_weights.hdf5" file is corrupted or not in HDF5 format

asingh33 commented 5 years ago

Please check the ReadMe description for downloading the pretrained weight file from my google doc link. That will fix this issue.

zjy1128 commented 5 years ago

@psusmit hello ,i download ori_4015 imgs_weights.hdf5 file from google but i still meet the same problem pointed above.Do you know how to solve this problem now?What methods have you tried?

asingh33 commented 5 years ago

Ok let me check. Will get back.

zjy1128 commented 5 years ago

Ok let me check. Will get back.

Thank you very much!

asingh33 commented 5 years ago

@zjy1128
I tried to this error by creating a fresh git clone workspace of this repo. I downloaded the ori_4015imgs_weights.hdf5 weight file from the google drive and initiated the gesture tracking using option 1. However, I couldnt repro this issue.

Can you please provide me the steps that you follow to repro this error msg ?

asingh33 commented 5 years ago

Closing this issue, not able to repro on my end and no further update for a long time. Feel free to reopen if the issue is still reproducible.