Debug
HuiYu-Li
Huiyu flipped for Liu
展开
-
github - 用hexo搭博客总是出现这样的错误
fatal: the remote end hung up unexpectedly此错误总是反反复复,不期而遇试过以下代码:git config --global http.postBuffer 524288000无效。成功的策略:删除博客根目录下的.deploy_git 文件夹,然后重新推送。...原创 2019-11-27 11:34:48 · 653 阅读 · 1 评论 -
matplotlib.pyplot复用figure
RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To...原创 2019-11-26 08:29:22 · 2522 阅读 · 0 评论 -
解决GPU显存未释放问题
问题:误用Ctrl+z退出程序,结果程序退出了,显存未释放,nvidia-smi仍然可以看到进程。运行程序报错:pytorch RuntimeError: CUDA error: all CUDA-capable devices are busy or unavailablesudo kill id无法释放显存:解决办法:sudo -9 kill id解决GPU显存未释放问题...原创 2019-11-19 18:13:55 · 5486 阅读 · 0 评论 -
SimpleITK最多只能保存三维数据!!!
欲保存[2,48,256,256]大小的矩阵结果默认保存了前3维数据:解决方案:保存为numpy矩阵。np.save("filename.npy",a)b = np.load("filename.npy")原创 2019-11-18 22:39:21 · 484 阅读 · 0 评论 -
Ubuntu 18.04 NVIDIA驱动安装
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.Step1:检测你的NVIDIA显卡型号和推荐的驱动程序的模型。$ ubuntu-drivers device...原创 2019-11-15 15:18:09 · 631 阅读 · 0 评论 -
TypeError: Object of type 'int64' is not JSON serializable
错误分析:1. python3中没有int64这个数据类型,所有的整型都是int解决方案:转换成python3内置数据类型即可,eg.float(size_z)Note:错误的转换方式size_z.astype(np.float32)原因:json不支持numpy数据类型...原创 2019-11-12 11:15:10 · 954 阅读 · 0 评论 -
python列表之list.append(obj),list.extend(seq)
list.append(obj) 在列表末尾添加新的对象list.extend(seq) 用新列表扩展原来的列表list = []list.extend('extend0')# not intendedlist.extend(['extend1'])list.append('extend2')print(list)Output:[‘e’, ‘x’, ‘t’, ‘e’, ‘n’, ...原创 2019-11-12 09:54:44 · 456 阅读 · 0 评论 -
visdom [Errno 110] Connection timed out while downloading https://cdn.plot.ly/plotly-latest.min.js
ERROR:root:Error [Errno 110] Connection timed out while downloading https://cdn.plot.ly/plotly-latest.min.jsERROR:tornado.general:Could not open static file ‘/usr/local/lib/python3.6/dist-packages/vi...原创 2019-11-07 22:19:42 · 2491 阅读 · 3 评论 -
Ubuntu下安装Opencv(cv2)
报错:E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?安装方法一(不推荐)sudo apt-get install python-opencv解决方案sudo pip3 install opencv-pythonUbuntu下apt-get与pip安装命令的区别...原创 2019-11-03 15:39:42 · 6483 阅读 · 2 评论 -
RuntimeError: one of the variables needed for gradient computation has been modified by...
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation在计算loss的过程中,浅复制搞的鬼出错代码:temp = target正确代码:temp = target.clone()当然,此错误还有其他原因...原创 2019-09-05 21:27:03 · 1129 阅读 · 0 评论 -
Matplotlib绘图并保存图像但不显示图形的方法
import matplotlibmatplotlib.use('Agg')from matplotlib.pyplot import plot,savefig附:有时,import matplotlib 但未使用会遇到warning:Gdk-CRITICAL **:gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (disp...原创 2019-08-17 16:45:46 · 5241 阅读 · 0 评论 -
ubuntu 拷贝/修改文件 permission denied
sudo chmod -R 777 file #递归修改file目录下的权限为777Linux chmod命令原创 2019-08-16 19:46:18 · 2764 阅读 · 0 评论 -
python RuntimeError: OrderedDict mutated during iteration
出错代码dict = torch.load(pre_model)for key in dict.keys(): if key.startswith('decoder1'): del dict[key]出错原因:dict.keys()不能返回可以被修改的拷贝。解决办法:转化成list正确代码dict = torch.load(pre_model)for key...原创 2019-08-25 23:10:31 · 865 阅读 · 0 评论 -
MobaXterm Donwload nii file Error!!!
Reason:在Ubuntu上对CT图像做完预处理之后,Donwload 到Windows上查看效果时,Waht??!!本以为自己的预处理程序有错,结果是MobaXterm搞的鬼。同样一张CT图片,**下图是MobaXterm传到本地的图片:**简直不堪入目**下图是Xftp6传到本地的图片:**正常所以,不要用MobaXterm上传或下载nii文件,如果实在有需要用命令行,或...原创 2019-08-12 15:58:41 · 216 阅读 · 0 评论 -
fatal: The remote end hung up unexpectedly
问题描述:Git在推送项目时报错:fatal: The remote end hung up unexpectedly。问题原因:推送的文件太大。解决方法:修改设置git config文件的postBuffer的大小。(设置为500MB) git config --local http.postBuffer 524288000注:–local选项指定这个设置只对当前仓库生效。git c...原创 2019-08-15 21:54:06 · 2748 阅读 · 0 评论 -
fatal: refusing to merge unrelated histories
问题在于两个分支没有取得关系,可能会在git pull,git push,git merge中遇到。解决办法 在语句后面加--allow-unrelated-histories,如下所示:git pull origin master --allow-unrelated-histories...原创 2019-08-15 21:42:53 · 66 阅读 · 0 评论 -
fatal: not a git repository (or any of the parent directories): .git
提示说没有.git这样一个目录,解决办法如下:git init原创 2019-08-15 21:25:19 · 1186 阅读 · 0 评论 -
pytorch模型的坑:双分支网络的输出结果一模一样
Motivition: 双分支网络训练结束,分析可视化输出结果的时候突然发现,两个分支的输出结果一模一样!!!做差之后输出结果,果不其然,equal to zero! 小鬼上身,浑身纳闷。Debug Progress:可视化网络结构&check训练模型中的参数值:模型中的双分支学习到的参数值不会是一样的吧?周末616,碰到了遇到了黑暗的一天!划水搭了个个人网站,逃避课程复习,逃避烦...原创 2019-06-17 23:27:41 · 7625 阅读 · 10 评论 -
PyTorch 高维矩阵转置 Permute和Transpose
permute可以对任意高维矩阵进行转置。transpose只能操作2D矩阵的转置(连续使用transpose可实现permute效果)。import torchimage = torch.randn(1,16 ,256, 256)image = image.permute(1,0,2,3)print(image.shape)#torch.Size([16, 1, 256, 256]...原创 2019-06-24 10:51:42 · 7044 阅读 · 0 评论 -
TypeError: Invalid dimensions for image data
When I use torchvision.utils.make_grid() for the visualization of 3-D outputs.原创 2019-06-24 11:00:12 · 2897 阅读 · 1 评论 -
Xftp连接ubuntu: ssh服务器拒绝了密码,请再试一次
原因:xshell登录使用的用户名不能是root,不能是服务器的用户名,否则连接时会报。即"新建连接"时,下图箭头的用户名可以空着,但一定不可以填你的登录名。...原创 2019-07-18 21:15:23 · 1146 阅读 · 0 评论 -
tensorflow process finished with exit code 132 (interrupted by signal 4 sigill)
import tensorflow as tf报错:process finished with exit code 132 (interrupted by signal 4 sigill)原因:tensoflow版本问题,因为1.5.0以上的tensorflow需要AVX支持,所以,退回到1.5.0可以解决此问题。...原创 2019-07-18 22:25:44 · 10450 阅读 · 4 评论 -
Python安装cv2
安装:pip install opencv-python如果想提速的话,加上国内源(比如清华源)pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple使用:import cv2原创 2019-07-19 21:39:29 · 740 阅读 · 0 评论 -
Github下载整个仓库,单个文件夹,单个文件
使用一个node小工具:git-down-reponpm install git-down-repo -g // 安装全局// test gitdown https://github.com/hua1995116/webchat // 下载整个仓库(默认master)gitdown https://github.com/hua1995116/webchat dev // 下载某个仓库...原创 2019-07-24 16:43:57 · 966 阅读 · 0 评论 -
torchsummary : RuntimeError: Expected 5-dimensional input for 5-dimensional weight but...
torchsummary :RuntimeError: Expected 5-dimensional input for 5-dimensional weight [24, 1, 3, 3, 3], but got input of size [2, 1, 1,16,256,256] instead.Solve:device = torch.device(“cuda”)#necessary...原创 2019-08-03 10:15:44 · 4117 阅读 · 0 评论 -
windows通过MobaXterm远程Ubuntu
Windows桌面打开Linux上的firefox浏览器,firefox -profilemanager原创 2019-08-10 10:05:11 · 988 阅读 · 0 评论 -
Python 直接赋值、浅拷贝copy和深度拷贝deepcopy,clone
temp = target.clone()#推荐import copytemp = copy.copy(target)补充:clone() 并不会变成一个 leaf varaible换句话说 b = a.clone() 且反向传播时,b 不会有 grad 属性,因为它有 grad_fn 且就是 clonebackward,所以它并不是独立于 a 之外的 graph leaf,a 才是真...原创 2019-08-19 22:36:20 · 2143 阅读 · 0 评论 -
Git 报错error: The following untracked working tree files would be overwritten by merge
Git 报错:error: The following untracked working tree files would be overwritten by merge: CTpreprocess.pyPlease move or remove them before you merge.原因:我在本地的仓库和github的远程仓库有冲突(实则一样的文件名),于是选择...原创 2019-08-20 16:07:56 · 4094 阅读 · 0 评论 -
git push报错 fatal: the remote end hung up unexpectedly
问题原因:推送的文件太大。解决方法:1.修改设置git config文件的postBuffer的大小。(设置为500MB=500∗10242500*1024^2500∗10242B)git config --local http.postBuffer 524288000注:–local选项指定这个设置只对当前仓库生效。2.或者直接修改本地仓库的.config文件。①打开项目所在的目录...原创 2019-08-20 10:07:40 · 752 阅读 · 0 评论 -
把文件从一台linux服务器复制到另一台linux服务器
情况1:当前机器—拷贝到—>远程机器拷贝当前机器 /usr/local/tools/ 下某个具体的文件 到 远程240机器 /usr/local/tools 下sudo scp -r /usr/local/tools/xxx文件 [email protected]:/usr/local/tools命令输入完毕,会要求输入“192.168.0.240”服务器 userName...原创 2019-08-11 21:03:29 · 7319 阅读 · 0 评论 -
python的格式化输出与TypeError: not all arguments converted during string formatting
TypeError: not all arguments converted during string formattingReason: 两种输出不可以混用#format 1print("[{}/{}], Train Loss = {:.4f} Valid Loss = {:.4f} {}".format(epoch, max_epochs + 1, train_loss, valid_...原创 2019-06-17 19:39:27 · 7069 阅读 · 0 评论