-
Notifications
You must be signed in to change notification settings - Fork 907
NASNet misleading ValueError when include_top=False and weights #78
Comments
@Waffleboy, the architecture of NASNet differs according to Thus, |
@taehoonlee Ah okay, if i want to train NASNet from scratch, as well via transfer learning on a 7 class dataset, how would you recommend me to do so? |
|
@taehoonlee thanks for your reply! I cant seem to get it to download the imagenets with weight model. the link https://github.com/titu1994/Keras-NASNet/'%20'releases/download/v1.2/NASNet-large.h5 does not work, and even in the code it default loads the no-top version instead. Is there something Im doing wrong? |
@Waffleboy, Could you share your codes? |
Sure thing @taehoonlee ,
Also the transfer learning bit doesn't seem to quite work - it doesn't compile as it says
For reference: this is the code I was using for transfer learning:
|
@Waffleboy, You should change |
Hey, thanks for your help! I've been trying various stuff over the past few days, and wonder if theres an issue with the weights of NASnet? It performs horribly (about the same as chance) even after training from scratch and via transfer learning |
@Waffleboy, The NASNet weights are fine. |
Docs are somewhat misleading. It should say something about imagenet weights not usable for different input shapes. |
Hey did you solve the image net loading issue due to mismatch of size ( your original issue ) So may be in they are released in the coming versions. Srini |
Back to NASnet, we've been getting great results from both Large and Mobile using transfer learning but with image sizes of only 50x50. This change in the Keras causes issues for us. As noted above, when you try to download NASnet for the first time on a new install, you get the 331 tile size bug mentioned because of the enforced 331 size. But on machines where the download already exists, everything works fine. We found that if you change nasnet.py, line 167 to
The code runs once again. Is this technically correct or is it problematic? P |
Thanks a lot! |
I found that Inception model took |
Wonder the same thing @doraeric . As I understand the difference comes when the input image size is even and not odd, correct? So shouldn't we be able to load the weights as long as our input size is odd?
Most of my images are really small, under (150x75) pixels. So it seems crazy to resize them all to (331,331), but so far NasNetlarge model with (331,331) input size is the best performer on my dataset by large. I'd just rather make it work on a smaller resolution to save computational time. |
thanks #mazatov . Loading of the NASNetmobile model and than the weights from previously downloaded 'NASNet-mobile-no-top.h5' solved my issue. |
Hi, I got the same error in tf 2.4.1. I changed line 177 (the one that was 167 for you) to require_flatten=False. Did you get any answer on the potential dangers of changing this? |
I recommend that everyone refer to this link! https://www.tensorflow.org/api_docs/python/tf/keras/applications/nasnet/NASNetLarge |
Setting a different image size with include_top = False and weights = 'imagenet' as below,
I obtain a ValueError
ValueError: When setting
include_top=Trueand loading
imagenetweights,
input_shapeshould be (331, 331, 3).
Seems strange when include_top is set to False. Should this not work?
The text was updated successfully, but these errors were encountered: