Closed Bachuganesh2812 closed 1 year ago
Probably your input image shape was not correct. Please check the input layer of the notebook.
On Tue, Jul 4, 2023 at 9:54 PM Bachuganesh2812 @.***> wrote:
Got this error when i am trying to fit the model
ValueError Traceback (most recent call last) Cell In[27], line 2 1 #Model ----> 2 history = model.fit( 3 train_generator, 4 validation_data = validation_generator, 5 epochs = 20, 6 verbose = 1, 7 callbacks=[ ], #add here 8 )
File /opt/conda/lib/python3.10/site-packages/keras/utils/traceback_utils.py:70, in filter_traceback..error_handler(*args, *kwargs) 67 filtered_tb = _process_traceback_frames(e.traceback*) 68 # To get the full stack trace, call: 69 # tf.debugging.disable_traceback_filtering() ---> 70 raise e.with_traceback(filtered_tb) from None 71 finally: 72 del filtered_tb
File /tmp/
autograph_generated_fileo15m2msk.py:15, in outer_factory..inner_factory..tf__train_function(iterator) 13 try: 14 do_return = True ---> 15 retval = ag_.converted_call(ag__.ld(step_function), (ag.ld(self), ag.ld(iterator)), None, fscope) 16 except: 17 do_return = False
File /tmp/ autograph_generated_fileg1npkw3m.py:14, in outer_factory..inner_factory..tf__call(self, images) 12 patches = ag.converted_call(ag.ld(tf).image.extract_patches, (), dict(images=ag.ld(images), sizes=[1, ag.ld(self).patch_size, ag.ld(self).patch_size, 1], strides=[1, ag.ld(self).patch_size, ag.ld(self).patch_size, 1], rates=[1, 1, 1, 1], padding='VALID'), fscope) 13 patch_dims = ag.ld(patches).shape[-1] ---> 14 patches = ag__.converted_call(ag.ld(tf).reshape, (ag.ld(patches), [ag.ld(batch_size), -1, ag__.ld(patch_dims)]), None, fscope) 15 try: 16 do_return = True
ValueError: in user code:
File "/opt/conda/lib/python3.10/site-packages/keras/engine/training.py", line 1284, in train_function * return step_function(self, iterator) File "/opt/conda/lib/python3.10/site-packages/keras/engine/training.py", line 1268, in step_function outputs = model.distribute_strategy.run(run_step, args=(data,)) File "/opt/conda/lib/python3.10/site-packages/keras/engine/training.py", line 1249, in run_step outputs = model.train_step(data) File "/opt/conda/lib/python3.10/site-packages/keras/engine/training.py", line 1050, in train_step y_pred = self(x, training=True) File "/opt/conda/lib/python3.10/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler raise e.with_traceback(filtered_tb) from None File "/tmp/autograph_generated_fileg1npkw3m.py", line 14, in tfcall patches = ag.converted_call(ag.ld(tf).reshape, (ag.ld(patches), [ag__.ld(batch_size), -1, ag.ld(patch_dims)]), None, fscope)
ValueError: Exception encountered when calling layer 'patches_1' (type Patches).
in user code:
File "/tmp/ipykernel_32/3701414816.py", line 16, in call * patches = tf.reshape(patches, [batch_size, -1, patch_dims]) ValueError: Tried to convert 'shape' to a tensor and failed. Error: None values not supported.
Call arguments received by layer 'patches_1' (type Patches): • images=tf.Tensor(shape=(None, None, None, None), dtype=float32)
— Reply to this email directly, view it on GitHub https://github.com/PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/APRDXMVN2JHSEKQV4XNYFTTXOQ4DTANCNFSM6AAAAAAZ55H3U4 . You are receiving this because you are subscribed to this thread.Message ID: <PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method/issues/1 @github.com>
Thanks for responding to my problem. I don’t think the problem will be with the input shape, as per your code the ImageDataGenerator function has the target size set, so it will resize the image to that size I think so. As per your suggestions, sir, I have rechecked the code, and the issue remains the same. I believe that the error is the part where no patches are being generated. I will be really grateful if you can help me out in resolving this error. By the way, I like your approach is solving the retina disease classification by stacking both convolution and Vision Transformers.
I rechecked my code and the problem occurred because of the package update. There is no other valid reason that a patch will not be generated. I am having some issues with my google drive storage, so I am currently having some problems with working with this code. If I am able to sort out the code I will update the repository. Please let me know if you have sorted it out already.
Respected sir, Thanks for your response. The paper is every informative and helped in my research work in fundus image classification. If possible can you share me the libraries version you have used early, i will try to recreate the same environment so that the code can be run without any problem. I will definitely look up for resolving the error while using the current version.
With regards, Bachu Ganesh
On Thu, Jul 13, 2023, 10:39 AM Pramit Dutta @.***> wrote:
Dear Ganesh, First of all, sorry for the late reply. I rechecked my code and the problem occurred because of the package update. There is no other valid reason that a patch will not be generated. It's good to know that you liked the work. The work is published recently. If you want to know more, see the publication here "https://www.mdpi.com/2313-433X/9/7/140". I am having some issues with my google drive storage, so I am currently having some problems with working with this code. If I am able to sort out the code I will update the repository. Please let me know if you have sorted it out already. With regards Pramit Dutta Portfolio: https://pramitdutta1999.github.io/portfolio/
On Thu, Jul 6, 2023 at 1:06 PM Bachuganesh2812 @.***> wrote:
Respected Sir, This is Ganesh on other sir. Thanks for responding to my problem. I don’t think that the problem will be with input shape as per your code the ImageDataGenerator function has the target size set, so it will resize the image to that size I think so. As per you suggestions sir I have rechecked the code and the issue remains the same. I believe that the error is the part as no patches are being generated. It will be really grateful if you can help me out in resolving this error. By the way I like you approach is solving the retina disease classification by stacking both convolution and Vision Transformers. With regards,Bachu Ganesh. Sent from Mail for Windows From: Pramit DuttaSent: 05 July 2023 22:39To: PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-MethodCc: Bachuganesh2812; AuthorSubject: Re: [PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method] Fit issue (Issue #1) Probably your input image shape was not correct. Please check the input layer of the notebook. On Tue, Jul 4, 2023 at 9:54 PM Bachuganesh2812 ***@***.***> wrote: > Got this error when i am trying to fit the model > ------------------------------ > > ValueError Traceback (most recent call last) > Cell In[27], line 2 > 1 #Model > ---->2 history = model.fit( > 3 train_generator, > 4 validation_data = validation_generator, > 5 epochs = 20, > 6 verbose = 1, > 7 callbacks=[ ],
add here > 8 ) > > File >
/opt/conda/lib/python3.10/site-packages/keras/utils/traceback_utils.py:70,
in filter_traceback..error_handler(*args, *kwargs) > 67 filtered_tb = _process_traceback_frames(e.traceback) > 68 # To get the full stack trace, call: > 69 # tf.debugging.disable_traceback_filtering() > ---> 70 raise e.with_traceback(filtered_tb) from None > 71 finally: > 72 del filtered_tb > > File /tmp/ > > > autograph_generated_fileo15m2msk.py:15, in > outer_factory..inner_factory..tftrain_function(iterator) 13 try: 14 doreturn = True ---> 15 retval = ag*.converted_call(ag.ld(step_function), > (ag.ld(self), ag.ld(iterator)), None, fscope) > 16 except: > 17 do_return = False >
File /tmp/ > autograph_generated_fileg1npkw3m.py:14, in > outer_factory..inner_factory..tf__call(self, images) 12 patches = ag.converted_call(ag.ld(tf).image.extract_patches, > (), dict(images=ag.ld(images), sizes=[1, ag.ld(self).patch_size, > ag.ld(self).patch_size, 1], strides=[1, ag__.ld(self).patch_size, > ag__.ld(self).patch_size, 1], rates=[1, 1, 1, 1], padding='VALID'), fscope)
13 patch_dims = ag.ld(patches).shape[-1] > ---> 14 patches = ag.converted_call(ag.ld(tf).reshape, > (ag.ld(patches), [ag__.ld(batch_size), -1, ag__.ld(patch_dims)]), None, > fscope) > 15 try: 16 do_return = True > > ValueError: in user code: > > File "/opt/conda/lib/python3.10/site-packages/keras/engine/training.py", line 1284, in train_function * > return step_function(self, iterator) > File "/opt/conda/lib/python3.10/site-packages/keras/engine/training.py", line 1268, in step_function > outputs = model.distribute_strategy.run(run_step, args=(data,)) > File "/opt/conda/lib/python3.10/site-packages/keras/engine/training.py", line 1249, in run_step > outputs = model.train_step(data) > File "/opt/conda/lib/python3.10/site-packages/keras/engine/training.py", line 1050, in train_step > y_pred = self(x, training=True) > File
"/opt/conda/lib/python3.10/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler > raise e.with_traceback(filtered_tb) from None > File "/tmp/autograph_generated_fileg1npkw3m.py", line 14, in tfcall
patches = ag.converted_call(ag.ld(tf).reshape, (ag.ld(patches), [ag__.ld(batch_size), -1, ag.ld(patch_dims)]), None, fscope) > > ValueError: Exception encountered when calling layer 'patches_1' (type Patches). > > in user code: > > File "/tmp/ipykernel_32/3701414816.py", line 16, in call * > patches = tf.reshape(patches, [batch_size, -1, patch_dims]) > > ValueError: Tried to convert 'shape' to a tensor and failed. Error: None values not supported. > > > Call arguments received by layer 'patches_1' (type Patches): > • images=tf.Tensor(shape=(None, None, None, None), dtype=float32) > > — > Reply to this email directly, view it on GitHub > <
or unsubscribe > <
https://github.com/notifications/unsubscribe-auth/APRDXMVN2JHSEKQV4XNYFTTXOQ4DTANCNFSM6AAAAAAZ55H3U4>
. > You are receiving this because you are subscribed to this thread.Message > ID: >
<PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method/issues/1
@github.com> > —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
— Reply to this email directly, view it on GitHub < https://github.com/PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method/issues/1#issuecomment-1623106745>,
or unsubscribe < https://github.com/notifications/unsubscribe-auth/APRDXMU6ZJLULZJY3DZHOODXOZPXNANCNFSM6AAAAAAZ55H3U4>
. You are receiving this because you commented.Message ID:
<PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method/issues/1/1623106745
@github.com>
— Reply to this email directly, view it on GitHub https://github.com/PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method/issues/1#issuecomment-1633554877, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXS7C6IDYHSHBM7VUQKRAI3XP57G7ANCNFSM6AAAAAAZ55H3U4 . You are receiving this because you authored the thread.Message ID: <PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method/issues/1/1633554877 @github.com>
The TensorFlow 2.9.2 version was used. Hope it might help! Looking forward to your work on fundus image classification
Respected sir, Thank you for the information sir. I will try with the following package version and will update you sir.
Thanks & Regards Bachu Ganesh
On Fri, Jul 14, 2023, 10:38 AM Pramit Dutta @.***> wrote:
Mr. Bachu, The TensorFlow 2.9.2 version was used. Hope it might help! With Regard Pramit Dutta
— Reply to this email directly, view it on GitHub https://github.com/PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method/issues/1#issuecomment-1635280117, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXS7C6KAZCRZQ7D23YLMSNTXQDH6DANCNFSM6AAAAAAZ55H3U4 . You are receiving this because you authored the thread.Message ID: <PramitDutta1999/Conv-ViT-A-Convolution-and-Vision-Transformer-Based-Hybrid-Feature-Extraction-Method/issues/1/1635280117 @github.com>
Got this error when i am trying to fit the model
ValueError Traceback (most recent call last) Cell In[27], line 2 1 #Model ----> 2 history = model.fit( 3 train_generator, 4 validation_data = validation_generator, 5 epochs = 20, 6 verbose = 1, 7 callbacks=[ ], #add here 8 )
File /opt/conda/lib/python3.10/site-packages/keras/utils/traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.traceback)
68 # To get the full stack trace, call:
69 #
tf.debugging.disable_traceback_filtering()
---> 70 raise e.with_traceback(filtered_tb) from None 71 finally: 72 del filtered_tbFile /tmp/autograph_generated_fileo15m2msk.py:15, in outer_factory..inner_factory..tf train_function(iterator)
13 try:
14 doreturn = True
---> 15 retval = ag.converted_call(ag__.ld(step_function), (ag.ld(self), ag__.ld(iterator)), None, fscope)
16 except:
17 do_return = False
File /tmp/autograph_generated_fileg1npkw3m.py:14, in outer_factory..inner_factory..tf call(self, images)
12 patches = ag.converted_call(ag__.ld(tf).image.extract_patches, (), dict(images=ag.ld(images), sizes=[1, ag.ld(self).patch_size, ag__.ld(self).patch_size, 1], strides=[1, ag.ld(self).patch_size, ag.ld(self).patch_size, 1], rates=[1, 1, 1, 1], padding='VALID'), fscope)
13 patch_dims = ag.ld(patches).shape[-1]
---> 14 patches = ag.converted_call(ag.ld(tf).reshape, (ag.ld(patches), [ag__.ld(batch_size), -1, ag.ld(patch_dims)]), None, fscope)
15 try:
16 do_return = True
ValueError: in user code: