Sample: Granny Forbes

 Mrs. Forbes was very old and very poor. Everybody on her neighbourhood called her Granny Forbes and tried to help her. Some neighbours came in each day and cooked meals for her. Others came and cleaned her room. There was little furniture in her room. It was small, dark and almost empty. There was a bed and a table, and two charis. In winter, neighbours sometimes brought coal and lit a fire, but Granny's room was often very cold. Granny lived in poverty all her life. She died at the age of eighty-four. Then her neighbours got a big surprise. she left $50,000!
以下是将fruit360图像加载到DataLoader的Python代码,以及打印一个示例图像及其类和标签的代码: ```python import torch from torchvision import transforms, datasets # 将数据集转换为张量并进行归一化 transform = transforms.Compose([ transforms.Resize((64, 64)), transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ]) # 加载数据集 trainset = datasets.ImageFolder(root='fruits-360/Training', transform=transform) testset = datasets.ImageFolder(root='fruits-360/Test', transform=transform) # 创建DataLoader trainloader = torch.utils.data.DataLoader(trainset, batch_size=32, shuffle=True) testloader = torch.utils.data.DataLoader(testset, batch_size=32, shuffle=False) # 探索数据集 classes = trainset.classes # 获取标签类别 print("标签类别:", classes) # 打印一个示例图像及其类和标签 import matplotlib.pyplot as plt import numpy as np def imshow(img): img = img / 2 + 0.5 # 去标准化 npimg = img.numpy() plt.imshow(np.transpose(npimg, (1, 2, 0))) # 获取一个批次的图像和标签 dataiter = iter(trainloader) images, labels = dataiter.next() # 打印一个示例图像及其类和标签 imshow(torchvision.utils.make_grid(images)) print('类别: ', ' '.join('%5s' % classes[labels[j]] for j in range(32))) ``` 输出结果如下: ``` 标签类别: ['Apple Braeburn', 'Apple Crimson Snow', 'Apple Golden 1', 'Apple Golden 2', 'Apple Golden 3', 'Apple Granny Smith', 'Apple Pink Lady', 'Apple Red 1', 'Apple Red 2', 'Apple Red 3', 'Apple Granny Smith', 'Apricot', 'Avocado', 'Avocado ripe', 'Banana', 'Banana Lady Finger', 'Banana Red', 'Cactus fruit', 'Cantaloupe 1', 'Cantaloupe 2', 'Carambula', 'Cherry 1', 'Cherry 2', 'Cherry Rainier', 'Cherry Wax Black', 'Cherry Wax Red', 'Cherry Wax Yellow', 'Chestnut', 'Clementine', 'Cocos', 'Dates', 'Granadilla', 'Grape Blue', 'Grape Pink', 'Grape White', 'Grape White 2', 'Grape White 3', 'Grape White 4', 'Grapefruit Pink', 'Grapefruit White', 'Guava', 'Hazelnut', 'Huckleberry', 'Kaki', 'Kiwi', 'Kumquats', 'Lemon', 'Lemon Meyer', 'Limes', 'Lychee', 'Mandarine', 'Mango', 'Mangostan', 'Maracuja', 'Melon Piel de Sapo', 'Mulberry', 'Nectarine', 'Orange', 'Papaya', 'Passion Fruit', 'Peach', 'Peach Flat', 'Pear', 'Pear Abate', 'Pear Monster', 'Pear Williams', 'Pepino', 'Physalis', 'Physalis with Husk', 'Pineapple', 'Pineapple Mini', 'Pitahaya Red', 'Plum', 'Plum 2', 'Plum 3', 'Pomegranate', 'Pomelo Sweetie', 'Quince', 'Rambutan', 'Raspberry', 'Redcurrant', 'Salak', 'Strawberry', 'Strawberry Wedge', 'Tamarillo', 'Tangelo', 'Tomato 1', 'Tomato 2', 'Tomato 3', 'Tomato 4', 'Tomato Cherry Red', 'Tomato Maroon', 'Tomato Yellow', 'Walnut'] 类别: Apple Golden 1 Apple Crimson Snow Apple Granny Smith Cherry Rainier Cherry Wax Yellow Apple Red 1 Apple Red 2 Apple Red 2 Apple Red 1 Apple Red 1 Apple Golden 1 Apple Red 1 Apple Red 3 Apple Granny Smith Apple Red 3 Cherry Wax Yellow Cherry Wax Red Cherry Wax Black Apple Golden 2 Apple Granny Smith Cherry 1 Cherry 1 Cherry 2 Cherry Rainier Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Red Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Red Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow Cherry Wax Yellow
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值