public class DefaultTensorFlowService extends AbstractService implements TensorFlowService
TensorFlowService
.Constructor and Description |
---|
DefaultTensorFlowService() |
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
TensorFlowLibraryStatus |
getStatus() |
TensorFlowVersion |
getTensorFlowVersion() |
CachedModelBundle |
loadCachedModel(Location source,
String modelName,
String... tags)
Extracts a persisted model from the given location.
|
File |
loadFile(Location source,
String modelName,
String filePath)
Extracts a file from the given location.
|
org.tensorflow.Graph |
loadGraph(Location source,
String modelName,
String graphPath)
Extracts a graph from the given location.
|
List<String> |
loadLabels(Location source,
String modelName,
String labelsPath)
Extracts labels from the given location.
|
void |
loadLibrary()
Loads the TensorFlow library.
|
org.tensorflow.SavedModelBundle |
loadModel(Location source,
String modelName,
String... tags)
Deprecated.
|
getContext, setContext, toString
getInfo, getPriority, setInfo, setPriority
context
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
initialize, registerEventHandlers
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
@Deprecated public org.tensorflow.SavedModelBundle loadModel(Location source, String modelName, String... tags) throws IOException
TensorFlowService
loadModel
in interface TensorFlowService
source
- The location of the model, which must be structured as a ZIP
archive.modelName
- The name of the model by which the source should be
unpacked and cached as needed.tags
- Optional list of tags passed to
SavedModelBundle.load(String, String...)
.SavedModelBundle
object.IOException
- If something goes wrong reading or unpacking the
archive.
Deprecated - use TensorFlowService.loadCachedModel(Location, String, String...)
instead.public CachedModelBundle loadCachedModel(Location source, String modelName, String... tags) throws IOException
TensorFlowService
loadCachedModel
in interface TensorFlowService
source
- The location of the model, which must be structured as a ZIP
archive.modelName
- The name of the model by which the source should be
unpacked and cached as needed.tags
- Optional list of tags passed to
SavedModelBundle.load(String, String...)
.SavedModelBundle
object
wrapped by a CachedModelBundle
.IOException
- If something goes wrong reading or unpacking the
archive.public org.tensorflow.Graph loadGraph(Location source, String modelName, String graphPath) throws IOException
TensorFlowService
loadGraph
in interface TensorFlowService
source
- The location of the graph, which must be structured as a ZIP
archive.modelName
- The name of the model by which the source should be
unpacked and cached as needed.graphPath
- The name of the .pb file inside the ZIP archive containing
the graph.Graph
object.IOException
- If something goes wrong reading or unpacking the
archive.public List<String> loadLabels(Location source, String modelName, String labelsPath) throws IOException
TensorFlowService
loadLabels
in interface TensorFlowService
source
- The location of the labels, which must be structured as a ZIP
archive.modelName
- The name of the model by which the source should be
unpacked and cached as needed.labelsPath
- The name of the .txt file inside the ZIP archive
containing the labels.Graph
object.IOException
- If something goes wrong reading or unpacking the
archive.public void loadLibrary()
loadLibrary
in interface TensorFlowService
public TensorFlowVersion getTensorFlowVersion()
getTensorFlowVersion
in interface TensorFlowService
null
if no version is loaded.public TensorFlowLibraryStatus getStatus()
getStatus
in interface TensorFlowService
public File loadFile(Location source, String modelName, String filePath) throws IOException
TensorFlowService
loadFile
in interface TensorFlowService
source
- The location of the ZIP archive.modelName
- The name of the model by which the source should be
unpacked and cached as needed.filePath
- The name of the file inside the ZIP archive.File
object.IOException
- If something goes wrong reading or unpacking the
archive.public void dispose()
dispose
in interface Disposable
Copyright © 2014–2022 ImageJ. All rights reserved.