get_file {keras3} | R Documentation |
Downloads a file from a URL if it not already in the cache.
Description
By default the file at the url origin
is downloaded to the
cache_dir ~/.keras
, placed in the cache_subdir datasets
,
and given the filename fname
. The final location of a file
example.txt
would therefore be ~/.keras/datasets/example.txt
.
Files in .tar
, .tar.gz
, .tar.bz
, and .zip
formats can
also be extracted.
Passing a hash will verify the file after download. The command line
programs shasum
and sha256sum
can compute the hash.
Usage
get_file(
fname = NULL,
origin = NULL,
...,
file_hash = NULL,
cache_subdir = "datasets",
hash_algorithm = "auto",
extract = FALSE,
archive_format = "auto",
cache_dir = NULL,
force_download = FALSE
)
Arguments
fname |
Name of the file. If an absolute path, e.g. |
origin |
Original URL of the file. |
... |
For forward/backward compatability. |
file_hash |
The expected hash string of the file after download. The sha256 and md5 hash algorithms are both supported. |
cache_subdir |
Subdirectory under the Keras cache dir where the file is
saved. If an absolute path, e.g. |
hash_algorithm |
Select the hash algorithm to verify the file.
options are |
extract |
|
archive_format |
Archive format to try for extracting the file.
Options are |
cache_dir |
Location to store cached files, when |
force_download |
If |
Value
Path to the downloaded file.
** Warning on malicious downloads **
Downloading something from the Internet carries a risk.
NEVER download a file/archive if you do not trust the source.
We recommend that you specify the file_hash
argument
(if the hash of the source file is known) to make sure that the file you
are getting is the one you expect.
Examples
path_to_downloaded_file <- get_file( origin = "https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz", extract = TRUE )
See Also
Other utils:
audio_dataset_from_directory()
clear_session()
config_disable_interactive_logging()
config_disable_traceback_filtering()
config_enable_interactive_logging()
config_enable_traceback_filtering()
config_is_interactive_logging_enabled()
config_is_traceback_filtering_enabled()
get_source_inputs()
image_array_save()
image_dataset_from_directory()
image_from_array()
image_load()
image_smart_resize()
image_to_array()
layer_feature_space()
normalize()
pad_sequences()
set_random_seed()
split_dataset()
text_dataset_from_directory()
timeseries_dataset_from_array()
to_categorical()
zip_lists()