- 博客(50)
- 收藏
- 关注
原创 PSMNet/finetune.py出错
File "/home/ubuntu/wgp/PSMNet/finetune.py", line 139, in test true_disp[index[0][:], index[1][:], index[2][:]] - pred_disp[index[0][:], index[1][:], index[2][:]]) IndexError: index 192 is out of bounds for dimension 1 with size 1
2022-06-29 22:21:22 514 1
原创 torch.index_select
在指定维度上取出指定索引数据。import torcha=torch.tensor([[0,1,2], [3,4,5], [6,7,8] ])i=torch.tensor([0,0,1,2,2])c=torch.index_select(a,0,i)print(c)a是三行三列的。这里指定维度为行,也就是取第0行第0行第1行第2行第2行输出大小为5x3输出:
2022-04-08 16:29:28 251
原创 visual studio background download 关闭
某天我的电脑风扇疯狂响,打开任务管理器,发现visual studio background download进程导致的,这是一个visual studio的更新程序,如何关闭它呢?参考:(2 封私信 / 80 条消息) 如何彻底阻止Visual Studio 2019自动更新? - 知乎 (zhihu.com)右击开始图标,依次选择“计算机管理”-“任务计划程序”-“任务计划程序库”-“Microsoft”-“Visual Studio”-“Updates”,把“BackgroundDownl
2022-04-04 16:53:18 10592
原创 pycharm调试out of memory
在训练一个模型的时候,训练了几个batch后突然报错“out of memory ”。心想不应该啊,如果是显存不够的话一开始就应该报错,于是在pycharm中调试代码,在debug前,先打开gpustatwatch --color -n1.0 gpustat --out -c #-n 后面参数是几秒刷新一次于是边执行代码,一边看显存变化,找到问题所在。...
2022-04-04 16:27:36 1898
原创 pycharm 调试pytorch代码:unable to get repr for <class torch.Tensor>
取值范围超了。a=torch.tensor([1,2])print(a[-3])print(a[3])
2022-03-24 21:45:27 1546
原创 torch.gather()
作用:取出特定维度索引的值。torch.gather(input,dim,index,out=None,sparse_grad=False)举个例子import torcha=torch.tensor([[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15],])index=torch.tensor([[0,2],[3,4],[1,4]])print(torch.gather(a,1,index))输出tensor([[ 1, 3]
2022-03-24 20:21:08 2623
原创 保存tensor到csv中
1 首先将GPU上的tensor复制一封到cpu上:save_occ=occ_mask.data.cpu()2 再将高纬度tensor转换到2维度的tensor,save_occ=occ_mask.data.cpu()with open("1.csv","ab") as f: # for i in range(occ_mask.shape[1]): # one_layer=occ_mask[1,:,:] np.savetxt(f,save_occ[0.
2022-03-23 20:02:52 4807
原创 python数组乘以标量小错误
M=[ [ 2, 2, 1, 0, 0], [ 0,-2,-2,-2, 2], [ 1, 2, 2, 2,-1], [ 2, 1, 0, 1,-1], [0.5,2, 2, 1, 0], [ 0, 1, 1, 1,-1], [-2, 2, 2, 1, 1], [ 2, 1, 2, 1,-1],]本想给每个元素乘以5,于是就写成a=5*Mprint(a)输出:[[7.3890561 7.3890561 2.7182.
2022-03-21 09:17:39 1043
原创 NestedTensor
NestedTensor,包括tensor和mask两个成员,tensor就是输入的图像。mask跟tensor同高宽但是单通道。
2022-03-19 11:40:20 1551
原创 pytorch梯度累加探索
举个简单例子,,求一次梯度为2x=2 (x=1)import torchx = torch.tensor(1.0, requires_grad=True)y1 = x ** 2y1.backward()print(x.grad)输出tensor(2.)若我们再求一次导import torchx = torch.tensor(1.0, requires_grad=True)y1 = x ** 2y1.backward()print(x.grad)y1.ba...
2022-03-18 00:57:23 1899
原创 sudo: /etc/sudoers.d 可被任何人写or sudo: /etc/sudoers 可被任何人写
sudo: /etc/sudoers.d 可被任何人写_lucky lures的博客-CSDN博客sudo: /etc/sudoers 可被任何人写使用sudo chmod -R 777 /usr命令修改了usr文件的所有者,导致sudo:must be setuid root问题的出现,即sudo命令无法使用。网上介绍的方法差不多都相同,就是通过下面两条命令:重启电脑,按esc进入recovery模式,选root,然后下执行chown root:root /usr/bin/su
2022-03-16 16:37:48 2322 1
原创 在pycharm里面跑swin-transformer
参考:如何在pycharm中运行/调试torch分布式训练 - 知乎1 建立软件首先需要找到torch.distributed.launch这个文件,并将它软链接到我们的Pycharm项目目录下。ln -s /opt/anaconda3/envs/swin/lib/python3.8/site-packages/torch/distributed/ /home/ubuntu/wgp/Swin-Transformer/2 设置pycharm打开Pycharm,依次点击Run->Ed
2022-03-14 16:03:18 2800
原创 Swin transformer TypeError: __init__() got an unexpected keyword argument ‘t_mul‘
Traceback (most recent call last): File "main.py", line 357, in <module> main(config) File "main.py", line 99, in main lr_scheduler = build_scheduler(config, optimizer, len(data_loader_train)) File "/home/ubuntu/wgp/Swin-Transformer/lr.
2022-03-14 14:28:42 5526 2
原创 Anaconda中安装Pytorch 速度太慢解决办法
本文参考:Anaconda中安装Pytorch 速度太慢解决办法_ 蜗牛在听雨的博客-CSDN博客_conda install pytorch太慢怎么办【陆续排坑】解决conda下载速度慢的问题:更换国内源_Xiao_Spring的博客-CSDN博客_conda更改下载源使用conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch安装pytorch
2022-03-13 17:29:31 10968
原创 烦人的CUDA error:-UserWarning: CUDA initialization: CUDA unknown error
参考:pytorch学习笔记-UserWarning: CUDA initialization: CUDA unknown error - 简书跑yolov5时,安装好pytorch之后,运行脚本import torcha=torch.cuda.is_available()print(torch.__version__)print(a)出现了错误:UserWarning: CUDA initialization: CUDA unknown error - this may be d
2022-03-13 11:05:39 18434 8
原创 常量指针与指针常量
不要管类型在哪,只要:const (常量)后面有*(指针)号,即常量指针*(指针)号后面有const (常量),即指针常量常量指针:(error:常量是一个指针) 指向一个常量的指针,也可以指向其他量,指向地址可以变化。指针常量: 指针是一个常量,指向地址不可变化,但是指向的地址里面内容可以变化。...
2022-03-03 20:59:15 71
原创 git fetch 与git pull的区别(菜鸟总结)
建议先看:详解git pull和git fetch的区别 - 知乎经过我自己实践发现。远程仓库有:a.py ,b.py本地仓库1:a.py,c.py如果本地仓库1中的a.py和原车仓库中的a.py相同本地仓库1中执行git fetch origin mastergit merge origin master本地仓库1变为:a.py ,b.py,c.py相当于本地仓库1执行git pull ,此时git pull =(git fetch + git merge) ,都..
2021-10-12 14:55:19 261
原创 yolov3修改保存weights间隔
yolov3修改保存weights间隔打开darknet/src/detector.c搜索‘save’找到 if(i%100==0){#ifdef GPU if(ngpus != 1) sync_nets(nets, ngpus, 0);#endif char buff[256]; sprintf(buff, "%s/%s.backup", backup_directory, base); save_
2021-07-16 09:50:20 923 1
原创 error gnutls_handshake() failed: Error in the pull function.
fatal: unable to access ‘https://github.com/wang-xinyu/tensorrtx.git/’: gnutls_handshake() failed: Error in the pull function.试试把https改为gitgit clone -b trt4 git://github.com/wang-xinyu/tensorrtx.git
2021-06-21 23:54:15 429
原创 YOLOF代码复现全过程
环境:Ubuntu 18.04 python 3.8 Torch1.8 cuda10.2听说可以不安装mish-cuda,那就先不装吧,装的越多,错的越多,怕了怕了怕了~(py38_to18) wgp@wgp:~/python/env_py38_torch18$ git clone https://github.com/chensnathan/YOLOF.git正克隆到 'YOLOF'...remote: Enumerating objects: 85, done.remote: Counting
2021-05-24 21:27:45 1711
原创 detectron2痛苦的安装记录
/bin/sh: 1: :/usr/local/cuda/bin/nvcc: not found环境 :ubuntu18.04我装了cuda10.0和cuda10.2,用的软连接,现在把删除软连接,修改~/.bashrcadded by cuda8.0#export CUDA_HOME=/usr/local/cuda#export PATH=PATH:PATH:PATH:CUDA_HOME/bin#export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64
2021-05-24 10:57:51 1098
原创 size.width>0 && size.height>0 in function imshow
翻译这儿The image fails to load (probably because you forgot the leading / in the path). imread then returns None. Passing None to imshow causes it to try to create a window of size 0x0, which fails.The poor error handling in cv probably owes to its quite th
2021-04-07 21:59:42 726
原创 保存360锁屏壁纸&批量修改文件后缀名
360健康助手壁纸地址C:\Users\Admin\AppData\Roaming\360Safe\DesktopRest\eye\bk_image批量修改文件后缀名1 在要修改的文件夹下,新建txt文件,里面输入ren *.* *.jpg 2 意思就是把任何后缀名改为.jpg后缀名。3 然后把txt文件改为.bat文件,双击运行即可。...
2021-03-29 09:58:28 1035
转载 IDEA必备插件系列-Background Image Plus +(编辑器背景图)
IDEA必备插件系列-Background Image Plus +(编辑器背景图)转载
2021-03-29 09:48:01 790
原创 python3.8 pytorch1.7安装torchtext
python3.8 pytorch1.7安装torchtext刚开始使用pip安装,一会就装好了,但是它把我好不容易装好的torch升级到cpu-1.8了…于是又重新装torch-gpu1.7.这次去源码那link 查了一下:可见我应该装0.8版本的。(base) C:\Users\Admin>pip install torchtext==0.8Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simpleERROR: Coul
2021-03-28 21:56:28 2366 4
原创 Ubuntu安装截图软件flame
转载:https://blog.csdn.net/qq_36178962/article/details/114895906安装sudo apt-get install flameshot快捷键配置
2021-03-21 10:46:38 238
原创 ubuntu 18.04安装edge浏览器
ubuntu 18.04安装edge浏览器1 为啥要安装edge?之前一直用Google Chrome浏览器,但是安装插件太不方便了 。听说edge浏览器是科研神器,所以决定试试。2 安装方法参考:http://www.acang.cn/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85microsoft-edge%e6%b5%8f%e8%a7%88%e5%99%a8/通过以具有sudo特权的用户身份运行以下命令来更
2021-03-20 23:56:56 3452 2
原创 dynamic module does not define module export function (PyInit_cv_bridge_boost)
dynamic module does not define module export function (PyInit_cv_bridge_boost)把.py文件的解释器改为Python2.7即可
2021-02-01 21:30:03 524
原创 2020-11-22
raise ImportError('You need to first import keras ’ImportError: You need to first import keras in order to use keras_applications. For instance, you can do:import kerasfrom keras_applications import vgg16Or, preferably, this equivalent formulation:fr
2020-11-22 15:01:08 1686 1
原创 2020-11-09
迭代法求数组最大值1 递推公式2 常规法(for循环法)//在list里面求最大值#include <stdio.h>#include <stdlib.h>//n是list的长度int find_max(int a[], int n){ int max = 0; int i; for (i = 0;i++;i < n) { if (max < a[i]) max = a[i]; } return max;}int a[
2020-11-09 20:01:16 178
原创 xacro文件转urdf文件以及使用urdf_to_graphiz显示物理模型框架
xacro文件转urdf文件以及使用urdf_to_graphiz显示物理模型框架安装:sudo apt-get install liburdfdom-tools一定要把目录切换到xacro下再操作rosrun xacro xacro turtlebot3_burger.urdf.xacro > turtlebot3_burger.urdf --inorder如果没有切换到xacro文件目录下,会出现如下错误:No such file or directory: mrobot.urdf.x
2020-08-18 19:27:07 1545
转载 几种基于膨胀和腐蚀的更高级运算,morphologyEx()函数
既然是基于膨胀和腐蚀的运算,那么再让我们详细了解一下膨胀和腐蚀到底对图像做了什么?第一种情况,对于二值图像来说腐蚀:核与其覆盖的图像部分做“与”操作,如果全为1,则该像素点为1,否则为0;也就是0容易得到,图像更多的地方变黑了,白色部分被腐蚀了膨胀...
2020-02-14 12:03:19 315
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人