How to do transfer learning on a pre-trained ResNet50 with different image size Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Moderator Election Q&A - Questionnaire 2019 Community Moderator Election ResultsWhere to find pre-trained models for transfer learningWhy do pre-trained CNNs use low image resolution?Visualizing ConvNet filters using my own fine-tuned network resulting in a “NoneType” when running: K.gradients(loss, model.input)[0]Simple prediction with KerasHow to set input for proper fit with lstm?Pre-trained CNN for one-shot learningValue error in Merging two different models in kerasValue of loss and accuracy does not change over EpochsIN CIFAR 10 DATASETWhy do I need pre-trained weights in transfer learning?

Models of set theory where not every set can be linearly ordered

Gastric acid as a weapon

Diagram with tikz

How to deal with a team lead who never gives me credit?

How to recreate this effect in Photoshop?

What's the difference between `auto x = vector<int>()` and `vector<int> x`?

Do I really need recursive chmod to restrict access to a folder?

How to motivate offshore teams and trust them to deliver?

Output the ŋarâþ crîþ alphabet song without using (m)any letters

Single word antonym of "flightless"

Determinant is linear as a function of each of the rows of the matrix.

Is a manifold-with-boundary with given interior and non-empty boundary essentially unique?

Can inflation occur in a positive-sum game currency system such as the Stack Exchange reputation system?

When to stop saving and start investing?

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

When -s is used with third person singular. What's its use in this context?

Is there a concise way to say "all of the X, one of each"?

When is phishing education going too far?

Right-skewed distribution with mean equals to mode?

Check which numbers satisfy the condition [A*B*C = A! + B! + C!]

What is the longest distance a 13th-level monk can jump while attacking on the same turn?

What does '1 unit of lemon juice' mean in a grandma's drink recipe?

Why are there no cargo aircraft with "flying wing" design?

Why is "Captain Marvel" translated as male in Portugal?



How to do transfer learning on a pre-trained ResNet50 with different image size



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Moderator Election Q&A - Questionnaire
2019 Community Moderator Election ResultsWhere to find pre-trained models for transfer learningWhy do pre-trained CNNs use low image resolution?Visualizing ConvNet filters using my own fine-tuned network resulting in a “NoneType” when running: K.gradients(loss, model.input)[0]Simple prediction with KerasHow to set input for proper fit with lstm?Pre-trained CNN for one-shot learningValue error in Merging two different models in kerasValue of loss and accuracy does not change over EpochsIN CIFAR 10 DATASETWhy do I need pre-trained weights in transfer learning?










0












$begingroup$


I have a pretrained ResNet model which is trained on 64x64 images. I would like to do transfer learning with new dataset that contains 128x128 images.



I am loading the model like:



 train_generator = train_datagen.flow_from_directory(
train_data_dir,
target_size=(img_size, img_size),
batch_size=batch_size,
subset='training') # set as training data

validation_generator = train_datagen.flow_from_directory(
train_data_dir, # same directory as training data
target_size=(img_size, img_size),
batch_size=batch_size,
subset='validation') # set as validation data


model = ResNet50(include_top=False, weights=None, input_shape=(64,64,3))
model.load_weights("a trained model weights on 64x64")

model.layers.pop()
for layer in model.layers:
layer.trainable = False

x = model.output
x = MaxPooling2D((2,2), strides=(2,2), padding='same')(x)
x = Flatten(name='flatten')(x)
x = Dropout(0.2)(x)
x = Dense(512, activation='relu')(x)
predictions = Dense(101, activation='softmax', name='predictions')(x)

top_model = Model(inputs=model.input, outputs=predictions)

top_model.compile(loss='categorical_crossentropy',
optimizer=adam,
metrics=[accuracy])

EPOCHS = 100
BATCH_SIZE = 32
STEPS_PER_EPOCH = 4424 // BATCH_SIZE
VALIDATION_STEPS = 466 // BATCH_SIZE

callbacks = [LearningRateScheduler(schedule=Schedule(EPOCHS, initial_lr=lr_rate)),
ModelCheckpoint(str(output_dir) + "/weights.epoch:03d-val_loss:.3f-val_age_mae:.3f.hdf5",
monitor="val_age_mae",
verbose=1,
save_best_only=False,
mode="min")
]

hist = top_model.fit_generator(generator=train_set,
epochs=EPOCHS,
steps_per_epoch = STEPS_PER_EPOCH,
validation_data=val_set,
validation_steps = VALIDATION_STEPS,
verbose=1,
callbacks=callbacks)


I would like to do transfer learning based with images of 128x128 pixels. I am very new to this, how can I modify?



Is there a way to modify the model input shape? and do I need to do something with spatial size?



And which optimizer is recommended? Adam or SGD?




__________________________________________________________________________________________________
res5c_branch2a (Conv2D) (None, 2, 2, 512) 1049088 activation_46[0][0]
__________________________________________________________________________________________________
bn5c_branch2a (BatchNormalizati (None, 2, 2, 512) 2048 res5c_branch2a[0][0]
__________________________________________________________________________________________________
activation_47 (Activation) (None, 2, 2, 512) 0 bn5c_branch2a[0][0]
__________________________________________________________________________________________________
res5c_branch2b (Conv2D) (None, 2, 2, 512) 2359808 activation_47[0][0]
__________________________________________________________________________________________________
bn5c_branch2b (BatchNormalizati (None, 2, 2, 512) 2048 res5c_branch2b[0][0]
__________________________________________________________________________________________________
activation_48 (Activation) (None, 2, 2, 512) 0 bn5c_branch2b[0][0]
__________________________________________________________________________________________________
res5c_branch2c (Conv2D) (None, 2, 2, 2048) 1050624 activation_48[0][0]
__________________________________________________________________________________________________
bn5c_branch2c (BatchNormalizati (None, 2, 2, 2048) 8192 res5c_branch2c[0][0]
__________________________________________________________________________________________________
add_16 (Add) (None, 2, 2, 2048) 0 bn5c_branch2c[0][0]
activation_46[0][0]
__________________________________________________________________________________________________
activation_49 (Activation) (None, 2, 2, 2048) 0 add_16[0][0]
__________________________________________________________________________________________________
pred_age (Dense) (None, 2, 2, 101) 206848 activation_49[0][0]
==================================================================================================
Total params: 23,794,560
Trainable params: 23,741,440
Non-trainable params: 53,120
__________________________________________________________________________________________________



Getting the following error:




ValueError: Error when checking input: expected input_1 to have shape (64, 64, 3) but got array with shape (128, 128, 3)











share|improve this question











$endgroup$
















    0












    $begingroup$


    I have a pretrained ResNet model which is trained on 64x64 images. I would like to do transfer learning with new dataset that contains 128x128 images.



    I am loading the model like:



     train_generator = train_datagen.flow_from_directory(
    train_data_dir,
    target_size=(img_size, img_size),
    batch_size=batch_size,
    subset='training') # set as training data

    validation_generator = train_datagen.flow_from_directory(
    train_data_dir, # same directory as training data
    target_size=(img_size, img_size),
    batch_size=batch_size,
    subset='validation') # set as validation data


    model = ResNet50(include_top=False, weights=None, input_shape=(64,64,3))
    model.load_weights("a trained model weights on 64x64")

    model.layers.pop()
    for layer in model.layers:
    layer.trainable = False

    x = model.output
    x = MaxPooling2D((2,2), strides=(2,2), padding='same')(x)
    x = Flatten(name='flatten')(x)
    x = Dropout(0.2)(x)
    x = Dense(512, activation='relu')(x)
    predictions = Dense(101, activation='softmax', name='predictions')(x)

    top_model = Model(inputs=model.input, outputs=predictions)

    top_model.compile(loss='categorical_crossentropy',
    optimizer=adam,
    metrics=[accuracy])

    EPOCHS = 100
    BATCH_SIZE = 32
    STEPS_PER_EPOCH = 4424 // BATCH_SIZE
    VALIDATION_STEPS = 466 // BATCH_SIZE

    callbacks = [LearningRateScheduler(schedule=Schedule(EPOCHS, initial_lr=lr_rate)),
    ModelCheckpoint(str(output_dir) + "/weights.epoch:03d-val_loss:.3f-val_age_mae:.3f.hdf5",
    monitor="val_age_mae",
    verbose=1,
    save_best_only=False,
    mode="min")
    ]

    hist = top_model.fit_generator(generator=train_set,
    epochs=EPOCHS,
    steps_per_epoch = STEPS_PER_EPOCH,
    validation_data=val_set,
    validation_steps = VALIDATION_STEPS,
    verbose=1,
    callbacks=callbacks)


    I would like to do transfer learning based with images of 128x128 pixels. I am very new to this, how can I modify?



    Is there a way to modify the model input shape? and do I need to do something with spatial size?



    And which optimizer is recommended? Adam or SGD?




    __________________________________________________________________________________________________
    res5c_branch2a (Conv2D) (None, 2, 2, 512) 1049088 activation_46[0][0]
    __________________________________________________________________________________________________
    bn5c_branch2a (BatchNormalizati (None, 2, 2, 512) 2048 res5c_branch2a[0][0]
    __________________________________________________________________________________________________
    activation_47 (Activation) (None, 2, 2, 512) 0 bn5c_branch2a[0][0]
    __________________________________________________________________________________________________
    res5c_branch2b (Conv2D) (None, 2, 2, 512) 2359808 activation_47[0][0]
    __________________________________________________________________________________________________
    bn5c_branch2b (BatchNormalizati (None, 2, 2, 512) 2048 res5c_branch2b[0][0]
    __________________________________________________________________________________________________
    activation_48 (Activation) (None, 2, 2, 512) 0 bn5c_branch2b[0][0]
    __________________________________________________________________________________________________
    res5c_branch2c (Conv2D) (None, 2, 2, 2048) 1050624 activation_48[0][0]
    __________________________________________________________________________________________________
    bn5c_branch2c (BatchNormalizati (None, 2, 2, 2048) 8192 res5c_branch2c[0][0]
    __________________________________________________________________________________________________
    add_16 (Add) (None, 2, 2, 2048) 0 bn5c_branch2c[0][0]
    activation_46[0][0]
    __________________________________________________________________________________________________
    activation_49 (Activation) (None, 2, 2, 2048) 0 add_16[0][0]
    __________________________________________________________________________________________________
    pred_age (Dense) (None, 2, 2, 101) 206848 activation_49[0][0]
    ==================================================================================================
    Total params: 23,794,560
    Trainable params: 23,741,440
    Non-trainable params: 53,120
    __________________________________________________________________________________________________



    Getting the following error:




    ValueError: Error when checking input: expected input_1 to have shape (64, 64, 3) but got array with shape (128, 128, 3)











    share|improve this question











    $endgroup$














      0












      0








      0





      $begingroup$


      I have a pretrained ResNet model which is trained on 64x64 images. I would like to do transfer learning with new dataset that contains 128x128 images.



      I am loading the model like:



       train_generator = train_datagen.flow_from_directory(
      train_data_dir,
      target_size=(img_size, img_size),
      batch_size=batch_size,
      subset='training') # set as training data

      validation_generator = train_datagen.flow_from_directory(
      train_data_dir, # same directory as training data
      target_size=(img_size, img_size),
      batch_size=batch_size,
      subset='validation') # set as validation data


      model = ResNet50(include_top=False, weights=None, input_shape=(64,64,3))
      model.load_weights("a trained model weights on 64x64")

      model.layers.pop()
      for layer in model.layers:
      layer.trainable = False

      x = model.output
      x = MaxPooling2D((2,2), strides=(2,2), padding='same')(x)
      x = Flatten(name='flatten')(x)
      x = Dropout(0.2)(x)
      x = Dense(512, activation='relu')(x)
      predictions = Dense(101, activation='softmax', name='predictions')(x)

      top_model = Model(inputs=model.input, outputs=predictions)

      top_model.compile(loss='categorical_crossentropy',
      optimizer=adam,
      metrics=[accuracy])

      EPOCHS = 100
      BATCH_SIZE = 32
      STEPS_PER_EPOCH = 4424 // BATCH_SIZE
      VALIDATION_STEPS = 466 // BATCH_SIZE

      callbacks = [LearningRateScheduler(schedule=Schedule(EPOCHS, initial_lr=lr_rate)),
      ModelCheckpoint(str(output_dir) + "/weights.epoch:03d-val_loss:.3f-val_age_mae:.3f.hdf5",
      monitor="val_age_mae",
      verbose=1,
      save_best_only=False,
      mode="min")
      ]

      hist = top_model.fit_generator(generator=train_set,
      epochs=EPOCHS,
      steps_per_epoch = STEPS_PER_EPOCH,
      validation_data=val_set,
      validation_steps = VALIDATION_STEPS,
      verbose=1,
      callbacks=callbacks)


      I would like to do transfer learning based with images of 128x128 pixels. I am very new to this, how can I modify?



      Is there a way to modify the model input shape? and do I need to do something with spatial size?



      And which optimizer is recommended? Adam or SGD?




      __________________________________________________________________________________________________
      res5c_branch2a (Conv2D) (None, 2, 2, 512) 1049088 activation_46[0][0]
      __________________________________________________________________________________________________
      bn5c_branch2a (BatchNormalizati (None, 2, 2, 512) 2048 res5c_branch2a[0][0]
      __________________________________________________________________________________________________
      activation_47 (Activation) (None, 2, 2, 512) 0 bn5c_branch2a[0][0]
      __________________________________________________________________________________________________
      res5c_branch2b (Conv2D) (None, 2, 2, 512) 2359808 activation_47[0][0]
      __________________________________________________________________________________________________
      bn5c_branch2b (BatchNormalizati (None, 2, 2, 512) 2048 res5c_branch2b[0][0]
      __________________________________________________________________________________________________
      activation_48 (Activation) (None, 2, 2, 512) 0 bn5c_branch2b[0][0]
      __________________________________________________________________________________________________
      res5c_branch2c (Conv2D) (None, 2, 2, 2048) 1050624 activation_48[0][0]
      __________________________________________________________________________________________________
      bn5c_branch2c (BatchNormalizati (None, 2, 2, 2048) 8192 res5c_branch2c[0][0]
      __________________________________________________________________________________________________
      add_16 (Add) (None, 2, 2, 2048) 0 bn5c_branch2c[0][0]
      activation_46[0][0]
      __________________________________________________________________________________________________
      activation_49 (Activation) (None, 2, 2, 2048) 0 add_16[0][0]
      __________________________________________________________________________________________________
      pred_age (Dense) (None, 2, 2, 101) 206848 activation_49[0][0]
      ==================================================================================================
      Total params: 23,794,560
      Trainable params: 23,741,440
      Non-trainable params: 53,120
      __________________________________________________________________________________________________



      Getting the following error:




      ValueError: Error when checking input: expected input_1 to have shape (64, 64, 3) but got array with shape (128, 128, 3)











      share|improve this question











      $endgroup$




      I have a pretrained ResNet model which is trained on 64x64 images. I would like to do transfer learning with new dataset that contains 128x128 images.



      I am loading the model like:



       train_generator = train_datagen.flow_from_directory(
      train_data_dir,
      target_size=(img_size, img_size),
      batch_size=batch_size,
      subset='training') # set as training data

      validation_generator = train_datagen.flow_from_directory(
      train_data_dir, # same directory as training data
      target_size=(img_size, img_size),
      batch_size=batch_size,
      subset='validation') # set as validation data


      model = ResNet50(include_top=False, weights=None, input_shape=(64,64,3))
      model.load_weights("a trained model weights on 64x64")

      model.layers.pop()
      for layer in model.layers:
      layer.trainable = False

      x = model.output
      x = MaxPooling2D((2,2), strides=(2,2), padding='same')(x)
      x = Flatten(name='flatten')(x)
      x = Dropout(0.2)(x)
      x = Dense(512, activation='relu')(x)
      predictions = Dense(101, activation='softmax', name='predictions')(x)

      top_model = Model(inputs=model.input, outputs=predictions)

      top_model.compile(loss='categorical_crossentropy',
      optimizer=adam,
      metrics=[accuracy])

      EPOCHS = 100
      BATCH_SIZE = 32
      STEPS_PER_EPOCH = 4424 // BATCH_SIZE
      VALIDATION_STEPS = 466 // BATCH_SIZE

      callbacks = [LearningRateScheduler(schedule=Schedule(EPOCHS, initial_lr=lr_rate)),
      ModelCheckpoint(str(output_dir) + "/weights.epoch:03d-val_loss:.3f-val_age_mae:.3f.hdf5",
      monitor="val_age_mae",
      verbose=1,
      save_best_only=False,
      mode="min")
      ]

      hist = top_model.fit_generator(generator=train_set,
      epochs=EPOCHS,
      steps_per_epoch = STEPS_PER_EPOCH,
      validation_data=val_set,
      validation_steps = VALIDATION_STEPS,
      verbose=1,
      callbacks=callbacks)


      I would like to do transfer learning based with images of 128x128 pixels. I am very new to this, how can I modify?



      Is there a way to modify the model input shape? and do I need to do something with spatial size?



      And which optimizer is recommended? Adam or SGD?




      __________________________________________________________________________________________________
      res5c_branch2a (Conv2D) (None, 2, 2, 512) 1049088 activation_46[0][0]
      __________________________________________________________________________________________________
      bn5c_branch2a (BatchNormalizati (None, 2, 2, 512) 2048 res5c_branch2a[0][0]
      __________________________________________________________________________________________________
      activation_47 (Activation) (None, 2, 2, 512) 0 bn5c_branch2a[0][0]
      __________________________________________________________________________________________________
      res5c_branch2b (Conv2D) (None, 2, 2, 512) 2359808 activation_47[0][0]
      __________________________________________________________________________________________________
      bn5c_branch2b (BatchNormalizati (None, 2, 2, 512) 2048 res5c_branch2b[0][0]
      __________________________________________________________________________________________________
      activation_48 (Activation) (None, 2, 2, 512) 0 bn5c_branch2b[0][0]
      __________________________________________________________________________________________________
      res5c_branch2c (Conv2D) (None, 2, 2, 2048) 1050624 activation_48[0][0]
      __________________________________________________________________________________________________
      bn5c_branch2c (BatchNormalizati (None, 2, 2, 2048) 8192 res5c_branch2c[0][0]
      __________________________________________________________________________________________________
      add_16 (Add) (None, 2, 2, 2048) 0 bn5c_branch2c[0][0]
      activation_46[0][0]
      __________________________________________________________________________________________________
      activation_49 (Activation) (None, 2, 2, 2048) 0 add_16[0][0]
      __________________________________________________________________________________________________
      pred_age (Dense) (None, 2, 2, 101) 206848 activation_49[0][0]
      ==================================================================================================
      Total params: 23,794,560
      Trainable params: 23,741,440
      Non-trainable params: 53,120
      __________________________________________________________________________________________________



      Getting the following error:




      ValueError: Error when checking input: expected input_1 to have shape (64, 64, 3) but got array with shape (128, 128, 3)








      python deep-learning keras tensorflow cnn






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 2 at 10:17







      TheJokerAEZ

















      asked Apr 1 at 23:17









      TheJokerAEZTheJokerAEZ

      12




      12




















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          you did not mention your generator.



          Just add target_size to your train_set generator. it can be as follows.



          and your dataset should be in "data_generator" folder, with classes as subfolders.



          train_set =ImageDataGenerator(preprocessing_function=preprocess_input)
          train_generator= train_set.flow_from_directory('data_generator',
          target_size=(64, 64),
          color_mode='rgb',
          batch_size=32,
          class_mode='categorical',
          shuffle=True)


          vote up, if this helps ;)






          share|improve this answer









          $endgroup$












          • $begingroup$
            Ok I forgot to add this and it is similar to yours. Only without color_mode='rgb', and shuffle=True. My target size is target_size=(128,128). So if the Resnet model that is trained on weights of (64, 64), should this work with images with input shape of (128,128)? what about the spatial size? could you explain this?
            $endgroup$
            – TheJokerAEZ
            Apr 2 at 10:17











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "557"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48385%2fhow-to-do-transfer-learning-on-a-pre-trained-resnet50-with-different-image-size%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0












          $begingroup$

          you did not mention your generator.



          Just add target_size to your train_set generator. it can be as follows.



          and your dataset should be in "data_generator" folder, with classes as subfolders.



          train_set =ImageDataGenerator(preprocessing_function=preprocess_input)
          train_generator= train_set.flow_from_directory('data_generator',
          target_size=(64, 64),
          color_mode='rgb',
          batch_size=32,
          class_mode='categorical',
          shuffle=True)


          vote up, if this helps ;)






          share|improve this answer









          $endgroup$












          • $begingroup$
            Ok I forgot to add this and it is similar to yours. Only without color_mode='rgb', and shuffle=True. My target size is target_size=(128,128). So if the Resnet model that is trained on weights of (64, 64), should this work with images with input shape of (128,128)? what about the spatial size? could you explain this?
            $endgroup$
            – TheJokerAEZ
            Apr 2 at 10:17















          0












          $begingroup$

          you did not mention your generator.



          Just add target_size to your train_set generator. it can be as follows.



          and your dataset should be in "data_generator" folder, with classes as subfolders.



          train_set =ImageDataGenerator(preprocessing_function=preprocess_input)
          train_generator= train_set.flow_from_directory('data_generator',
          target_size=(64, 64),
          color_mode='rgb',
          batch_size=32,
          class_mode='categorical',
          shuffle=True)


          vote up, if this helps ;)






          share|improve this answer









          $endgroup$












          • $begingroup$
            Ok I forgot to add this and it is similar to yours. Only without color_mode='rgb', and shuffle=True. My target size is target_size=(128,128). So if the Resnet model that is trained on weights of (64, 64), should this work with images with input shape of (128,128)? what about the spatial size? could you explain this?
            $endgroup$
            – TheJokerAEZ
            Apr 2 at 10:17













          0












          0








          0





          $begingroup$

          you did not mention your generator.



          Just add target_size to your train_set generator. it can be as follows.



          and your dataset should be in "data_generator" folder, with classes as subfolders.



          train_set =ImageDataGenerator(preprocessing_function=preprocess_input)
          train_generator= train_set.flow_from_directory('data_generator',
          target_size=(64, 64),
          color_mode='rgb',
          batch_size=32,
          class_mode='categorical',
          shuffle=True)


          vote up, if this helps ;)






          share|improve this answer









          $endgroup$



          you did not mention your generator.



          Just add target_size to your train_set generator. it can be as follows.



          and your dataset should be in "data_generator" folder, with classes as subfolders.



          train_set =ImageDataGenerator(preprocessing_function=preprocess_input)
          train_generator= train_set.flow_from_directory('data_generator',
          target_size=(64, 64),
          color_mode='rgb',
          batch_size=32,
          class_mode='categorical',
          shuffle=True)


          vote up, if this helps ;)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 1 at 23:33









          William ScottWilliam Scott

          1063




          1063











          • $begingroup$
            Ok I forgot to add this and it is similar to yours. Only without color_mode='rgb', and shuffle=True. My target size is target_size=(128,128). So if the Resnet model that is trained on weights of (64, 64), should this work with images with input shape of (128,128)? what about the spatial size? could you explain this?
            $endgroup$
            – TheJokerAEZ
            Apr 2 at 10:17
















          • $begingroup$
            Ok I forgot to add this and it is similar to yours. Only without color_mode='rgb', and shuffle=True. My target size is target_size=(128,128). So if the Resnet model that is trained on weights of (64, 64), should this work with images with input shape of (128,128)? what about the spatial size? could you explain this?
            $endgroup$
            – TheJokerAEZ
            Apr 2 at 10:17















          $begingroup$
          Ok I forgot to add this and it is similar to yours. Only without color_mode='rgb', and shuffle=True. My target size is target_size=(128,128). So if the Resnet model that is trained on weights of (64, 64), should this work with images with input shape of (128,128)? what about the spatial size? could you explain this?
          $endgroup$
          – TheJokerAEZ
          Apr 2 at 10:17




          $begingroup$
          Ok I forgot to add this and it is similar to yours. Only without color_mode='rgb', and shuffle=True. My target size is target_size=(128,128). So if the Resnet model that is trained on weights of (64, 64), should this work with images with input shape of (128,128)? what about the spatial size? could you explain this?
          $endgroup$
          – TheJokerAEZ
          Apr 2 at 10:17

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Data Science Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48385%2fhow-to-do-transfer-learning-on-a-pre-trained-resnet50-with-different-image-size%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

          Luettelo Yhdysvaltain laivaston lentotukialuksista Lähteet | Navigointivalikko

          Gary (muusikko) Sisällysluettelo Historia | Rockin' High | Lähteet | Aiheesta muualla | NavigointivalikkoInfobox OKTuomas "Gary" Keskinen Ancaran kitaristiksiProjekti Rockin' High