WeightDownloader
Models & Types · AiDotNet.ComputerVision.Weights
Downloads and caches pre-trained model weights from remote URLs.
For Beginners
Pre-trained weights are model parameters that have been trained on large datasets (like COCO or ImageNet). Instead of training from scratch, you can download these weights and either use them directly or fine-tune them on your own data. This class handles downloading and caching these weight files.
Constructors
| Constructor | Summary |
|---|---|
WeightDownloader() |
Creates a new weight downloader with the default cache directory. |
WeightDownloader(string cacheDirectory) |
Creates a new weight downloader with a custom cache directory. |
Methods
| Method | Summary |
|---|---|
Task DownloadAsync(string url, string localPath, IProgress<double> progress, CancellationToken cancellationToken) |
Downloads a weight file from a URL. |
Task<string> DownloadIfNeededAsync(string url, string fileName, IProgress<double> progress, CancellationToken cancellationToken) |
Downloads weights if not already cached. |
bool IsCached(string fileName) |
Checks if weights are already cached. |
bool RemoveFromCache(string fileName) |
Removes a weight file from cache. |
long GetCacheSize() |
Gets the total size of cached weights in bytes. |
string GetCachePath(string fileName) |
Gets the cached path for a weight file. |
string GetDefaultCacheDirectory() |
Gets the default cache directory for storing weights. |
void ClearCache() |
Clears all cached weights. |