目录

一、pip安装torch

1.1 torch介绍

1.2 torch.nn相关库的导入

1.3win10上torch的安装命令

二、pip安装Opencv 

 三、pip安装scipy库


一、pip安装torch

1.1 torch介绍

    torch的基本功能:
    ①torch:张量的相关运算,例如:创建、索引、切片、连续、转置、加减乘除等相关运算。

    ②torch.nn:包含搭建网络层的模块(modules)和一系列的loss函数。

例如:全连接、卷积、池化、  BN分批处理、dropout、CrossEntropyLoss、MSLoss等。

包含五大基本功能模块:nn.Parameter、nn.Linear、nn.functional、nn.Module、nn.Sequential

    ③torch.autograd:提供Tensor所有操作的自动求导方法。

    ④torch.nn.functional:常用的激活函数relu、leaky_relu、sigmoid等。

    ⑤torch.optim:各种参数优化方法,例如:SGD、AdaGrad、RMSProp、Adam等。

    ⑥torch.nn.init:可以用它更改nn.Module的默认参数初始化方式。

    ⑦torch.utils.data:用于加载数据。

1.2 torch.nn相关库的导入

    torch.nn库是专门为神经网络设计的模块化接口,nn构建于autograd之上,nn是Neural Network的简称,可以用来定义和运行神经网络,帮助程序员执行下述与神经网络相关的行为。

(1)创建神经网络

(2)训练神经网络

(3)保存神经网络

(4)恢复神经网络

    其中torch.nn相关库的导入如下所示:

import numpy as np              # numpy数组库
import math                     # 数学运算库
import matplotlib.pyplot as plt # 画图库
 
import torch             # torch基础库
import torch.nn as nn    # torch神经网络库
import torch.nn.functional as F

1.3win10上torch的安装命令

pip install torch===1.7.1 torchvision===0.4.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

出现如下界面即可: 

注意:[Pytorch系列-30]:神经网络基础 - torch.nn库五大基本功能:nn.Parameter、nn.Linear、nn.functioinal、nn.Module、nn.Sequentia

[Pytorch系列-30]:神经网络基础 - torch.nn库五大基本功能:nn.Parameter、nn.Linear、nn.functioinal、nn.Module、nn.Sequentia_nn.parameter和nn.linear_文火冰糖的硅基工坊的博客-CSDN博客

二、pip安装Opencv 

(1)win+R输入cmd;

(2)然后切换到anaconda安装的位置,然后进入Script文件夹的位置。 

(3)依次输入下述指令:

pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple

(4)输入conda list检查是否下载成功,出现下列标识即可。

 三、pip安装scipy库

(1)安装Numpy:因为Scipy依赖于Numpy,所以需要先安装Numpy,命令如下:

pip install numpy

(2)安装Scipy

pip install scipy
GitHub 加速计划 / opencv31 / opencv
238
21
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:4 个月前 )
fba658b9 Improve precision of RotatedRect::points 16 小时前
97df136d Properly preserve KAZE/AKAZE license as mandated by BSD-3-Clause #28441 Close https://github.com/opencv/opencv/issues/28440 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake 17 小时前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐