看了pytorch官方提供的tutorial中transfer learning这个例子,对其中的数据读取部分很是模糊,于是仔细分析了一番,今天写一篇博客记录一下自己所看所得。
下面这段代码最终得到了dataloader,dataloader是python中的可迭代对象,我们可以通过for循环讲数据一一取出。
data_transforms = {
'train': transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
]),
'val': transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
]),
}
data_dir = '../data/hymenoptera_data'
image_datasets = {x: datasets.ImageFolder(os.path.join(data_dir, x),
data_transforms[x])
for x in ['train', 'val']}
dataloaders = {x: torch.utils.data.DataLoader(image_datasets[x], batch_size=4,
shuffle=True, num_workers=4)
for x in ['train', 'val']}
然而问题的关键在于我们如何获得dataloader,答案是将自定义的dataset传入torch.utils.data.DataLoader
中。至于dataloader如何使用dataset工作,我会在下次在进行分析,这次的关键是dataset的制作。
其实dataset的制作我在上次的博客中也做了分析–从python中的一些特殊方法讲到pytorch的官方例子mnist(主要针对pytorch的自定义dataset中的几个特殊函数进行说明)。
需要在自定义的dataset类做到以下几点:
1. 继承torch.utils.data.Dataset
类。
2. 重写__init__
方法、__getitem__
方法、__len__
方法以及__repr__方法
(非必须),至于每个类的作用我在上篇博客已经有很详细的讲解。
下面我们看一下分类任务专用的dataset类:torchvision.datasets.ImageFolder
:
IMG_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif']
def pil_loader(path):# 根据地址读取图像
with open(path, 'rb') as f:
img = Image.open(f)
return img.convert('RGB')
class ImageFolder(DatasetFolder):
def __init__(self, root, transform=None, target_transform=None,
loader=pil_loader):
super(ImageFolder, self).__init__(root, loader, IMG_EXTENSIONS,
transform=transform,
target_transform=target_transform)
self.imgs = self.samples
这个类是一个叫做DatasetFolder类的子类,主要的功能都写在了那个类中,该类的主要作用就是传递了两个额外参数:loader
和IMG_EXTENSIONS
。loder是上面定义函数pil_loader()
的引用,该函数的作用是根据传入的图像地址进行图像读取;IMG_EXTENSIONS
定义了读取图像文件的扩展名类型。其余在调用父类__init__
方法时传入的参数在最外面就已经传入,包括root
表示路径、transform
表示要对图像进行的变换。(看第一段代码传入的参数)
接下来看DatasetFolder
类的定义:
class DatasetFolder(data.Dataset):
def __init__(self, root, loader, extensions, transform=None, target_transform=None):
classes, class_to_idx = find_classes(root)
samples = make_dataset(root, class_to_idx, extensions)
self.root = root
self.loader = loader
self.extensions = extensions
self.classes = classes
self.class_to_idx = class_to_idx
self.samples = samples
self.transform = transform
self.target_transform = target_transform
def __getitem__(self, index):
path, target = self.samples[index]
sample = self.loader(path)
if self.transform is not None:
sample = self.transform(sample)
if self.target_transform is not None:
target = self.target_transform(target)
return sample, target
def __len__(self):
return len(self.samples)
def __repr__(self):
fmt_str = 'Dataset ' + self.__class__.__name__ + '\n'
fmt_str += ' Number of datapoints: {}\n'.format(self.__len__())
fmt_str += ' Root Location: {}\n'.format(self.root)
tmp = ' Transforms (if any): '
fmt_str += '{0}{1}\n'.format(tmp, self.transform.__repr__().replace('\n', '\n' + ' ' * len(tmp)))
tmp = ' Target Transforms (if any): '
fmt_str += '{0}{1}'.format(tmp, self.target_transform.__repr__().replace('\n', '\n' + ' ' * len(tmp)))
return fmt_str
从上面代码可以看出DatasetFolder
类的定义遵从了自定义的dataset类时需要遵守的几点规则。从上篇博客我们已经知道__getitem__
方法是用来获取dataset中的数据的,但这个不是本次的重点,本次重点是为何__getitem__
方法中的代码能够实现获取数据。
首先来看下面一段测试代码,看过之后就会大致明白。这段代码将关键的函数和句子放上去进行测试。
import os
# has_file_allowed_extension函数的功能是根据文件名判断该文件是否具有所需图像类型扩展名的后缀
def has_file_allowed_extension(filename, extensions):
filename_lower = filename.lower()
return any(filename_lower.endswith(ext) for ext in extensions)
# find_classes函数的功能是根据输入的存放图像的文件夹地址,得到文件夹下面有几种图像,为每种图像分配一个数字
def find_classes(dir):
classes = [d for d in os.listdir(dir) if os.path.isdir(os.path.join(dir, d))]
classes.sort()
class_to_idx = {classes[i]: i for i in range(len(classes))}
return classes, class_to_idx
# make_dataset函数会根据图像种类字典、存放图像的文件夹地址以及扩展名列表得到每个图像的地址以及种类信息组成的列表
def make_dataset(dir, class_to_idx, extensions):
images = []
dir = os.path.expanduser(dir)
for target in sorted(os.listdir(dir)):
d = os.path.join(dir, target)
if not os.path.isdir(d):
continue
for root, _, fnames in sorted(os.walk(d)):
for fname in sorted(fnames):
if has_file_allowed_extension(fname, extensions):
path = os.path.join(root, fname)
item = (path, class_to_idx[target])
images.append(item)
return images
IMG_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif']
root = '../data/hymenoptera_data/train'
classes, class_to_idx = find_classes(root)
samples = make_dataset(root, class_to_idx, IMG_EXTENSIONS)
# 从输出结果可以看出:classes是由存放每类图像的文件夹名字组成的列表;
# class_to_idx是由每种图像的类名和为其分配的数字组成的键值对所组成的字典;
# samples是由个数与所有类图像总个数相等的元组组成的列表,元组里面的内容就对应了每张图像的地址以及它的分类编号。
# 有了这些信息,就能够通过__getitem__方法中的前两句代码:
# path, target = self.samples[index]
# sample = self.loader(path)
# 获取到图像和其对应分类了。
print(classes)
print(class_to_idx)
print(samples)
print(len(samples))
输出内容如下:
['ants', 'bees']
{'bees': 1, 'ants': 0}
[('../data/hymenoptera_data/train/ants/0013035.jpg', 0), ('../data/hymenoptera_data/train/ants/1030023514_aad5c608f9.jpg', 0), ('../data/hymenoptera_data/train/ants/1095476100_3906d8afde.jpg', 0), ('../data/hymenoptera_data/train/ants/1099452230_d1949d3250.jpg', 0), ('../data/hymenoptera_data/train/ants/116570827_e9c126745d.jpg', 0), ('../data/hymenoptera_data/train/ants/1225872729_6f0856588f.jpg', 0), ('../data/hymenoptera_data/train/ants/1262877379_64fcada201.jpg', 0), ('../data/hymenoptera_data/train/ants/1269756697_0bce92cdab.jpg', 0), ('../data/hymenoptera_data/train/ants/1286984635_5119e80de1.jpg', 0), ('../data/hymenoptera_data/train/ants/132478121_2a430adea2.jpg', 0), ('../data/hymenoptera_data/train/ants/1360291657_dc248c5eea.jpg', 0), ('../data/hymenoptera_data/train/ants/1368913450_e146e2fb6d.jpg', 0), ('../data/hymenoptera_data/train/ants/1473187633_63ccaacea6.jpg', 0), ('../data/hymenoptera_data/train/ants/148715752_302c84f5a4.jpg', 0), ('../data/hymenoptera_data/train/ants/1489674356_09d48dde0a.jpg', 0), ('../data/hymenoptera_data/train/ants/149244013_c529578289.jpg', 0), ('../data/hymenoptera_data/train/ants/150801003_3390b73135.jpg', 0), ('../data/hymenoptera_data/train/ants/150801171_cd86f17ed8.jpg', 0), ('../data/hymenoptera_data/train/ants/154124431_65460430f2.jpg', 0), ('../data/hymenoptera_data/train/ants/162603798_40b51f1654.jpg', 0), ('../data/hymenoptera_data/train/ants/1660097129_384bf54490.jpg', 0), ('../data/hymenoptera_data/train/ants/167890289_dd5ba923f3.jpg', 0), ('../data/hymenoptera_data/train/ants/1693954099_46d4c20605.jpg', 0), ('../data/hymenoptera_data/train/ants/175998972.jpg', 0), ('../data/hymenoptera_data/train/ants/178538489_bec7649292.jpg', 0), ('../data/hymenoptera_data/train/ants/1804095607_0341701e1c.jpg', 0), ('../data/hymenoptera_data/train/ants/1808777855_2a895621d7.jpg', 0), ('../data/hymenoptera_data/train/ants/188552436_605cc9b36b.jpg', 0), ('../data/hymenoptera_data/train/ants/1917341202_d00a7f9af5.jpg', 0), ('../data/hymenoptera_data/train/ants/1924473702_daa9aacdbe.jpg', 0), ('../data/hymenoptera_data/train/ants/196057951_63bf063b92.jpg', 0), ('../data/hymenoptera_data/train/ants/196757565_326437f5fe.jpg', 0), ('../data/hymenoptera_data/train/ants/201558278_fe4caecc76.jpg', 0), ('../data/hymenoptera_data/train/ants/201790779_527f4c0168.jpg', 0), ('../data/hymenoptera_data/train/ants/2019439677_2db655d361.jpg', 0), ('../data/hymenoptera_data/train/ants/207947948_3ab29d7207.jpg', 0), ('../data/hymenoptera_data/train/ants/20935278_9190345f6b.jpg', 0), ('../data/hymenoptera_data/train/ants/224655713_3956f7d39a.jpg', 0), ('../data/hymenoptera_data/train/ants/2265824718_2c96f485da.jpg', 0), ('../data/hymenoptera_data/train/ants/2265825502_fff99cfd2d.jpg', 0), ('../data/hymenoptera_data/train/ants/226951206_d6bf946504.jpg', 0), ('../data/hymenoptera_data/train/ants/2278278459_6b99605e50.jpg', 0), ('../data/hymenoptera_data/train/ants/2288450226_a6e96e8fdf.jpg', 0), ('../data/hymenoptera_data/train/ants/2288481644_83ff7e4572.jpg', 0), ('../data/hymenoptera_data/train/ants/2292213964_ca51ce4bef.jpg', 0), ('../data/hymenoptera_data/train/ants/24335309_c5ea483bb8.jpg', 0), ('../data/hymenoptera_data/train/ants/245647475_9523dfd13e.jpg', 0), ('../data/hymenoptera_data/train/ants/255434217_1b2b3fe0a4.jpg', 0), ('../data/hymenoptera_data/train/ants/258217966_d9d90d18d3.jpg', 0), ('../data/hymenoptera_data/train/ants/275429470_b2d7d9290b.jpg', 0), ('../data/hymenoptera_data/train/ants/28847243_e79fe052cd.jpg', 0), ('../data/hymenoptera_data/train/ants/318052216_84dff3f98a.jpg', 0), ('../data/hymenoptera_data/train/ants/334167043_cbd1adaeb9.jpg', 0), ('../data/hymenoptera_data/train/ants/339670531_94b75ae47a.jpg', 0), ('../data/hymenoptera_data/train/ants/342438950_a3da61deab.jpg', 0), ('../data/hymenoptera_data/train/ants/36439863_0bec9f554f.jpg', 0), ('../data/hymenoptera_data/train/ants/374435068_7eee412ec4.jpg', 0), ('../data/hymenoptera_data/train/ants/382971067_0bfd33afe0.jpg', 0), ('../data/hymenoptera_data/train/ants/384191229_5779cf591b.jpg', 0), ('../data/hymenoptera_data/train/ants/386190770_672743c9a7.jpg', 0), ('../data/hymenoptera_data/train/ants/392382602_1b7bed32fa.jpg', 0), ('../data/hymenoptera_data/train/ants/403746349_71384f5b58.jpg', 0), ('../data/hymenoptera_data/train/ants/408393566_b5b694119b.jpg', 0), ('../data/hymenoptera_data/train/ants/424119020_6d57481dab.jpg', 0), ('../data/hymenoptera_data/train/ants/424873399_47658a91fb.jpg', 0), ('../data/hymenoptera_data/train/ants/450057712_771b3bfc91.jpg', 0), ('../data/hymenoptera_data/train/ants/45472593_bfd624f8dc.jpg', 0), ('../data/hymenoptera_data/train/ants/459694881_ac657d3187.jpg', 0), ('../data/hymenoptera_data/train/ants/460372577_f2f6a8c9fc.jpg', 0), ('../data/hymenoptera_data/train/ants/460874319_0a45ab4d05.jpg', 0), ('../data/hymenoptera_data/train/ants/466430434_4000737de9.jpg', 0), ('../data/hymenoptera_data/train/ants/470127037_513711fd21.jpg', 0), ('../data/hymenoptera_data/train/ants/474806473_ca6caab245.jpg', 0), ('../data/hymenoptera_data/train/ants/475961153_b8c13fd405.jpg', 0), ('../data/hymenoptera_data/train/ants/484293231_e53cfc0c89.jpg', 0), ('../data/hymenoptera_data/train/ants/49375974_e28ba6f17e.jpg', 0), ('../data/hymenoptera_data/train/ants/506249802_207cd979b4.jpg', 0), ('../data/hymenoptera_data/train/ants/506249836_717b73f540.jpg', 0), ('../data/hymenoptera_data/train/ants/512164029_c0a66b8498.jpg', 0), ('../data/hymenoptera_data/train/ants/512863248_43c8ce579b.jpg', 0), ('../data/hymenoptera_data/train/ants/518773929_734dbc5ff4.jpg', 0), ('../data/hymenoptera_data/train/ants/522163566_fec115ca66.jpg', 0), ('../data/hymenoptera_data/train/ants/522415432_2218f34bf8.jpg', 0), ('../data/hymenoptera_data/train/ants/531979952_bde12b3bc0.jpg', 0), ('../data/hymenoptera_data/train/ants/533848102_70a85ad6dd.jpg', 0), ('../data/hymenoptera_data/train/ants/535522953_308353a07c.jpg', 0), ('../data/hymenoptera_data/train/ants/540889389_48bb588b21.jpg', 0), ('../data/hymenoptera_data/train/ants/541630764_dbd285d63c.jpg', 0), ('../data/hymenoptera_data/train/ants/543417860_b14237f569.jpg', 0), ('../data/hymenoptera_data/train/ants/560966032_988f4d7bc4.jpg', 0), ('../data/hymenoptera_data/train/ants/5650366_e22b7e1065.jpg', 0), ('../data/hymenoptera_data/train/ants/6240329_72c01e663e.jpg', 0), ('../data/hymenoptera_data/train/ants/6240338_93729615ec.jpg', 0), ('../data/hymenoptera_data/train/ants/649026570_e58656104b.jpg', 0), ('../data/hymenoptera_data/train/ants/662541407_ff8db781e7.jpg', 0), ('../data/hymenoptera_data/train/ants/67270775_e9fdf77e9d.jpg', 0), ('../data/hymenoptera_data/train/ants/6743948_2b8c096dda.jpg', 0), ('../data/hymenoptera_data/train/ants/684133190_35b62c0c1d.jpg', 0), ('../data/hymenoptera_data/train/ants/69639610_95e0de17aa.jpg', 0), ('../data/hymenoptera_data/train/ants/707895295_009cf23188.jpg', 0), ('../data/hymenoptera_data/train/ants/7759525_1363d24e88.jpg', 0), ('../data/hymenoptera_data/train/ants/795000156_a9900a4a71.jpg', 0), ('../data/hymenoptera_data/train/ants/822537660_caf4ba5514.jpg', 0), ('../data/hymenoptera_data/train/ants/82852639_52b7f7f5e3.jpg', 0), ('../data/hymenoptera_data/train/ants/841049277_b28e58ad05.jpg', 0), ('../data/hymenoptera_data/train/ants/886401651_f878e888cd.jpg', 0), ('../data/hymenoptera_data/train/ants/892108839_f1aad4ca46.jpg', 0), ('../data/hymenoptera_data/train/ants/938946700_ca1c669085.jpg', 0), ('../data/hymenoptera_data/train/ants/957233405_25c1d1187b.jpg', 0), ('../data/hymenoptera_data/train/ants/9715481_b3cb4114ff.jpg', 0), ('../data/hymenoptera_data/train/ants/998118368_6ac1d91f81.jpg', 0), ('../data/hymenoptera_data/train/ants/Ant_1.jpg', 0), ('../data/hymenoptera_data/train/ants/MehdiabadiAnt2_600.jpg', 0), ('../data/hymenoptera_data/train/ants/Nepenthes_rafflesiana_ant.jpg', 0), ('../data/hymenoptera_data/train/ants/VietnameseAntMimicSpider.jpg', 0), ('../data/hymenoptera_data/train/ants/ant photos.jpg', 0), ('../data/hymenoptera_data/train/ants/army-ants-red-picture.jpg', 0), ('../data/hymenoptera_data/train/ants/formica.jpeg', 0), ('../data/hymenoptera_data/train/ants/hormiga_co_por.jpg', 0), ('../data/hymenoptera_data/train/ants/kurokusa.jpg', 0), ('../data/hymenoptera_data/train/ants/swiss-army-ant.jpg', 0), ('../data/hymenoptera_data/train/ants/termite-vs-ant.jpg', 0), ('../data/hymenoptera_data/train/ants/trap-jaw-ant-insect-bg.jpg', 0), ('../data/hymenoptera_data/train/bees/1092977343_cb42b38d62.jpg', 1), ('../data/hymenoptera_data/train/bees/1093831624_fb5fbe2308.jpg', 1), ('../data/hymenoptera_data/train/bees/1097045929_1753d1c765.jpg', 1), ('../data/hymenoptera_data/train/bees/1232245714_f862fbe385.jpg', 1), ('../data/hymenoptera_data/train/bees/129236073_0985e91c7d.jpg', 1), ('../data/hymenoptera_data/train/bees/1295655112_7813f37d21.jpg', 1), ('../data/hymenoptera_data/train/bees/132511197_0b86ad0fff.jpg', 1), ('../data/hymenoptera_data/train/bees/132826773_dbbcb117b9.jpg', 1), ('../data/hymenoptera_data/train/bees/150013791_969d9a968b.jpg', 1), ('../data/hymenoptera_data/train/bees/1508176360_2972117c9d.jpg', 1), ('../data/hymenoptera_data/train/bees/154600396_53e1252e52.jpg', 1), ('../data/hymenoptera_data/train/bees/16838648_415acd9e3f.jpg', 1), ('../data/hymenoptera_data/train/bees/1691282715_0addfdf5e8.jpg', 1), ('../data/hymenoptera_data/train/bees/17209602_fe5a5a746f.jpg', 1), ('../data/hymenoptera_data/train/bees/174142798_e5ad6d76e0.jpg', 1), ('../data/hymenoptera_data/train/bees/1799726602_8580867f71.jpg', 1), ('../data/hymenoptera_data/train/bees/1807583459_4fe92b3133.jpg', 1), ('../data/hymenoptera_data/train/bees/196430254_46bd129ae7.jpg', 1), ('../data/hymenoptera_data/train/bees/196658222_3fffd79c67.jpg', 1), ('../data/hymenoptera_data/train/bees/198508668_97d818b6c4.jpg', 1), ('../data/hymenoptera_data/train/bees/2031225713_50ed499635.jpg', 1), ('../data/hymenoptera_data/train/bees/2037437624_2d7bce461f.jpg', 1), ('../data/hymenoptera_data/train/bees/2053200300_8911ef438a.jpg', 1), ('../data/hymenoptera_data/train/bees/205835650_e6f2614bee.jpg', 1), ('../data/hymenoptera_data/train/bees/208702903_42fb4d9748.jpg', 1), ('../data/hymenoptera_data/train/bees/21399619_3e61e5bb6f.jpg', 1), ('../data/hymenoptera_data/train/bees/2227611847_ec72d40403.jpg', 1), ('../data/hymenoptera_data/train/bees/2321139806_d73d899e66.jpg', 1), ('../data/hymenoptera_data/train/bees/2330918208_8074770c20.jpg', 1), ('../data/hymenoptera_data/train/bees/2345177635_caf07159b3.jpg', 1), ('../data/hymenoptera_data/train/bees/2358061370_9daabbd9ac.jpg', 1), ('../data/hymenoptera_data/train/bees/2364597044_3c3e3fc391.jpg', 1), ('../data/hymenoptera_data/train/bees/2384149906_2cd8b0b699.jpg', 1), ('../data/hymenoptera_data/train/bees/2397446847_04ef3cd3e1.jpg', 1), ('../data/hymenoptera_data/train/bees/2405441001_b06c36fa72.jpg', 1), ('../data/hymenoptera_data/train/bees/2445215254_51698ff797.jpg', 1), ('../data/hymenoptera_data/train/bees/2452236943_255bfd9e58.jpg', 1), ('../data/hymenoptera_data/train/bees/2467959963_a7831e9ff0.jpg', 1), ('../data/hymenoptera_data/train/bees/2470492904_837e97800d.jpg', 1), ('../data/hymenoptera_data/train/bees/2477324698_3d4b1b1cab.jpg', 1), ('../data/hymenoptera_data/train/bees/2477349551_e75c97cf4d.jpg', 1), ('../data/hymenoptera_data/train/bees/2486729079_62df0920be.jpg', 1), ('../data/hymenoptera_data/train/bees/2486746709_c43cec0e42.jpg', 1), ('../data/hymenoptera_data/train/bees/2493379287_4100e1dacc.jpg', 1), ('../data/hymenoptera_data/train/bees/2495722465_879acf9d85.jpg', 1), ('../data/hymenoptera_data/train/bees/2528444139_fa728b0f5b.jpg', 1), ('../data/hymenoptera_data/train/bees/2538361678_9da84b77e3.jpg', 1), ('../data/hymenoptera_data/train/bees/2551813042_8a070aeb2b.jpg', 1), ('../data/hymenoptera_data/train/bees/2580598377_a4caecdb54.jpg', 1), ('../data/hymenoptera_data/train/bees/2601176055_8464e6aa71.jpg', 1), ('../data/hymenoptera_data/train/bees/2610833167_79bf0bcae5.jpg', 1), ('../data/hymenoptera_data/train/bees/2610838525_fe8e3cae47.jpg', 1), ('../data/hymenoptera_data/train/bees/2617161745_fa3ebe85b4.jpg', 1), ('../data/hymenoptera_data/train/bees/2625499656_e3415e374d.jpg', 1), ('../data/hymenoptera_data/train/bees/2634617358_f32fd16bea.jpg', 1), ('../data/hymenoptera_data/train/bees/2638074627_6b3ae746a0.jpg', 1), ('../data/hymenoptera_data/train/bees/2645107662_b73a8595cc.jpg', 1), ('../data/hymenoptera_data/train/bees/2651621464_a2fa8722eb.jpg', 1), ('../data/hymenoptera_data/train/bees/2652877533_a564830cbf.jpg', 1), ('../data/hymenoptera_data/train/bees/266644509_d30bb16a1b.jpg', 1), ('../data/hymenoptera_data/train/bees/2683605182_9d2a0c66cf.jpg', 1), ('../data/hymenoptera_data/train/bees/2704348794_eb5d5178c2.jpg', 1), ('../data/hymenoptera_data/train/bees/2707440199_cd170bd512.jpg', 1), ('../data/hymenoptera_data/train/bees/2710368626_cb42882dc8.jpg', 1), ('../data/hymenoptera_data/train/bees/2722592222_258d473e17.jpg', 1), ('../data/hymenoptera_data/train/bees/2728759455_ce9bb8cd7a.jpg', 1), ('../data/hymenoptera_data/train/bees/2756397428_1d82a08807.jpg', 1), ('../data/hymenoptera_data/train/bees/2765347790_da6cf6cb40.jpg', 1), ('../data/hymenoptera_data/train/bees/2781170484_5d61835d63.jpg', 1), ('../data/hymenoptera_data/train/bees/279113587_b4843db199.jpg', 1), ('../data/hymenoptera_data/train/bees/2792000093_e8ae0718cf.jpg', 1), ('../data/hymenoptera_data/train/bees/2801728106_833798c909.jpg', 1), ('../data/hymenoptera_data/train/bees/2822388965_f6dca2a275.jpg', 1), ('../data/hymenoptera_data/train/bees/2861002136_52c7c6f708.jpg', 1), ('../data/hymenoptera_data/train/bees/2908916142_a7ac8b57a8.jpg', 1), ('../data/hymenoptera_data/train/bees/29494643_e3410f0d37.jpg', 1), ('../data/hymenoptera_data/train/bees/2959730355_416a18c63c.jpg', 1), ('../data/hymenoptera_data/train/bees/2962405283_22718d9617.jpg', 1), ('../data/hymenoptera_data/train/bees/3006264892_30e9cced70.jpg', 1), ('../data/hymenoptera_data/train/bees/3030189811_01d095b793.jpg', 1), ('../data/hymenoptera_data/train/bees/3030772428_8578335616.jpg', 1), ('../data/hymenoptera_data/train/bees/3044402684_3853071a87.jpg', 1), ('../data/hymenoptera_data/train/bees/3074585407_9854eb3153.jpg', 1), ('../data/hymenoptera_data/train/bees/3079610310_ac2d0ae7bc.jpg', 1), ('../data/hymenoptera_data/train/bees/3090975720_71f12e6de4.jpg', 1), ('../data/hymenoptera_data/train/bees/3100226504_c0d4f1e3f1.jpg', 1), ('../data/hymenoptera_data/train/bees/342758693_c56b89b6b6.jpg', 1), ('../data/hymenoptera_data/train/bees/354167719_22dca13752.jpg', 1), ('../data/hymenoptera_data/train/bees/359928878_b3b418c728.jpg', 1), ('../data/hymenoptera_data/train/bees/365759866_b15700c59b.jpg', 1), ('../data/hymenoptera_data/train/bees/36900412_92b81831ad.jpg', 1), ('../data/hymenoptera_data/train/bees/39672681_1302d204d1.jpg', 1), ('../data/hymenoptera_data/train/bees/39747887_42df2855ee.jpg', 1), ('../data/hymenoptera_data/train/bees/421515404_e87569fd8b.jpg', 1), ('../data/hymenoptera_data/train/bees/444532809_9e931e2279.jpg', 1), ('../data/hymenoptera_data/train/bees/446296270_d9e8b93ecf.jpg', 1), ('../data/hymenoptera_data/train/bees/452462677_7be43af8ff.jpg', 1), ('../data/hymenoptera_data/train/bees/452462695_40a4e5b559.jpg', 1), ('../data/hymenoptera_data/train/bees/457457145_5f86eb7e9c.jpg', 1), ('../data/hymenoptera_data/train/bees/465133211_80e0c27f60.jpg', 1), ('../data/hymenoptera_data/train/bees/469333327_358ba8fe8a.jpg', 1), ('../data/hymenoptera_data/train/bees/472288710_2abee16fa0.jpg', 1), ('../data/hymenoptera_data/train/bees/473618094_8ffdcab215.jpg', 1), ('../data/hymenoptera_data/train/bees/476347960_52edd72b06.jpg', 1), ('../data/hymenoptera_data/train/bees/478701318_bbd5e557b8.jpg', 1), ('../data/hymenoptera_data/train/bees/507288830_f46e8d4cb2.jpg', 1), ('../data/hymenoptera_data/train/bees/509247772_2db2d01374.jpg', 1), ('../data/hymenoptera_data/train/bees/513545352_fd3e7c7c5d.jpg', 1), ('../data/hymenoptera_data/train/bees/522104315_5d3cb2758e.jpg', 1), ('../data/hymenoptera_data/train/bees/537309131_532bfa59ea.jpg', 1), ('../data/hymenoptera_data/train/bees/586041248_3032e277a9.jpg', 1), ('../data/hymenoptera_data/train/bees/760526046_547e8b381f.jpg', 1), ('../data/hymenoptera_data/train/bees/760568592_45a52c847f.jpg', 1), ('../data/hymenoptera_data/train/bees/774440991_63a4aa0cbe.jpg', 1), ('../data/hymenoptera_data/train/bees/85112639_6e860b0469.jpg', 1), ('../data/hymenoptera_data/train/bees/873076652_eb098dab2d.jpg', 1), ('../data/hymenoptera_data/train/bees/90179376_abc234e5f4.jpg', 1), ('../data/hymenoptera_data/train/bees/92663402_37f379e57a.jpg', 1), ('../data/hymenoptera_data/train/bees/95238259_98470c5b10.jpg', 1), ('../data/hymenoptera_data/train/bees/969455125_58c797ef17.jpg', 1), ('../data/hymenoptera_data/train/bees/98391118_bdb1e80cce.jpg', 1)]
244