여기에 일부 가중치 (무작위, 0 또는 기타)로 모델을 초기화하는 더미 예제가 있습니다.
def base_model(xx):
x = Dense(32)(xx)
x = Dense(8)(x)
return Model(xx,x)
inp = Input((32,32,3))
x = base_model(inp)
x = GlobalAveragePooling2D()(x.output)
x = Dropout(0.3)(x)
out = Dense(10, activation='softmax')(x)
model = Model(inp,out)
model.summary()
# set weight with random number from a uniform... you can do the same also with zeros...
model.set_weights([np.random.uniform(0,1, i.shape) for i in model.get_weights()])
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다