Quick question - urgent help! #181
-
Hi friends, Taking this exceptional class right now and ran into an error. Was running this on 2 Food classes. def create_model(model_url, num_classes=2): Args: Returns: #Download the pretrained model and save it as a Keras layer #Create our own model ]) return model #Create EfficientNet model #Compile our efficientnet model Let's fit our efficientnet model to the dataefficientnet_history = efficientnet_model.fit(train_data, ValueError: logits and labels must have the same shape ((None, 2) vs (None, 1)) #where is this shape error coming from and how do I fix it? Been working on it for very long! Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Hey @JoshKonoff, I guess the error is the Even though you working with a two-class classification scenario, it comes under a binary classification which means that the end neuron should be one. Solution : So use Let me know if this doesn't fix the error !! |
Beta Was this translation helpful? Give feedback.
-
Glad that I could help !! Usually in a Binary Classification problem output neuron is
While on the other hand, Multi-class Classification uses several output neurons, where the
|
Beta Was this translation helpful? Give feedback.
-
Hi Gaurxvreddy, Quick question... Plot the learning rate versus the losslrs = 1e-4 * (10 ** (np.arange(100)/20)) ValueError: x and y must have same first dimension, but have shapes (100,) and (5,) When I tried to get the ndims of x and y then it crashed. https://colab.research.google.com/drive/1ZeYLIXVJliOL5QAS2VuDbOPZ3khmb_Rt?usp=sharing Thank you very much! Josh |
Beta Was this translation helpful? Give feedback.
-
Hey @JoshK68, I guess you're referring to this code snippet from Daniel's notebook : If then, here Daniel had trained his model for So you need to have only 5 X-axis values, for that: replace
Here the x and y, your referring to is completely different, I guess what you're referring to is the |
Beta Was this translation helpful? Give feedback.
Glad that I could help !!
Usually in a Binary Classification problem output neuron is
1
. Let's take an example of the Pizza/Steak problem.0.0
and0.5
itsPizza
0.5
and1.0
itsSteak
While on the other hand, Multi-class Classification uses several output neurons, where the
no. output neurons = no. of classes