Closed rocknamx8 closed 5 years ago
@rocknamx8, Please refer to the official document.
@rocknamx8, Please refer to the official document.
Thanks, but if I have some image with random(inconstant) shape (In some situation I can't preprocess them), Is that any other means to solve it?
@rocknamx8
import numpy as np
import keras
from keras.models import Model
from keras.layers import Input, Dense, GlobalAveragePooling2D
from keras.applications.resnet50 import ResNet50
model = ResNet50(include_top=False, weights='imagenet', input_shape=(None, None, 3))
digit_a = Input(shape=(512, 512, 3))
digit_b = Input(shape=(256, 256, 3))
out_a = GlobalAveragePooling2D()(model(digit_a))
out_b = GlobalAveragePooling2D()(model(digit_b))
concatenated = keras.layers.concatenate([out_a, out_b])
out = Dense(1, activation='sigmoid')(concatenated)
classification_model = Model([digit_a, digit_b], out)
@rocknamx8
import numpy as np import keras from keras.models import Model from keras.layers import Input, Dense, GlobalAveragePooling2D from keras.applications.resnet50 import ResNet50 model = ResNet50(include_top=False, weights='imagenet', input_shape=(None, None, 3)) digit_a = Input(shape=(512, 512, 3)) digit_b = Input(shape=(256, 256, 3)) out_a = GlobalAveragePooling2D()(model(digit_a)) out_b = GlobalAveragePooling2D()(model(digit_b)) concatenated = keras.layers.concatenate([out_a, out_b]) out = Dense(1, activation='sigmoid')(concatenated) classification_model = Model([digit_a, digit_b], out)
Thanks for your patience of my question, but my means is "IF I CAN'T KNOW THE INPUT SHAPE OF IMAGE",even in some condition I'm not permitted to reshape them.
@rocknamx8, you can replace shape=(512, 512, 3)
with shape=(None, None, 3)
.
@rocknamx8, you can replace
shape=(512, 512, 3)
withshape=(None, None, 3)
.
Thanks! That's awesome!