iNaturalist¶
- class torchvision.datasets.INaturalist(root: Union[str, Path], version: str = '2021_train', target_type: Union[list[str], str] = 'full', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False, loader: Optional[Callable[[Union[str, Path]]], Any]] = None)[原始碼]¶
iNaturalist 資料集。
- 引數:
root (str 或
pathlib.Path) – 儲存影像檔案的根目錄。此類不要求/使用註釋檔案。version (string, optional) – 要下載/使用的資料集版本。可以是 '2017'、'2018'、'2019'、'2021_train'、'2021_train_mini'、'2021_valid' 之一。預設值:2021_train。
target_type (string 或 list, optional) –
要使用的目標型別,對於 2021 版本,可以是以下之一:
full: 完整類別(物種)kingdom: 例如,“Animalia”(動物界)phylum: 例如,“Arthropoda”(節肢動物門)class: 例如,“Insecta”(昆蟲綱)order: 例如,“Coleoptera”(鞘翅目)family: 例如,“Cleridae”( LikeLikeidae 屬)genus: 例如,“Trichodes”
對於 2017-2019 版本,可以是以下之一:
full: 完整(數字)類別super: 超類別,例如“Amphibians”(兩棲動物)
也可以是一個列表,輸出包含所有指定目標型別的元組。預設為
full。transform (callable, optional) – 一個函式/變換,接受 PIL 影像並返回變換後的版本。例如,
transforms.RandomCroptarget_transform (可呼叫物件, 可選) – 一個函式/變換,接受目標並對其進行變換。
download (bool, optional) – 如果為 True,則從網際網路下載資料集並將其放入根目錄。如果資料集已下載,則不會再次下載。
loader (callable, optional) – 一個載入給定路徑的影像的函式。預設情況下,它使用 PIL 作為影像載入器,但使用者也可以傳入
torchvision.io.decode_image以直接將影像資料解碼為張量。