
pyTorch
文章平均质量分 80
Peanut_范
计算机视觉、强化学习
展开
-
PyTorch学习:对比CV2和PyTorch的预处理
验证预处理一致性import osimport cv2import numpy as npimport PILimport torchfrom PIL import Imageimport torchvision.transforms as transformsclass RGBToBGR(): def __call__(self, im): assert im.mode == 'RGB' r, g, b = [im.getchannel(i)原创 2021-11-26 16:51:00 · 1979 阅读 · 4 评论 -
PyTorch学习(10):训练技巧
PyTorch学习(10):训练技巧Pytorch官方文档: https://pytorch-cn.readthedocs.io/zh/latest/参考: https://efficientdl.com/faster-deep-learning-in-pytorch-a-guide/ https://www.reddit.com/r/MachineLearning/comments/n9fti7/d_a_few_helpful_pytorch_tips _examples_included原创 2021-06-28 22:26:02 · 401 阅读 · 1 评论 -
PyTorch学习(9):实战
PyTorch学习(9):实战Pytorch官方文档: https://pytorch-cn.readthedocs.io/zh/latest/Pytorch学习文档: https://github.com/tensor-yu/PyTorch_TutorialPytorch模型库: https://github.com/pytorch/vision/tree/master/torchvision/models文章目录PyTorch学习(9):实战前言1.ShuffleNet系列(1)数据处理(2原创 2021-06-28 22:16:04 · 285 阅读 · 1 评论 -
PyTorch学习(8):模型保存和加载
PyTorch学习(8):模型保存和加载Pytorch官方文档: https://pytorch-cn.readthedocs.io/zh/latest/Pytorch学习文档: https://github.com/tensor-yu/PyTorch_Tutorial参考: https://mp.weixin.qq.com/s/iYuMcbnJqVUMDMvwDEPs6Q https://www.dtmao.cc/news_show_329038.shtml文章目录PyTorch学习(原创 2021-06-28 22:01:24 · 1318 阅读 · 2 评论 -
PyTorch学习(7):学习率
PyTorch学习(7):学习率Pytorch官方文档: https://pytorch-cn.readthedocs.io/zh/latest/Pytorch学习文档: https://github.com/tensor-yu/PyTorch_Tutorial参考: https://pytorch.org/docs/stable/optim.html?highlight=lr_scheduler https://blog.youkuaiyun.com/u011995719/article/detail原创 2021-06-28 21:27:53 · 1002 阅读 · 0 评论 -
PyTorch学习(6):优化算法
PyTorch学习(6):优化算法Pytorch官方文档: https://pytorch-cn.readthedocs.io/zh/latest/Pytorch学习文档: https://github.com/tensor-yu/PyTorch_Tutorial参考: https://pytorch-cn.readthedocs.io/zh/latest/package_references/torch-optim/#optimizer https://zhuanlan.zhihu.com原创 2021-06-27 22:58:18 · 432 阅读 · 0 评论 -
PyTorch学习(5):损失函数
PyTorch学习(5):损失函数Pytorch官方文档: https://pytorch-cn.readthedocs.io/zh/latest/Pytorch学习文档: https://github.com/tensor-yu/PyTorch_Tutorial参考: https://pytorch.org/docs/stable/nn.html https://pytorch-cn.readthedocs.io/zh/latest/package_references/torch-nn/原创 2021-06-27 20:28:49 · 3303 阅读 · 1 评论 -
PyTorch学习(4):模型
PyTorch学习(4):模型Pytorch官方文档: https://pytorch-cn.readthedocs.io/zh/latest/Pytorch学习文档: https://github.com/tensor-yu/PyTorch_TutorialPytorch模型库: https://github.com/pytorch/vision/tree/master/torchvision/models参考: https://zhuanlan.zhihu.com/p/27401516原创 2021-06-27 20:05:50 · 391 阅读 · 0 评论 -
PyTorch学习(3):数据预处理
PyTorch学习(3):数据预处理Pytorch官方文档: https://pytorch-cn.readthedocs.io/zh/latest/Pytorch学习文档: https://github.com/tensor-yu/PyTorch_Tutorial参考: https://blog.youkuaiyun.com/u011995719/article/details/85103712 https://www.cnblogs.com/mengfu188/p/13561693.html h原创 2021-06-27 19:30:15 · 503 阅读 · 4 评论 -
PyTorch学习(2):数据加载机制
PyTorch学习(2):数据加载机制Pytorch官方文档:https://pytorch-cn.readthedocs.io/zh/latest/Pytorch学习文档:https://github.com/tensor-yu/PyTorch_Tutorial参考:https://blog.youkuaiyun.com/u011995719/article/details/85102770文章目录PyTorch学习(2):数据加载机制前言1.Dataset类2.构建自定义Dataset子类3.DataL原创 2021-06-27 18:23:46 · 631 阅读 · 1 评论 -
PyTorch学习(1):基础知识
PyTorch学习(1):基础知识Pytorch官方文档: https://pytorch-cn.readthedocs.io/zh/latest/Pytorch学习文档: https://github.com/tensor-yu/PyTorch_Tutorial参考: https://blog.youkuaiyun.com/u011995719/article/details/85102770 https://blog.youkuaiyun.com/weicao1990/article/details/93177原创 2021-06-27 11:57:00 · 443 阅读 · 0 评论 -
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
运行torch模型时,报错信息如下:OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade perform原创 2021-01-06 16:50:12 · 1326 阅读 · 0 评论 -
Pytorch显存问题
运行出现错误:RuntimeError: CUDA out of memory. Tried to allocate 500.00 MiB (GPU 0; 4.00 GiB total capacity; 204.39 MiB already allocated; 363.42 MiB free; 373.61 MiB cached)解决方法: 释放显存torch.cuda.empty_cache()如果还是解决不了:(1)增加显存(2)切换为CPU运行...原创 2020-06-29 14:44:42 · 3157 阅读 · 1 评论 -
报错:TypeError: cant pickle Environment objects 和 EOFError: Ran out of input
Github下载的Pytorch0.4.1的代码,linux运行没问题,转到windows出现错误!File “D:\Anaconda3.7\lib\multiprocessing\process.py”, line 112, in startself._popen = self._Popen(self)File “D:\Anaconda3.7\lib\multiprocessing\context.py”, line 223, in _Popenreturn _default_context.g原创 2020-05-20 17:17:46 · 3167 阅读 · 3 评论 -
Error:OSError: [Errno 12] Cannot allocate memory
训练PyTorch代码出现:Cannot allocate memory 错误。解决方法: 修改多线程数量,设置num_workers,系统默认的数量是4,改成1之后,没有效果,后面改成0,问题解决。...原创 2019-12-03 09:22:03 · 2281 阅读 · 0 评论 -
PyTorch安装
PyTorch安装按照官网上的命令安装即可。最新版本:https://pytorch.org/get-started/locally/旧版本:https://pytorch.org/get-started/previous-versions/报错的画,参考:https://blog.youkuaiyun.com/songchunxiao1991/article/details/95192063...原创 2019-11-28 20:58:39 · 890 阅读 · 0 评论 -
Pytorch - TORCH.NN.INIT 参数初始化方法
Pytorch - TORCH.NN.INIT 参数初始化方法路径:https://pytorch.org/docs/master/nn.init.html#nn-init-doc初始化函数:torch.nn.init# -*- coding: utf-8 -*-"""Created on 2019@author: fancp"""import torch import...原创 2019-10-31 10:19:27 · 5915 阅读 · 1 评论 -
Pytorch版本代码修正
Pytorch版本代码修正概述:老版本代码(0.3.0)修正为(0.4.0)1.UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.init.xavier_uniform(param)注:init.xavier_uniform 改为 init.xavier_uni...原创 2019-10-31 09:35:37 · 11029 阅读 · 5 评论 -
Python 找出List中最大/最小的N个数及索引
代码:# -*- coding: utf-8 -*-import heapqnums = [1, 8, 2, 23, 7, -4, 18, 23, 24, 37, 2]# 最大的3个数的索引max_num_index_list = map(nums.index, heapq.nlargest(3, nums))# 最小的3个数的索引min_num_index_list = ma...转载 2019-08-21 11:13:53 · 4526 阅读 · 0 评论 -
python import seaborn as sns 显示中文问题
代码起始处添加:即可import matplotlib.pyplot as pltimport seaborn as snsfrom matplotlib.font_manager import FontPropertiesmyfont=FontProperties(fname=r’C:\Windows\Fonts\simhei.ttf’,size=15)sns.set(font=myf...原创 2019-08-20 20:04:00 · 9257 阅读 · 0 评论 -
torchvision 安装出现错误
(base) C:\Users\pxsj_admin>pip install torchvisionCollecting torchvisionUsing cached https://files.pythonhosted.org/packages/fb/01/03fd7e503c16b3dc262483e5555ad40974ab5da8b9879e164b56c1f4ef6f/tor...原创 2019-05-13 17:44:21 · 10796 阅读 · 5 评论