install torchvision datasets


 

https://pypi.org/project/torchvision/0.1.8/

$ pip install torchvision  (failed)

me@me:~/$ pip install torchvision
Collecting torchvision
Downloading https://files.pythonhosted.org/packages/fb/01/03fd7e503c16b3dc262483e5555ad40974ab5da8b9879e164b56c1f4ef6f/torchvision-0.2.2.post3-py2.py3-none-any.whl (64kB)
100% |████████████████████████████████| 71kB 2.0MB/s
Collecting pillow>=4.1.1 (from torchvision)
Downloading https://files.pythonhosted.org/packages/81/1a/6b2971adc1bca55b9a53ed1efa372acff7e8b9913982a396f3fa046efaf8/Pillow-6.0.0.tar.gz (29.5MB)
100% |████████████████████████████████| 29.5MB 22kB/s
Collecting torch (from torchvision)
Downloading https://files.pythonhosted.org/packages/f8/02/880b468bd382dc79896eaecbeb8ce95e9c4b99a24902874a2cef0b562cea/torch-0.1.2.post2.tar.gz (128kB)
100% |████████████████████████████████| 133kB 2.3MB/s
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/torch.egg-info
writing requirements to pip-egg-info/torch.egg-info/requires.txt
writing pip-egg-info/torch.egg-info/PKG-INFO
writing top-level names to pip-egg-info/torch.egg-info/top_level.txt
writing dependency_links to pip-egg-info/torch.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/torch.egg-info/SOURCES.txt'
error: package directory 'torch/cuda' does not exist

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0haT3s/torch/



Use below way
https://devtalk.nvidia.com/default/topic/1049071/pytorch-for-jetson-nano/

$ git clone https://github.com/pytorch/vision
$ cd vision
$ sudo python setup.py install


$ python data.py
Downloading https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz to ./data/cifar-10-python.tar.gz
100.0%Extracting ./data/cifar-10-python.tar.gz to ./data
Files already downloaded and verified
me@me:~/$ cat data.py
import torch
import torchvision
import torchvision.transforms as transforms

transform = transforms.Compose(
    [transforms.ToTensor(),
     transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])

trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
                                        download=True, transform=transform)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=4,
                                          shuffle=True, num_workers=2)

testset = torchvision.datasets.CIFAR10(root='./data', train=False,
                                       download=True, transform=transform)
testloader = torch.utils.data.DataLoader(testset, batch_size=4,
                                         shuffle=False, num_workers=2)

classes = ('plane', 'car', 'bird', 'cat',
           'deer', 'dog', 'frog', 'horse', 'ship', 'truck')

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM