Код: Выделить всё
m new in python** I was creating a python model for machine learning by guide. I wrote code line by line and when i compiled there was an error "WARNING:tensorflow:Код: Выделить всё
is undefined or non-square, orКод: Выделить всё
is not in [96, 128, 160, 192, 224]. Weights for input shape (224, 224) will be loaded as the default." when in the guide there wasnЯ использую Python 3.10.0, tensorwlow 2.15.0, keras 2.15
в качестве IDE я использую pyCharm
L — слои
Код: Выделить всё
def build_model(input_shape, num_classes=196):
inputs = L.Input(input_shape)
backbone = MobileNetV2(
include_top=False,
weights="imagenet",
input_tensor=inputs,
alpha = 1.0
)
backbone.trainable = True
x = backbone.output
x = L.Conv2D(256, kernel_size=1, padding="same")(x)
x = L.BatchNormalization()(x)
x = L.Activation("relu")(x)
X = L.GlobalAveragePooling2D()(x)
x = L.Dropout(0.5)(x)
bbox = L.Dense(4, activation="sigmoid", name="bbox")(x)
label = L.Dense(num_classes, activation="softmax", name="label")(x)
model = tf.keras.Model(inputs=[inputs], outputs=[bbox, label])
return model
if __name__ == "__main__":
input_shape = (256, 320, 3)
model = build_model(input_shape)
model.summary()
Я мог бы проигнорировать это, но когда я пытаюсь обучить модель, возникает ошибка:строка 15, в tf__train_function
retval_ = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(итератор)), None, fscope)
ValueError: в коде пользователя:
Код: Выделить всё
ValueError: `logits` and `labels` must have the same shape, received ((None, 8, 10, 4) vs (None, 4)).
Подробнее здесь: https://stackoverflow.com/questions/792 ... rows-is-no
Мобильная версия