pytorch

YOLOv5来了

老子叫甜甜 提交于 2021-02-20 19:41:03
软硬件环境 ubuntu 18.04 64bit anaconda with 3.7 nvidia gtx 1070Ti cuda 10.1 pytorch 1.5 YOLOv5 前言 YOLOv4 还没有退热, YOLOv5 就已经来了! 6月9日, Ultralytics 公司开源了 YOLOv5 ,离上一次 YOLOv4 发布不到50天,不过这一次的 YOLOv5 是基于 PyTorch 实现的,而不是之前版本的 darknet ! 根据官方给出的数字, YOLOv5 的速度最快可以达到每秒140帧( FPS ),但是权重文件只有 YOLOv4 的1/9,而且准确度更高。本次的发布的 YOLOv5 并不是一个单独的模型,而是一个模型家族,包括了 YOLOv5s 、 YOLOv5m 、 YOLOv5l 、 YOLOv5x ,要求 Python 3.7和 PyTorch 1.5以上版本。 关于 YOLOv5 这个版本,大家可以看看知乎中的讨论,链接放在文末的参考资料中 安装GPU环境 请参考之前的文章 ubuntu安装cuda windows 10安装cuda和cudnn 安装pytorch的GPU版本 来到官网 https://pytorch.org/get-started/locally/,根据自己的环境,进行选择,网站会给出相应的安装命令。我这里的环境是 linux 、

深度学习环境搭建:window10+CUDA10.0+CUDNN+pytorch1.2.0

情到浓时终转凉″ 提交于 2021-02-20 13:37:45
去年底入手一台联想Y7000P,配置了Nvidia GeForce GTX 1660 Ti GPU,GPU内存6G,但是因为有GPU服务器,所以一直没有在这台笔记本上跑过模型,如今经过一番折腾,终于在此笔记本上搭建好了环境,并成功使用GPU训练了一些模型,本篇记录了环境搭建的过程。 检查你的GPU 首先确保你的电脑有Nvidia的GPU,并且支持CUDA,可以参考 这个网址 。 安装vs2017 Visual Studio 2017 Community下载地址 安装选项:勾选“C++的桌面开发”,右边的列表再额外勾选一个SDK,这个SDK是在后续测试CUDA样例的时候要用到的,如下图: 安装CUDA10.0 下载 打开网站: CUDA10.0 按照下图选择对应的选项后,点击下载: 安装 双击下载的文件,选择自定义安装,如果之前你已经安装过显卡驱动并且兼容CUDA10.0,可以在这里去掉显卡驱动的勾选,兼容情况参考 这里 ,截图如下: 另外,去掉Visual studio integration的勾选: 后面默认选择下一步,等待安装完成。 测试 命令行测试: nvcc -V 输出以下信息即成功: 样例测试: 以管理员方式打开vs2017,然后加载bandwidthTest解决方案,路径如下: C:\ProgramData\NVIDIA Corporation\CUDA Samples

How to detect source of under fitting and vanishing gradients in pytorch?

南笙酒味 提交于 2021-02-20 01:59:32
问题 How to detect source of vanishing gradients in pytorch? By vanishing gradients, I mean then the training loss doesn't go down below some value, even on limited sets of data. I am trying to train some network, and I have the above problem, in which I can't even get the network to over fit, but can't understand the source of the problem. I've spent a long time googling this, and only found ways to prevent over fitting, but nothing about under fitting, or specifically, vanishing gradients. What

How to detect source of under fitting and vanishing gradients in pytorch?

瘦欲@ 提交于 2021-02-20 01:58:15
问题 How to detect source of vanishing gradients in pytorch? By vanishing gradients, I mean then the training loss doesn't go down below some value, even on limited sets of data. I am trying to train some network, and I have the above problem, in which I can't even get the network to over fit, but can't understand the source of the problem. I've spent a long time googling this, and only found ways to prevent over fitting, but nothing about under fitting, or specifically, vanishing gradients. What

Getting gradient of vectorized function in pytorch

久未见 提交于 2021-02-20 00:46:41
问题 I am brand new to PyTorch and want to do what I assume is a very simple thing but am having a lot of difficulty. I have the function sin(x) * cos(x) + x^2 and I want to get the derivative of that function at any point. If I do this with one point it works perfectly as x = torch.autograd.Variable(torch.Tensor([4]),requires_grad=True) y = torch.sin(x)*torch.cos(x)+torch.pow(x,2) y.backward() print(x.grad) # outputs tensor([7.8545]) However, I want to be able to pass in a vector as x and for it

Libtorch works with g++, but fails with Intel compiler

霸气de小男生 提交于 2021-02-19 09:31:23
问题 I want to use a neural network developed in Python (PyTorch) in a Fortran program. My OS is Ubuntu 18.04. What I am doing: save it as torchscript: TurbNN.pt call it from c++ program: call_ts.cpp, call_ts.h call c++ program from Fortran program (using bind©): main.f90 I successfully compiled the codes using CMake (3.19.4) and g++ (7.5.0). However, I cannot compile them using Intel compilers (HPCKit 2021.1.0.2684): # downloaded torchlib export Torch_DIR=/home/aiskhak/nn/fortran_calls

Adding batch normalization decreases the performance

∥☆過路亽.° 提交于 2021-02-19 09:08:53
问题 I'm using PyTorch to implement a classification network for skeleton-based action recognition. The model consists of three convolutional layers and two fully connected layers. This base model gave me an accuracy of around 70% in the NTU-RGB+D dataset. I wanted to learn more about batch normalization, so I added a batch normalization for all the layers except for the last one. To my surprise, the evaluation accuracy dropped to 60% rather than increasing But the training accuracy has increased

Adding batch normalization decreases the performance

大憨熊 提交于 2021-02-19 09:04:01
问题 I'm using PyTorch to implement a classification network for skeleton-based action recognition. The model consists of three convolutional layers and two fully connected layers. This base model gave me an accuracy of around 70% in the NTU-RGB+D dataset. I wanted to learn more about batch normalization, so I added a batch normalization for all the layers except for the last one. To my surprise, the evaluation accuracy dropped to 60% rather than increasing But the training accuracy has increased

Using Multiple GPUs outside of training in PyTorch

邮差的信 提交于 2021-02-19 08:46:06
问题 I'm calculating the accumulated distance between each pair of kernel inside a nn.Conv2d layer. However for large layers it runs out of memory using a Titan X with 12gb of memory. I'd like to know if it is possible to divide such calculations across two gpus. The code follows: def ac_distance(layer): total = 0 for p in layer.weight: for q in layer.weight: total += distance(p,q) return total Where layer is instance of nn.Conv2d and distance returns the sum of the differences between p and q. I

How to balance the generator and the discriminator performances in a GAN?

自闭症网瘾萝莉.ら 提交于 2021-02-19 08:06:26
问题 It's the first time I'm working with GANs and I am facing an issue regarding the Discriminator repeatedly outperforming the Generator. I am trying to reproduce the PA model from this article and I'm looking at this slightly different implementation to help me out. I have read quite a lot of papers on how GANs work and also followed some tutorials to understand them better. Moreover, I've read articles on how to overcome the major instabilities, but I can't find a way to overcome this behavior