请我喝杯咖啡☕
*我的帖子解释了 KMNIST。
KMNIST() 可以使用 KMNIST 数据集,如下所示:
*备忘录:
- 第一个参数是 root(必需类型:str 或 pathlib.Path)。 *绝对或相对路径都是可能的。
- 第二个参数是 train(Optional-Default:True-Type:bool)。 *如果为 True,则使用训练数据(60,000 张图像),如果为 False,则使用测试数据(10,000 张图像)。
- 第三个参数是transform(Optional-Default:None-Type:callable)。
- 第四个参数是 target_transform(Optional-Default:None-Type:callable)。
- 第五个参数是 download(Optional-Default:False-Type:bool):
*备注:
- 如果为 True,则从互联网下载数据集并解压(解压)到根目录。
- 如果为 True 并且数据集已下载,则将其提取。
- 如果为 True 并且数据集已下载并提取,则不会发生任何事情。
- 如果数据集已经下载并提取,则应该为 False,因为它速度更快。
- 您可以从此处手动下载并提取数据集,例如数据/KMNIST/原始/。
from torchvision.datasets import KMNIST train_data = KMNIST( root="data" ) train_data = KMNIST( root="data", train=True, transform=None, target_transform=None, download=False ) test_data = KMNIST( root="data", train=False ) len(train_data), len(test_data) # (60000, 10000) train_data # Dataset KMNIST # Number of datapoints: 60000 # Root location: data # Split: Train train_data.root # 'data' train_data.train # True print(train_data.transform) # None print(train_data.target_transform) # None train_data.download # <bound method mnist.download of dataset kmnist number datapoints: root location: data split: train> train_data[0] # (<pil.image.image image mode="L" size="28x28">, 8) train_data[1] # (<pil.image.image image mode="L" size="28x28">, 7) train_data[2] # (<pil.image.image image mode="L" size="28x28">, 0) train_data[3] # (<pil.image.image image mode="L" size="28x28">, 1) train_data[4] # (<pil.image.image image mode="L" size="28x28">, 4) train_data.classes # ['o', 'ki', 'su', 'tsu', 'na', 'ha', 'ma', 'ya', 're', 'wo'] </pil.image.image></pil.image.image></pil.image.image></pil.image.image></pil.image.image></bound>
from torchvision.datasets import KMNIST train_data = KMNIST( root="data", train=True ) test_data = KMNIST( root="data", train=False ) import matplotlib.pyplot as plt def show_images(data): plt.figure(figsize=(12, 2)) col = 5 for i, (image, label) in enumerate(data, 1): plt.subplot(1, col, i) plt.title(label) plt.imshow(image) if i == col: break plt.show() show_images(data=train_data) show_images(data=test_data)
以上是PyTorch 中的 KMNIST的详细内容。更多信息请关注PHP中文网其他相关文章!

Arraysinpython,尤其是Vianumpy,ArecrucialInsCientificComputingfortheireftheireffertheireffertheirefferthe.1)Heasuedfornumerericalicerationalation,dataAnalysis和Machinelearning.2)Numpy'Simpy'Simpy'simplementIncressionSressirestrionsfasteroperoperoperationspasterationspasterationspasterationspasterationspasterationsthanpythonlists.3)inthanypythonlists.3)andAreseNableAblequick

你可以通过使用pyenv、venv和Anaconda来管理不同的Python版本。1)使用pyenv管理多个Python版本:安装pyenv,设置全局和本地版本。2)使用venv创建虚拟环境以隔离项目依赖。3)使用Anaconda管理数据科学项目中的Python版本。4)保留系统Python用于系统级任务。通过这些工具和策略,你可以有效地管理不同版本的Python,确保项目顺利运行。

numpyarrayshaveseveraladagesoverandastardandpythonarrays:1)基于基于duetoc的iMplation,2)2)他们的aremoremoremorymorymoremorymoremorymoremorymoremoremory,尤其是WithlargedAtasets和3)效率化,效率化,矢量化函数函数函数函数构成和稳定性构成和稳定性的操作,制造

数组的同质性对性能的影响是双重的:1)同质性允许编译器优化内存访问,提高性能;2)但限制了类型多样性,可能导致效率低下。总之,选择合适的数据结构至关重要。

到CraftCraftExecutablePythcripts,lollow TheSebestPractices:1)Addashebangline(#!/usr/usr/bin/envpython3)tomakethescriptexecutable.2)setpermissionswithchmodwithchmod xyour_script.3)

numpyArraysareAreBetterFornumericalialoperations andmulti-demensionaldata,而learthearrayModuleSutableforbasic,内存效率段

numpyArraySareAreBetterForHeAvyNumericalComputing,而lelethearRayModulesiutable-usemoblemory-connerage-inderabledsswithSimpleDatateTypes.1)NumpyArsofferVerverVerverVerverVersAtility andPerformanceForlargedForlargedAtatasetSetsAtsAndAtasEndCompleXoper.2)

ctypesallowscreatingingangandmanipulatingc-stylarraysinpython.1)usectypestoInterfacewithClibrariesForperfermance.2)createc-stylec-stylec-stylarraysfornumericalcomputations.3)passarraystocfunctions foreforfunctionsforeffortions.however.however,However,HoweverofiousofmemoryManageManiverage,Pressiveo,Pressivero


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

WebStorm Mac版
好用的JavaScript开发工具

Dreamweaver CS6
视觉化网页开发工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。