emnikhil / Sign-Language-To-Text-Conversion

Major Project - Sign Language To Text Conversion Using Python, Computer Vision and Machine Learning
MIT License
231 stars 106 forks source link

tensorflow #12

Closed shreyanscrystal closed 6 months ago

shreyanscrystal commented 6 months ago

Hi, I am running "application.py" and here is the error I am getting (I have already pip installed keras and all the other libraries)

shreyansjain@Shreyanss-MBP Shreyans's Coding % /usr/local/bin/python3 "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.p y" Traceback (most recent call last): File "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.py", line 18, in from keras.models import model_from_json File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/init.py", line 8, in from keras import _tf_keras File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/_tf_keras/init.py", line 1, in from keras._tf_keras import keras File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/_tf_keras/keras/init.py", line 8, in from keras import activations File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/activations/init.py", line 8, in from keras.src.activations import deserialize File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/init.py", line 1, in from keras.src import activations File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/activations/init.py", line 3, in from keras.src.activations.activations import elu File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/activations/activations.py", line 1, in from keras.src import backend File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/backend/init.py", line 9, in from keras.src.backend.common.dtypes import result_type File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/backend/common/init.py", line 2, in from keras.src.backend.common.dtypes import result_type File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/backend/common/dtypes.py", line 5, in from keras.src.backend.common.variables import standardize_dtype File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/backend/common/variables.py", line 10, in from keras.src.utils.module_utils import tensorflow as tf File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/utils/init.py", line 12, in from keras.src.utils.model_visualization import model_to_dot File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/utils/model_visualization.py", line 8, in from keras.src.utils import tree File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/utils/tree.py", line 12, in from tensorflow.python.trackable.data_structures import ListWrapper ModuleNotFoundError: No module named 'tensorflow'

What does this mean? Thanks

emnikhil commented 6 months ago

The error shows that you have missing libraries for Keras, try to re install tensor flow and Keras libraries again.

shreyanscrystal commented 6 months ago

I reinstalled keras (pip uninstall keras -> pip install keras) and tensorflow (pip install tensorflow). I think it solved the error but here is a new one that I am getting:

Starting Application... TypeError: function takes exactly 2 arguments (1 given)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.py", line 361, in (Application()).root.mainloop() ^^^^^^^^^^^^^ File "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.py", line 28, in init self.hs = HunSpell('en_US') ^^^^^^^^^^^^^^^^^ SystemError: <class 'HunSpell'> returned a result with an exception set

In my code, I am not able to import "HunSpell" from my hunspell library. I had a lot of issues installing it but I eventually got it to work. How can I solve this? Thank you so much for your help.

shreyanscrystal commented 6 months ago

And then I get this error too

shreyansjain@Shreyanss-MBP Shreyans's Coding % /usr/local/bin/python3 "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.p y" Starting Application... Traceback (most recent call last): File "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.py", line 361, in (Application()).root.mainloop() ^^^^^^^^^^^^^ File "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.py", line 36, in init self.loaded_model = model_from_json(self.model_json) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/models/model.py", line 571, in model_from_json return serialization_lib.deserialize_keras_object( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/saving/serialization_lib.py", line 687, in deserialize_keras_object cls = _retrieve_class_or_fn( ^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/saving/serialization_lib.py", line 805, in _retrieve_class_or_fn raise TypeError( TypeError: Could not locate class 'Sequential'. Make sure custom classes are decorated with @keras.saving.register_keras_serializable(). Full object config: {'class_name': 'Sequential', 'config': {'name': 'sequential', 'layers': [{'class_name': 'InputLayer', 'config': {'batch_input_shape': [None, 128, 128, 1], 'dtype': 'float32', 'sparse': False, 'ragged': False, 'name': 'conv2d_input'}}, {'class_name': 'Conv2D', 'config': {'name': 'conv2d', 'trainable': True, 'batch_input_shape': [None, 128, 128, 1], 'dtype': 'float32', 'filters': 32, 'kernel_size': [3, 3], 'strides': [1, 1], 'padding': 'same', 'data_format': 'channels_last', 'dilation_rate': [1, 1], 'groups': 1, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'MaxPooling2D', 'config': {'name': 'max_pooling2d', 'trainable': True, 'dtype': 'float32', 'pool_size': [2, 2], 'padding': 'valid', 'strides': [2, 2], 'data_format': 'channels_last'}}, {'class_name': 'Conv2D', 'config': {'name': 'conv2d_1', 'trainable': True, 'dtype': 'float32', 'filters': 32, 'kernel_size': [3, 3], 'strides': [1, 1], 'padding': 'same', 'data_format': 'channels_last', 'dilation_rate': [1, 1], 'groups': 1, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'MaxPooling2D', 'config': {'name': 'max_pooling2d_1', 'trainable': True, 'dtype': 'float32', 'pool_size': [2, 2], 'padding': 'valid', 'strides': [2, 2], 'data_format': 'channels_last'}}, {'class_name': 'Flatten', 'config': {'name': 'flatten', 'trainable': True, 'dtype': 'float32', 'data_format': 'channels_last'}}, {'class_name': 'Dense', 'config': {'name': 'dense', 'trainable': True, 'dtype': 'float32', 'units': 128, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'Dense', 'config': {'name': 'dense_1', 'trainable': True, 'dtype': 'float32', 'units': 128, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'Dropout', 'config': {'name': 'dropout', 'trainable': True, 'dtype': 'float32', 'rate': 0.4, 'noise_shape': None, 'seed': None}}, {'class_name': 'Dense', 'config': {'name': 'dense_2', 'trainable': True, 'dtype': 'float32', 'units': 96, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'Dropout', 'config': {'name': 'dropout_1', 'trainable': True, 'dtype': 'float32', 'rate': 0.4, 'noise_shape': None, 'seed': None}}, {'class_name': 'Dense', 'config': {'name': 'dense_3', 'trainable': True, 'dtype': 'float32', 'units': 64, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'Dense', 'config': {'name': 'dense_4', 'trainable': True, 'dtype': 'float32', 'units': 27, 'activation': 'softmax', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}]}, 'keras_version': '2.4.0', 'backend': 'tensorflow'} shreyansjain@Shreyanss-MBP Shreyans's Coding % pip install from keras.models model_from_json ERROR: Could not find a version that satisfies the requirement from (from versions: none) ERROR: No matching distribution found for from shreyansjain@Shreyanss-MBP Shreyans's Coding % /usr/local/bin/python3 "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.p y" Starting Application... Traceback (most recent call last): File "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.py", line 362, in (Application()).root.mainloop() ^^^^^^^^^^^^^ File "/Users/shreyansjain/Documents/Shreyans's Coding/eduASL/ASL model/Application.py", line 37, in init self.loaded_model = model_from_json(self.model_json) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/models/model.py", line 571, in model_from_json return serialization_lib.deserialize_keras_object( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/saving/serialization_lib.py", line 687, in deserialize_keras_object cls = _retrieve_class_or_fn( ^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/saving/serialization_lib.py", line 805, in _retrieve_class_or_fn raise TypeError( TypeError: Could not locate class 'Sequential'. Make sure custom classes are decorated with @keras.saving.register_keras_serializable(). Full object config: {'class_name': 'Sequential', 'config': {'name': 'sequential', 'layers': [{'class_name': 'InputLayer', 'config': {'batch_input_shape': [None, 128, 128, 1], 'dtype': 'float32', 'sparse': False, 'ragged': False, 'name': 'conv2d_input'}}, {'class_name': 'Conv2D', 'config': {'name': 'conv2d', 'trainable': True, 'batch_input_shape': [None, 128, 128, 1], 'dtype': 'float32', 'filters': 32, 'kernel_size': [3, 3], 'strides': [1, 1], 'padding': 'same', 'data_format': 'channels_last', 'dilation_rate': [1, 1], 'groups': 1, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'MaxPooling2D', 'config': {'name': 'max_pooling2d', 'trainable': True, 'dtype': 'float32', 'pool_size': [2, 2], 'padding': 'valid', 'strides': [2, 2], 'data_format': 'channels_last'}}, {'class_name': 'Conv2D', 'config': {'name': 'conv2d_1', 'trainable': True, 'dtype': 'float32', 'filters': 32, 'kernel_size': [3, 3], 'strides': [1, 1], 'padding': 'same', 'data_format': 'channels_last', 'dilation_rate': [1, 1], 'groups': 1, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'MaxPooling2D', 'config': {'name': 'max_pooling2d_1', 'trainable': True, 'dtype': 'float32', 'pool_size': [2, 2], 'padding': 'valid', 'strides': [2, 2], 'data_format': 'channels_last'}}, {'class_name': 'Flatten', 'config': {'name': 'flatten', 'trainable': True, 'dtype': 'float32', 'data_format': 'channels_last'}}, {'class_name': 'Dense', 'config': {'name': 'dense', 'trainable': True, 'dtype': 'float32', 'units': 128, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'Dense', 'config': {'name': 'dense_1', 'trainable': True, 'dtype': 'float32', 'units': 128, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'Dropout', 'config': {'name': 'dropout', 'trainable': True, 'dtype': 'float32', 'rate': 0.4, 'noise_shape': None, 'seed': None}}, {'class_name': 'Dense', 'config': {'name': 'dense_2', 'trainable': True, 'dtype': 'float32', 'units': 96, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'Dropout', 'config': {'name': 'dropout_1', 'trainable': True, 'dtype': 'float32', 'rate': 0.4, 'noise_shape': None, 'seed': None}}, {'class_name': 'Dense', 'config': {'name': 'dense_3', 'trainable': True, 'dtype': 'float32', 'units': 64, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'Dense', 'config': {'name': 'dense_4', 'trainable': True, 'dtype': 'float32', 'units': 27, 'activation': 'softmax', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}]}, 'keras_version': '2.4.0', 'backend': 'tensorflow'}

My camera turns on for a second and then it just turns off. How do I solve this?

sanjeeey commented 6 months ago

@shreyanscrystal Hey bro, I have got same error as yours. Can u help me how u solved these errors if u are done with this project.

shreyanscrystal commented 6 months ago

@sanjeeey nope, I'm still trying to solve the problem. I just hope that @emnikhil can respond when they have time.

emnikhil commented 6 months ago

I checked on the error, may be It is because of the function tf.keras.models.Sequential in the Model.ipynb file

Screenshot 2024-05-03 at 3 44 56 PM

So, check this link https://www.tensorflow.org/api_docs/python/tf/keras/utils/register_keras_serializable and try to update it and re run the model.

And it may resolve the issue. As I haven't worked on Machine Learning projects since 2021 so, might not be able to dive deep into the error logic.

Or try to check the error log on chatgpt may be you can find some information from there.

AyushKatre05 commented 6 months ago

i want to know how you add images in corresonding folder by training

emnikhil commented 6 months ago

@AyushKatre05 There are two python files TrainingDataCollection.py and TestingDataCollection.py which I have created and used for adding images to the training and testing folders. So, you can use those files for adding more images to the training or testing folders.

rohith1921 commented 2 months ago

@shreyanscrystal Hey bro, I have got same error as yours. Can u help me how u solved these errors if u are done with this project.

hey bro i got the same error can u solve this please

shreyanscrystal commented 2 months ago

I have not been able to solve it. I just gave up after no help.

On Sun, Aug 18, 2024 at 12:29 AM rohith1921 @.***> wrote:

@shreyanscrystal https://github.com/shreyanscrystal Hey bro, I have got same error as yours. Can u help me how u solved these errors if u are done with this project.

hey bro i got the same error can u solve this please

— Reply to this email directly, view it on GitHub https://github.com/emnikhil/Sign-Language-To-Text-Conversion/issues/12#issuecomment-2295159860, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCWE4BDWEJEXA6FTMH4D5VTZSBEODAVCNFSM6AAAAABGRAVRNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGE2TSOBWGA . You are receiving this because you were mentioned.Message ID: @.*** com>

-- This is a student email account managed by Crystal Springs Uplands School. The contents of this email are governed by the laws of the state and the board policies of the school.