我有一个经过预先训练的分类器,当应用程序启动时我正在加载其权重。
TF版本1.14.0 Keras版本2.2.4
this.props.children[0]()
我正在加载具有正确ID且形状正确的给定图像,并且每次从分类器获得不同的预测
def create_discriminators_256(self):
inp_256 = Input(shape = [256, 256, 3])
conv256_filters=32
x=Conv2D(filters = conv256_filters, kernel_size = 3, padding = 'same', activation = 'relu', kernel_initializer = 'he_normal')(inp_256)
x = d_block(x, 64) #128
x = d_block(x, 128) #64
x = d_block(x, 192) #32
x = d_block(x, 256) #16
x = d_block(x, 320) #8
x = d_block(x, 320) #4
x = Conv2D(filters = 128, kernel_size = 3, padding = 'same',activation="relu", kernel_initializer = 'he_normal')(x)
x = Dropout(0.4)(x)
x = Conv2D(filters = 1, kernel_size = 3, padding = 'same', kernel_initializer = 'he_normal')(x)
x = Dropout(0.4)(x)
x = GlobalAveragePooling2D()(x)
model_D_256 = Model(inputs = [inp_256], outputs = x)
def d_block(inp, fil):
r = Conv2D(filters = fil, kernel_size = 3, padding = 'same', kernel_initializer = 'he_normal')(inp)
r = LeakyReLU(0.01)(r)
r = AveragePooling2D()(r)
r = Conv2D(filters = fil, kernel_size = 3, padding = 'same', kernel_initializer = 'he_normal')(r)
out = LeakyReLU(0.01)(r)
return out
我检查了加载后分类器网络的权重是否始终相同,因此问题似乎来自于预测函数。
这里没有进行任何培训,因为我正在加载预先训练的模型的重量。
有什么想法吗?