FoodNet
FoodNet copied to clipboard
Error in the build_model
While running build_model after set up the datasets I got an error
Epoch 1/30
ValueError Traceback (most recent call last) Cell In[97], line 3 1 print("Shape of training data:", no_category_train.map) 2 print("Shape of validation data:", no_category_val.map) ----> 3 flat_efficientnet.train_model( 4 x=no_category_train, 5 validation_data=no_category_val, 6 epochs=30, 7 verbose=2, 8 )
Cell In[93], line 282, in BaseModel.train_model(self, **kwargs) 280 def train_model(self, **kwargs): 281 assert self.model is not None, "No model found." --> 282 return self.model.fit(**kwargs, callbacks=self.get_callbacks())
File ~\anaconda3\lib\site-packages\keras\src\utils\traceback_utils.py:123, in filter_traceback.keras.config.disable_traceback_filtering()
--> 123 raise e.with_traceback(filtered_tb) from None
124 finally:
125 del filtered_tb
File ~\anaconda3\lib\site-packages\keras\src\losses\loss.py:87, in squeeze_or_expand_to_same_rank(x1, x2, expand_rank_1) 85 def squeeze_or_expand_to_same_rank(x1, x2, expand_rank_1=True): 86 """Squeeze/expand last dim if ranks differ from expected by exactly 1.""" ---> 87 x1_rank = len(x1.shape) 88 x2_rank = len(x2.shape) 89 if x1_rank == x2_rank:
ValueError: Cannot take the length of shape with unknown rank.
Hi, can you provide more details like the dataset setup in the folder? Just checking did you follow the exact dependencies version provided in the repository?
yeah sure,
This is the food dataset folder inside the FoodNet folder
This is the final-dataset folder inside the food dataset folder
This is the food-101 folder inside the food dataset folder
This is the nutrition5k folder inside the food dataset folder
This is the recipes5k folder inside the food dataset folder
This is the USDA-FNDDS folder inside the food dataset folder
I have a doubt regarding creation of generic folder, Whether I should create a generic folder inside a final-dataset and what it will store.
i can‘t find the dataset Recipes5k in the wedsite "http://www.ub.edu/cvub/recipes5k/" ,it seems that no longer exist,could you please help me? thank you very much!
i can‘t find the dataset Recipes5k in the wedsite "http://www.ub.edu/cvub/recipes5k/" ,it seems that no longer exist,could you please help me? thank you very much!
Hi I am also looking for it. Have you find a copy of it ?
i can‘t find the dataset Recipes5k in the wedsite "http://www.ub.edu/cvub/recipes5k/" ,it seems that no longer exist,could you please help me? thank you very much!
Hi I am also looking for it. Have you find a copy of it ?
Hey @rdaking @fenglinzhu123, hope I am not too late to the conversation. I found the exact copy in kaggle https://www.kaggle.com/datasets/terry9a9/recipes5k
This is awesome you're more than welcome
I'll get it and run the code against it again.
Thanks to you
This is awesome you're more than welcome
I'll get it and run the code against it again.
Thanks to you
Can you please give me the full working code
I would like to ask if the image in the nutrition5k part has more than 180 g. Can I only download the image part and not the video part?
While running build_model after set up the datasets I got an error
Epoch 1/30
ValueError Traceback (most recent call last) Cell In[97], line 3 1 print("Shape of training data:", no_category_train.map) 2 print("Shape of validation data:", no_category_val.map) ----> 3 flat_efficientnet.train_model( 4 x=no_category_train, 5 validation_data=no_category_val, 6 epochs=30, 7 verbose=2, 8 )
Cell In[93], line 282, in BaseModel.train_model(self, **kwargs) 280 def train_model(self, **kwargs): 281 assert self.model is not None, "No model found." --> 282 return self.model.fit(**kwargs, callbacks=self.get_callbacks())
File ~\anaconda3\lib\site-packages\keras\src\utils\traceback_utils.py:123, in filter_traceback..error_handler(*args, **kwargs) 120 filtered_tb = _process_traceback_frames(e.traceback) 121 # To get the full stack trace, call: 122 #
keras.config.disable_traceback_filtering()--> 123 raise e.with_traceback(filtered_tb) from None 124 finally: 125 del filtered_tbFile ~\anaconda3\lib\site-packages\keras\src\losses\loss.py:87, in squeeze_or_expand_to_same_rank(x1, x2, expand_rank_1) 85 def squeeze_or_expand_to_same_rank(x1, x2, expand_rank_1=True): 86 """Squeeze/expand last dim if ranks differ from expected by exactly 1.""" ---> 87 x1_rank = len(x1.shape) 88 x2_rank = len(x2.shape) 89 if x1_rank == x2_rank:
ValueError: Cannot take the length of shape with unknown rank.
Hi, I got the same error when I train the model, did you fix this error? @Likhith22