basicsr.utils.download_util

basicsr.utils.download_util.download_file_from_google_drive(file_id, save_path)[source]

Download files from google drive.

Reference: https://stackoverflow.com/questions/25010369/wget-curl-large-file-from-google-drive

Parameters:
  • file_id (str) – File id.

  • save_path (str) – Save path.

basicsr.utils.download_util.get_confirm_token(response)[source]
basicsr.utils.download_util.load_file_from_url(url, model_dir=None, progress=True, file_name=None)[source]

Load file form http url, will download models if necessary.

Reference: https://github.com/1adrianb/face-alignment/blob/master/face_alignment/utils.py

Parameters:
  • url (str) – URL to be downloaded.

  • model_dir (str) – The path to save the downloaded model. Should be a full path. If None, use pytorch hub_dir. Default: None.

  • progress (bool) – Whether to show the download progress. Default: True.

  • file_name (str) – The downloaded file name. If None, use the file name in the url. Default: None.

Returns:

The path to the downloaded file.

Return type:

str

basicsr.utils.download_util.save_response_content(response, destination, file_size=None, chunk_size=32768)[source]