Package rawDeepLearningClassifier
Class DLDownloadManager
java.lang.Object
rawDeepLearningClassifier.DLDownloadManager
Manages the downloading and unzipping of models.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Add a download listener to the array manager.void
downloadModel
(URI modelURI) Get the path to a model.downloadModel
(URI modelURI, String modelName) Get the path to a model.getModelDownloadedFile
(URL modelURL, String modelName) Get the path to the model if it has been downloaded.static String
Get the model folder - create it if it doesn't exist.static String
getModelFolder
(String modelname) Get the model folder - create it if it doesn't exist.int
Get the number of download listeners.boolean
isModelDownloaded
(URL modelURL) Check whether has been downloaded already to a default local folder?boolean
isModelDownloaded
(URL modelURL, String modelName) Check whether has been downloaded already?static void
boolean
Remove a download listener to the array manager.
-
Field Details
-
defaultModels
-
-
Constructor Details
-
DLDownloadManager
public DLDownloadManager()
-
-
Method Details
-
isModelDownloaded
Check whether has been downloaded already to a default local folder?- Parameters:
modelURI
- - the URL of the model- Returns:
-
isModelDownloaded
Check whether has been downloaded already?- Parameters:
modelName
- - the model name that has been used to name the temporary folder.modelURI
- - the URL of the model- Returns:
- true if the model has been downloaded.
-
getModelDownloadedFile
Get the path to the model if it has been downloaded.- Parameters:
modelURL
- - the URL to the modelmodelName
- - the model name. Use getModelName(modelURL) to use the default model name.- Returns:
- a file object - may not exist.
-
downloadModel
Get the path to a model. If the URI is a URL then the model is download to a local folder and the path to the local folder is returned.- Parameters:
model
- - the model to load.modelName
- - the name of the model - this is used to create the local folder name if the model is downloaded.- Returns:
- the path to the model The model might be a zip file, py file, koogu file.
-
downloadModel
Get the path to a model. If the URI is a URL then the model is download to a local folder and the path to the local folder is returned.- Parameters:
modelName
- - the name of the model - this is used to create the local folder name if the model is downloaded.model
- - the model to load.- Returns:
- the path to the model The model might be a zip file, py file, .kgu file.
-
getModelFolder
Get the model folder - create it if it doesn't exist.- Returns:
- file object for new folder
-
getModelFolder
Get the model folder - create it if it doesn't exist.- Parameters:
modelname
- - the name of the model - this is used to create the local folder name.- Returns:
- file object for new folder
-
getNumDownloadListeners
public int getNumDownloadListeners()Get the number of download listeners.- Returns:
- the number of download listeners.
-
addDownloadListener
Add a download listener to the array manager.- Parameters:
e
- - the listener to add.- Returns:
- true if the listener was added successfully.
-
removeDownladListener
Remove a download listener to the array manager.- Parameters:
e
- - the listener to remove.- Returns:
- true if the listener was removed successfully.
-
main
-
clearDownloadListeners
public void clearDownloadListeners()
-