easycv.datasets.classification.data_sources package

class easycv.datasets.classification.data_sources.ClsSourceCifar10(root, split, download=True)[source]

Bases: object

CLASSES = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
__init__(root, split, download=True)[source]

Initialize self. See help(type(self)) for accurate signature.

class easycv.datasets.classification.data_sources.ClsSourceCifar100(root, split, download=True)[source]

Bases: object

CLASSES = None
__init__(root, split, download=True)[source]

Initialize self. See help(type(self)) for accurate signature.

class easycv.datasets.classification.data_sources.ClsSourceImageListByClass(root, list_file, m_per_class=2, delimeter=' ', split_huge_listfile_byrank=False, cache_path='data/', max_try=20)[source]

Bases: object

Get the same m_per_class samples by the label idx.

Parameters
  • list_file – str / list(str), str means a input image list file path, this file contains records as image_path label in list_file list(str) means multi image list, each one contains some records as image_path label

  • root – str / list(str), root path for image_path, each list_file will need a root.

  • m_per_class – num of samples for each class.

  • delimeter – str, delimeter of each line in the list_file

  • split_huge_listfile_byrank – Adapt to the situation that the memory cannot fully load a huge amount of data list. If split, data list will be split to each rank.

  • cache_path – if split_huge_listfile_byrank is true, cache list_file will be saved to cache_path.

  • max_try – int, max try numbers of reading image

__init__(root, list_file, m_per_class=2, delimeter=' ', split_huge_listfile_byrank=False, cache_path='data/', max_try=20)[source]

Initialize self. See help(type(self)) for accurate signature.

class easycv.datasets.classification.data_sources.ClsSourceImageList(list_file, root='', delimeter=' ', split_huge_listfile_byrank=False, split_label_balance=False, cache_path='data/', class_list=None)[source]

Bases: object

data source for classification :param list_file: str / list(str), str means a input image list file path,

this file contains records as image_path label in list_file list(str) means multi image list, each one contains some records as image_path label

Parameters
  • root – str / list(str), root path for image_path, each list_file will need a root, if len(root) < len(list_file), we will use root[-1] to fill root list.

  • delimeter – str, delimeter of each line in the list_file

  • split_huge_listfile_byrank – Adapt to the situation that the memory cannot fully load a huge amount of data list. If split, data list will be split to each rank.

  • split_label_balance – if split_huge_listfile_byrank is true, whether split with label balance

  • cache_path – if split_huge_listfile_byrank is true, cache list_file will be saved to cache_path.

__init__(list_file, root='', delimeter=' ', split_huge_listfile_byrank=False, split_label_balance=False, cache_path='data/', class_list=None)[source]

Initialize self. See help(type(self)) for accurate signature.

static parse_list_file(list_file, root, delimeter, label_dict={})[source]
class easycv.datasets.classification.data_sources.ClsSourceItag(list_file, root='', class_list=None)[source]

Bases: easycv.datasets.classification.data_sources.image_list.ClsSourceImageList

data source itag for classification :param list_file: str / list(str), str means a input image list file path,

this file contains records as image_path label in list_file list(str) means multi image list, each one contains some records as image_path label

__init__(list_file, root='', class_list=None)[source]

Initialize self. See help(type(self)) for accurate signature.

static parse_list_file(list_file, label_dict, auto_collect_labels=True)[source]
class easycv.datasets.classification.data_sources.ClsSourceImageNetTFRecord(list_file='', root='', file_pattern=None, cache_path='data/cache/', max_try=10)[source]

Bases: object

data source for imagenet tfrecord.

__init__(list_file='', root='', file_pattern=None, cache_path='data/cache/', max_try=10)[source]

Initialize self. See help(type(self)) for accurate signature.

class easycv.datasets.classification.data_sources.ClsSourceCUB(*args, ann_file, image_class_labels_file, train_test_split_file, test_mode, data_prefix, **kwargs)[source]

Bases: object

The CUB-200-2011 Dataset. Support the CUB-200-2011 Dataset. Comparing with the CUB-200 Dataset, there are much more pictures in CUB-200-2011. :param ann_file: the annotation file.

images.txt in CUB.

Parameters
  • image_class_labels_file (str) – the label file. image_class_labels.txt in CUB.

  • train_test_split_file (str) – the split file. train_test_split_file.txt in CUB.

CLASSES = ['Black_footed_Albatross', 'Laysan_Albatross', 'Sooty_Albatross', 'Groove_billed_Ani', 'Crested_Auklet', 'Least_Auklet', 'Parakeet_Auklet', 'Rhinoceros_Auklet', 'Brewer_Blackbird', 'Red_winged_Blackbird', 'Rusty_Blackbird', 'Yellow_headed_Blackbird', 'Bobolink', 'Indigo_Bunting', 'Lazuli_Bunting', 'Painted_Bunting', 'Cardinal', 'Spotted_Catbird', 'Gray_Catbird', 'Yellow_breasted_Chat', 'Eastern_Towhee', 'Chuck_will_Widow', 'Brandt_Cormorant', 'Red_faced_Cormorant', 'Pelagic_Cormorant', 'Bronzed_Cowbird', 'Shiny_Cowbird', 'Brown_Creeper', 'American_Crow', 'Fish_Crow', 'Black_billed_Cuckoo', 'Mangrove_Cuckoo', 'Yellow_billed_Cuckoo', 'Gray_crowned_Rosy_Finch', 'Purple_Finch', 'Northern_Flicker', 'Acadian_Flycatcher', 'Great_Crested_Flycatcher', 'Least_Flycatcher', 'Olive_sided_Flycatcher', 'Scissor_tailed_Flycatcher', 'Vermilion_Flycatcher', 'Yellow_bellied_Flycatcher', 'Frigatebird', 'Northern_Fulmar', 'Gadwall', 'American_Goldfinch', 'European_Goldfinch', 'Boat_tailed_Grackle', 'Eared_Grebe', 'Horned_Grebe', 'Pied_billed_Grebe', 'Western_Grebe', 'Blue_Grosbeak', 'Evening_Grosbeak', 'Pine_Grosbeak', 'Rose_breasted_Grosbeak', 'Pigeon_Guillemot', 'California_Gull', 'Glaucous_winged_Gull', 'Heermann_Gull', 'Herring_Gull', 'Ivory_Gull', 'Ring_billed_Gull', 'Slaty_backed_Gull', 'Western_Gull', 'Anna_Hummingbird', 'Ruby_throated_Hummingbird', 'Rufous_Hummingbird', 'Green_Violetear', 'Long_tailed_Jaeger', 'Pomarine_Jaeger', 'Blue_Jay', 'Florida_Jay', 'Green_Jay', 'Dark_eyed_Junco', 'Tropical_Kingbird', 'Gray_Kingbird', 'Belted_Kingfisher', 'Green_Kingfisher', 'Pied_Kingfisher', 'Ringed_Kingfisher', 'White_breasted_Kingfisher', 'Red_legged_Kittiwake', 'Horned_Lark', 'Pacific_Loon', 'Mallard', 'Western_Meadowlark', 'Hooded_Merganser', 'Red_breasted_Merganser', 'Mockingbird', 'Nighthawk', 'Clark_Nutcracker', 'White_breasted_Nuthatch', 'Baltimore_Oriole', 'Hooded_Oriole', 'Orchard_Oriole', 'Scott_Oriole', 'Ovenbird', 'Brown_Pelican', 'White_Pelican', 'Western_Wood_Pewee', 'Sayornis', 'American_Pipit', 'Whip_poor_Will', 'Horned_Puffin', 'Common_Raven', 'White_necked_Raven', 'American_Redstart', 'Geococcyx', 'Loggerhead_Shrike', 'Great_Grey_Shrike', 'Baird_Sparrow', 'Black_throated_Sparrow', 'Brewer_Sparrow', 'Chipping_Sparrow', 'Clay_colored_Sparrow', 'House_Sparrow', 'Field_Sparrow', 'Fox_Sparrow', 'Grasshopper_Sparrow', 'Harris_Sparrow', 'Henslow_Sparrow', 'Le_Conte_Sparrow', 'Lincoln_Sparrow', 'Nelson_Sharp_tailed_Sparrow', 'Savannah_Sparrow', 'Seaside_Sparrow', 'Song_Sparrow', 'Tree_Sparrow', 'Vesper_Sparrow', 'White_crowned_Sparrow', 'White_throated_Sparrow', 'Cape_Glossy_Starling', 'Bank_Swallow', 'Barn_Swallow', 'Cliff_Swallow', 'Tree_Swallow', 'Scarlet_Tanager', 'Summer_Tanager', 'Artic_Tern', 'Black_Tern', 'Caspian_Tern', 'Common_Tern', 'Elegant_Tern', 'Forsters_Tern', 'Least_Tern', 'Green_tailed_Towhee', 'Brown_Thrasher', 'Sage_Thrasher', 'Black_capped_Vireo', 'Blue_headed_Vireo', 'Philadelphia_Vireo', 'Red_eyed_Vireo', 'Warbling_Vireo', 'White_eyed_Vireo', 'Yellow_throated_Vireo', 'Bay_breasted_Warbler', 'Black_and_white_Warbler', 'Black_throated_Blue_Warbler', 'Blue_winged_Warbler', 'Canada_Warbler', 'Cape_May_Warbler', 'Cerulean_Warbler', 'Chestnut_sided_Warbler', 'Golden_winged_Warbler', 'Hooded_Warbler', 'Kentucky_Warbler', 'Magnolia_Warbler', 'Mourning_Warbler', 'Myrtle_Warbler', 'Nashville_Warbler', 'Orange_crowned_Warbler', 'Palm_Warbler', 'Pine_Warbler', 'Prairie_Warbler', 'Prothonotary_Warbler', 'Swainson_Warbler', 'Tennessee_Warbler', 'Wilson_Warbler', 'Worm_eating_Warbler', 'Yellow_Warbler', 'Northern_Waterthrush', 'Louisiana_Waterthrush', 'Bohemian_Waxwing', 'Cedar_Waxwing', 'American_Three_toed_Woodpecker', 'Pileated_Woodpecker', 'Red_bellied_Woodpecker', 'Red_cockaded_Woodpecker', 'Red_headed_Woodpecker', 'Downy_Woodpecker', 'Bewick_Wren', 'Cactus_Wren', 'Carolina_Wren', 'House_Wren', 'Marsh_Wren', 'Rock_Wren', 'Winter_Wren', 'Common_Yellowthroat']
__init__(*args, ann_file, image_class_labels_file, train_test_split_file, test_mode, data_prefix, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

load_annotations()[source]
class easycv.datasets.classification.data_sources.ClsSourceImageNet1k(root, split)[source]

Bases: object

__init__(root, split)[source]
Parameters
  • root

    The root directory of the data example:if data/imagenet

    └── train

    └── n01440764 └── n01443537 └── …

    └── val

    └── n01440764 └── n01443537 └── …

    └── meta

    ├── train.txt ├── val.txt ├── …

    has input root = data/imagenet

  • split – train or val

read_data(image_path)[source]
class easycv.datasets.classification.data_sources.ClsSourceCaltech101(root, download=True)[source]

Bases: object

__init__(root, download=True)[source]

Initialize self. See help(type(self)) for accurate signature.

download(root)[source]
downloaded_exists(root)[source]
normalized_path(root)[source]
class easycv.datasets.classification.data_sources.ClsSourceCaltech256(root, download=True)[source]

Bases: object

__init__(root, download=True)[source]

Initialize self. See help(type(self)) for accurate signature.

download(root)[source]
class easycv.datasets.classification.data_sources.ClsSourceFlowers102(root, split, download=False)[source]

Bases: object

__init__(root, split, download=False)None[source]

Initialize self. See help(type(self)) for accurate signature.

download()[source]
class easycv.datasets.classification.data_sources.ClsSourceMnist(root, split, download=True)[source]

Bases: object

__init__(root, split, download=True)[source]

Initialize self. See help(type(self)) for accurate signature.

class easycv.datasets.classification.data_sources.ClsSourceFashionMnist(root, split, download=True)[source]

Bases: object

__init__(root, split, download=True)[source]

Initialize self. See help(type(self)) for accurate signature.

Submodules

easycv.datasets.classification.data_sources.cifar module

class easycv.datasets.classification.data_sources.cifar.ClsSourceCifar10(root, split, download=True)[source]

Bases: object

CLASSES = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
__init__(root, split, download=True)[source]

Initialize self. See help(type(self)) for accurate signature.

class easycv.datasets.classification.data_sources.cifar.ClsSourceCifar100(root, split, download=True)[source]

Bases: object

CLASSES = None
__init__(root, split, download=True)[source]

Initialize self. See help(type(self)) for accurate signature.

easycv.datasets.classification.data_sources.class_list module

class easycv.datasets.classification.data_sources.class_list.ClsSourceImageListByClass(root, list_file, m_per_class=2, delimeter=' ', split_huge_listfile_byrank=False, cache_path='data/', max_try=20)[source]

Bases: object

Get the same m_per_class samples by the label idx.

Parameters
  • list_file – str / list(str), str means a input image list file path, this file contains records as image_path label in list_file list(str) means multi image list, each one contains some records as image_path label

  • root – str / list(str), root path for image_path, each list_file will need a root.

  • m_per_class – num of samples for each class.

  • delimeter – str, delimeter of each line in the list_file

  • split_huge_listfile_byrank – Adapt to the situation that the memory cannot fully load a huge amount of data list. If split, data list will be split to each rank.

  • cache_path – if split_huge_listfile_byrank is true, cache list_file will be saved to cache_path.

  • max_try – int, max try numbers of reading image

__init__(root, list_file, m_per_class=2, delimeter=' ', split_huge_listfile_byrank=False, cache_path='data/', max_try=20)[source]

Initialize self. See help(type(self)) for accurate signature.

easycv.datasets.classification.data_sources.fashiongen_h5 module

class easycv.datasets.classification.data_sources.fashiongen_h5.FashionGenH5(h5file_path, return_label=True, cache_path='data/fashionGenH5')[source]

Bases: object

__init__(h5file_path, return_label=True, cache_path='data/fashionGenH5')[source]

Initialize self. See help(type(self)) for accurate signature.

easycv.datasets.classification.data_sources.image_list module

class easycv.datasets.classification.data_sources.image_list.ClsSourceImageList(list_file, root='', delimeter=' ', split_huge_listfile_byrank=False, split_label_balance=False, cache_path='data/', class_list=None)[source]

Bases: object

data source for classification :param list_file: str / list(str), str means a input image list file path,

this file contains records as image_path label in list_file list(str) means multi image list, each one contains some records as image_path label

Parameters
  • root – str / list(str), root path for image_path, each list_file will need a root, if len(root) < len(list_file), we will use root[-1] to fill root list.

  • delimeter – str, delimeter of each line in the list_file

  • split_huge_listfile_byrank – Adapt to the situation that the memory cannot fully load a huge amount of data list. If split, data list will be split to each rank.

  • split_label_balance – if split_huge_listfile_byrank is true, whether split with label balance

  • cache_path – if split_huge_listfile_byrank is true, cache list_file will be saved to cache_path.

__init__(list_file, root='', delimeter=' ', split_huge_listfile_byrank=False, split_label_balance=False, cache_path='data/', class_list=None)[source]

Initialize self. See help(type(self)) for accurate signature.

static parse_list_file(list_file, root, delimeter, label_dict={})[source]
class easycv.datasets.classification.data_sources.image_list.ClsSourceItag(list_file, root='', class_list=None)[source]

Bases: easycv.datasets.classification.data_sources.image_list.ClsSourceImageList

data source itag for classification :param list_file: str / list(str), str means a input image list file path,

this file contains records as image_path label in list_file list(str) means multi image list, each one contains some records as image_path label

__init__(list_file, root='', class_list=None)[source]

Initialize self. See help(type(self)) for accurate signature.

static parse_list_file(list_file, label_dict, auto_collect_labels=True)[source]

easycv.datasets.classification.data_sources.imagenet_tfrecord module

class easycv.datasets.classification.data_sources.imagenet_tfrecord.ClsSourceImageNetTFRecord(list_file='', root='', file_pattern=None, cache_path='data/cache/', max_try=10)[source]

Bases: object

data source for imagenet tfrecord.

__init__(list_file='', root='', file_pattern=None, cache_path='data/cache/', max_try=10)[source]

Initialize self. See help(type(self)) for accurate signature.

easycv.datasets.classification.data_sources.utils module

easycv.datasets.classification.data_sources.utils.split_listfile_byrank(list_file, label_balance, save_path='data/', delimeter=' ')[source]