Download Pretrained Models¶
flyvis_cli.download_pretrained_models ¶
calculate_sha256 ¶
calculate_sha256(file_path)
Calculate the SHA256 checksum of a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
str
|
Path to the file. |
required |
Returns:
Type | Description |
---|---|
str
|
The SHA256 checksum as a hexadecimal string. |
Source code in flyvis_cli/download_pretrained_models.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
download_and_unpack_files ¶
download_and_unpack_files(folder_id, destination_dir, api_key, skip_large_files=False)
Download and unpack files from a Google Drive folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder_id
|
str
|
The ID of the Google Drive folder. |
required |
destination_dir
|
str
|
The local directory to save and unpack the files. |
required |
api_key
|
str
|
The Google Drive API key. |
required |
skip_large_files
|
bool
|
Whether to skip downloading large files. |
False
|
Note
This function creates the destination directory if it doesn’t exist, downloads ZIP files from the specified Google Drive folder, checks their checksums, and unpacks them.
Source code in flyvis_cli/download_pretrained_models.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
main ¶
main()
Main function to handle command line arguments and initiate the download process.
Source code in flyvis_cli/download_pretrained_models.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
usage:
flyvis download-pretrained [-h] [--skip_large_files]
or
download_pretrained_models.py [-h] [--skip_large_files]
Download pretrained models and UMAP clustering results. This script downloads two ZIP files from Google Drive:
1. results_pretrained_models.zip: Contains pretrained neural networks.
2. results_umap_and_clustering.zip: Contains UMAP embeddings and clustering.
The files are downloaded and unpacked to the 'data' directory in the project root.
options:
-h, --help show this help message and exit
--skip_large_files Skip downloading large files. If set, only 'results_pretrained_models.zip' will be downloaded, and 'results_umap_and_clustering.zip' will be skipped.