Class DL4JResources


  • public class DL4JResources
    extends Object
    • Constructor Detail

      • DL4JResources

        public DL4JResources()
    • Method Detail

      • setBaseDownloadURL

        public static void setBaseDownloadURL​(@NonNull
                                              @NonNull String baseDownloadURL)
        Set the base download URL for (most) DL4J datasets and models.
        This usually doesn't need to be set manually unless there is some issue with the default location
        Parameters:
        baseDownloadURL - Base download URL to set. For example, https://dl4jdata.blob.core.windows.net/
      • getBaseDownloadURL

        public static String getBaseDownloadURL()
        Returns:
        The base URL hosting DL4J datasets and models
      • getURL

        public static URL getURL​(String relativeToBase)
                          throws MalformedURLException
        Get the URL relative to the base URL.
        For example, if baseURL is "https://dl4jdata.blob.core.windows.net/", and relativeToBase is "/datasets/iris.dat" this simply returns "https://dl4jdata.blob.core.windows.net/datasets/iris.dat"
        Parameters:
        relativeToBase - Relative URL
        Returns:
        URL
        Throws:
        MalformedURLException - For bad URL
      • getURLString

        public static String getURLString​(String relativeToBase)
        Get the URL relative to the base URL as a String.
        For example, if baseURL is "https://dl4jdata.blob.core.windows.net/", and relativeToBase is "/datasets/iris.dat" this simply returns "https://dl4jdata.blob.core.windows.net/datasets/iris.dat"
        Parameters:
        relativeToBase - Relative URL
        Returns:
        URL
        Throws:
        MalformedURLException - For bad URL
      • resetBaseDirectoryLocation

        public static void resetBaseDirectoryLocation()
        Reset to the default directory, or the directory set via the DL4JSystemProperties.DL4J_RESOURCES_DIR_PROPERTY system property, org.deeplearning4j.resources.directory
      • setBaseDirectory

        public static void setBaseDirectory​(@NonNull
                                            @NonNull File f)
        Set the base directory for local storage of files. Default is: new File(System.getProperty("user.home"), ".deeplearning4j")
        Parameters:
        f - Base directory to use for resources
      • getBaseDirectory

        public static File getBaseDirectory()
        Returns:
        The base storage directory for DL4J resources
      • getDirectory

        public static File getDirectory​(ResourceType resourceType,
                                        String resourceName)
        Get the storage location for the specified resource type and resource name
        Parameters:
        resourceType - Type of resource
        resourceName - Name of the resource
        Returns:
        The root directory. Creates the directory and any parent directories, if required