mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
21 lines
482 B
Go
21 lines
482 B
Go
package tensorflow
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
tf "github.com/tensorflow/tensorflow/tensorflow/go"
|
|
|
|
"github.com/photoprism/photoprism/pkg/clean"
|
|
)
|
|
|
|
// SavedModel loads a saved TensorFlow model from the specified path.
|
|
func SavedModel(modelPath string, tags []string) (model *tf.SavedModel, err error) {
|
|
log.Infof("tensorflow: loading %s", clean.Log(filepath.Base(modelPath)))
|
|
|
|
if len(tags) == 0 {
|
|
tags = []string{"serve"}
|
|
}
|
|
|
|
return tf.LoadSavedModel(modelPath, tags, nil)
|
|
}
|