Skip to content

Instantly share code, notes, and snippets.

@zaleslaw
Created June 9, 2022 12:34
Show Gist options
  • Save zaleslaw/a994e3519f7a0996fde10fc26e1d4825 to your computer and use it in GitHub Desktop.
Save zaleslaw/a994e3519f7a0996fde10fc26e1d4825 to your computer and use it in GitHub Desktop.
Trains noTop model
model.use {
it.compile(
optimizer = Adam(),
loss = Losses.SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS,
metric = Metrics.ACCURACY
)
it.loadWeightsForFrozenLayers(hdfFile)
it.fit(
dataset = train,
batchSize = TRAINING_BATCH_SIZE,
epochs = EPOCHS
)
val accuracy = it.evaluate(dataset = test, batchSize = TEST_BATCH_SIZE).metrics[Metrics.ACCURACY]
println("Accuracy: $accuracy")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment