gpt4 book ai didi

tensorflow - super (类型,对象): obj must be an instance or subtype of type in Keras

转载 作者:行者123 更新时间:2023-12-03 09:38:00 25 4
gpt4 key购买 nike

我实现了以下使用带有 Tensorflow 后端的 Keras 从头开始​​构建微型 yolo v2

我的代码在 Keras 2.1.5 中运行良好
但是当我更新到 Keras 2.1.6 时,我遇到了一个错误

""kernel_constraint=无,

TypeError: super(type, obj): obj must be an instance or subtype of type ""
请帮帮我
非常感谢

import tensorflow as tf
import keras
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten,
Reshape, LeakyReLU, BatchNormalization

def yolo():
model = Sequential()
model.add(Conv2D(16,(3,3), padding='same',input_shape=(416,416,3),data_format='channels_last'))
model.add(LeakyReLU(alpha=0.1))
model.add(MaxPooling2D(pool_size=(2,2)))

model.add(Conv2D(32,(3,3), padding='same'))
model.add(BatchNormalization(axis=-1))
model.add(LeakyReLU(alpha=0.1))
model.add(MaxPooling2D(pool_size=(2,2)))

model.add(Conv2D(64,(3,3), padding='same'))
model.add(BatchNormalization(axis=-1))
model.add(LeakyReLU(alpha=0.1))
model.add(MaxPooling2D(pool_size=(2,2)))

model.add(Conv2D(128,(3,3), padding='same'))
model.add(BatchNormalization(axis=-1))
model.add(LeakyReLU(alpha=0.1))
model.add(MaxPooling2D(pool_size=(2,2)))

model.add(Conv2D(128,(3,3), padding='same'))
model.add(BatchNormalization(axis=-1))
model.add(LeakyReLU(alpha=0.1))
model.add(MaxPooling2D(pool_size=(2,2)))

model.add(Conv2D(12,(1,1), padding='same'))
model.add(BatchNormalization(axis=-1))
model.add(LeakyReLU(alpha=0.1))

model.add(Reshape((13,13,2,6)))
return model

model = yolo()
model.summary()

最佳答案

这可能是由于更新后没有重新启动python内核而导致的。

关于tensorflow - super (类型,对象): obj must be an instance or subtype of type in Keras,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50231039/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com