albermax / albermax/innvestigate
This is not supposed to happen! exceptions for siamese networks
- Lenguaje dominante
- Python
- Estrellas
- 1.3k
- Forks
- 230
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
when constructing a siamese network, I am necessarily creating an embedding sub-network that I will use twice. receiving two inputs, I pass each through that single embedding network and then combine two embeddings with a `Subtract` layer. a rough pseudo-code example
```python
embedding_model = Sequential()
embedding_model = Dense(256, activation='relu')(embedding_model)
embedding_model = Dense(8, activation='relu')(embedding_model)
input_1 = Input((N,))
input_2 = Input((N,))
embedding_1 = embedding_model(input_1)
embedding_2 = embedding_model(input_2)
delta = Subtract()([embedding_1, embedding_2])
prediction = Dense(1, activation='sigmoid')(delta)
model = Model(inputs=[input_1, input_2], outputs=prediction)
model.compile(
loss='binary_crossentropy',
optimizer='adam',
metrics=['accuracy', 'binary_crossentropy']
)
```
perhaps there are multiple things going wrong here that result in a `This is not supposed to happen!` exception. for what it's worth, I've seen from other issues (e.g. https://github.com/albermax/innvestigate/issues/97) that using pre-built models as components of the `model` object passed to `innvestigate.create_analyzer` can lead to a "This is not supposed to happen!" exception. the fix in that issue is to avoid creating these model as a separate layer. perhaps I am running in to the same issue?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.