自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

清风吹斜阳

事能知足心常泰,人到无求品自高。

  • 博客(161)
  • 收藏
  • 关注

原创 pytorch 保存模型,加载预训练模型问题

在写pytorch代码时,遇到问题:加载预训练模型时在验证集上测试的psnr结果与训练时验证集的psnr差异特别大。源代码:pretrained_dict = torch.load('epochG_515.pth')net.load_state_dict(pretrained_dict)net = prepare(net)valdata = Data(root=os.path.join(args.dir_data, args.data_val), args=args, train=False

2020-08-04 20:04:45 662

转载 latex 目录层次设置

https://blog.csdn.net/golden1314521/article/details/39926135

2019-11-24 22:14:23 3911

原创 numpy flatten

latten是numpy.ndarray.flatten的一个函数import numpy as npa = np.zeros((2,3,4))print(a.shape)print(a.flatten().shape)# (2, 3, 4)# (24,)可以看到,它把 2*3*4的数组变成了1*24的数组flatten函数就是将数组折叠称一维的输出a = [[2,...

2019-11-18 22:34:21 243

原创 numpy下, meshgrid

meshgridmeshgrid的作用是:接受两个一维数组生成两个二维矩阵,对应两个数组中所有的(x,y)对, 生成网络import numpy as npx = [1, 2, 3]y = [4, 5, 6, 7]x1, y1 = np.meshgrid(x, y)print(x1)print(y1)z = np.meshgrid(x, y)print(z)print(...

2019-11-18 15:55:12 190

原创 输出list的大小

import numpy as npseq = []for i in range(10): seq.append(i)print(np.array(seq).shape)参考链接

2019-11-12 09:38:33 2453

原创 Linux 查找满足条件的文件并复制

cp $(find -name "*.png") /data

2019-11-11 11:08:47 1872

原创 转置卷积 反卷积 PyTorch torch.nn.ConvTranspose2d() output_padding

转置卷积、又称反卷积其实是卷积的逆过程。卷积的过程通常会减小特征图的的大小,而转置卷积往往增大特征图的大小,一直以来对转置卷积的过程都不是很理解,最近认真学习了一下,在此分享。卷积卷积操作,输入是一个特征图i,参数padding(p),stride(s),kernel_size(k),输出是卷积后得到的特征图o,输出的特征图大小转置卷积转置卷积是卷积的逆过程。在做的转置卷积的...

2019-11-07 16:07:15 2134 1

原创 ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memor

运行EDSR代码时,出现如下错误:解决方案: dataloader.DataLoader( testset, batch_size=1, shuffle=False, pin_memory=not a...

2019-11-06 10:40:01 2244 1

原创 面试逻辑题,智力题

1)一辆火车A以15Km/h的速度由广州驶向深圳,一只30km/h的小鸟与它一起出发,同时,另一辆火车B20km/h由深圳驶向广州,飞着飞着小鸟会和B相遇,相遇了之后小鸟就会调头,一直这样下去他们三个会在一个点相遇,此时小鸟飞了多远?解:三者相遇的时候一定有A和B相遇,而A和B相遇的位置只有一个,假设经过T时A和B相遇,广深距离为x,则此时小鸟走了2)一条一百米的跑道,有五个人...

2019-10-31 19:51:21 641

原创 windows安装MobaXterm

MobaXterm是一个软件在windows系统上像Linux一样远程连接服务器的一个软件,现介绍其安装方法下载链接:https://mobaxterm.mobatek.net/download-home-edition.html我选择的蓝色框中的下载,下载好之后解压然后运行选中的安装文件:选择next,然后接受选择next选择自己想要安装的位置,继续n...

2019-10-18 22:19:10 869

原创 windows7安装openssh

windows7也会经常需要使用ssh服务,这里简单介绍一下openssh在windows7下的安装,看了很多博客和网站介绍如何安装,最后亲测一种方法有效。首先下载openssh相关文件https://github.com/PowerShell/Win32-OpenSSH/releases然后解压,得到:然后将整个文件夹复制粘贴到C:\Program Files目录下...

2019-10-18 21:16:12 7505 1

原创 凸优化第九章无约束优化 作业题

无约束优化The solution to the following problemwithandm>n, whereAhas full (column) rankn, isWhich stopping criteria are reasonable when solving an optimization problemminimize f(x)u...

2019-10-18 11:17:51 443

原创 Linux-Anaconda-pycharm 安装 配置

Anaconda第一步下载安装文件Anaconda-download选择合适的配置,下载好,进入到包含安装包的文件夹,运行如下命令bash Anaconda3-2019.07-Linux-x86_64.sh按照提示输入回车输入yes、安装完毕下载pycharm安装文件pycharm下载链接下载完成之后,进入到安装文件所在的文件夹,用如下命令...

2019-10-18 11:06:37 1064

原创 深度学习框架PyTorch:入门与实践 学习(三)

nn.Module用nn.Module实现全连接层import torch as tfrom torch import nnfrom torch.autograd import Variable as Vclass Linear(nn.Module): def __init__(self, in_features, out_features): super...

2019-09-28 22:07:34 264

原创 深度学习框架PyTorch:入门与实践 学习(四)

PyTorch中常用工具torchvisionmodels:提供深度学习中各种经典的网络结构以及预训练好的模型,包括AlexNet, VGG, ResNet, Inception datsets:提供常用的数据集加载,设计上均继承torch.utils.data.dataset,主要包括MNIST,CIFAR10/100,ImageNet,COCO transforms:提供常用的数据...

2019-09-24 11:09:38 254

原创 深度学习框架PyTorch:入门与实践 学习(二)

Tensor和Autograd------TensorTensor创建:Tensor(*size),创建时不会立马分配空间,使用时才会分配,而其他均创建时立马就分配。 ones(*sizes) zeros(*sizes) eye(*sizes)对角线为1其他为0 arange(s,e,step)从s到e步长为step linspace(s,e,steps)从s到e,均匀切分成...

2019-09-23 21:29:47 247

原创 深度学习框架PyTorch:入门与实践 学习(一)

从今天起要从头开始学习PyTorch了,在此记下笔记。PyTorch 入门第一步Tensorimport Torch as tx = t.tensor(5,3)#生成5*3的矩阵print(x.size())# 输出x的维度print(x.size()[0]) #输出x的第0维print(x.size(0))# 输出x的第0维y = t.rand(5,3)# 生成0-1之...

2019-09-20 19:47:43 695

原创 Leetcode 1018. Binary Prefix Divisible By 5

#include<math.h>class Solution {public: vector<bool> prefixesDivBy5(vector<int>& A) { int l = A.size(); vector<bool> res(l); int rem...

2019-07-08 22:57:41 158

原创 lua : require' stn'

Spatial Transformer Networks在人脸超分辨的方法包括TDAE、TDN、FaceAttr都会用到stn模块,在运行TDAE代码时候始终报错提示我找不到stn模块,后来发现stn已经被实现了,链接:stn,下载好,琢磨了半天才明白如何使用。下载这个文件夹,里面包含一个rockspec文件,切换到rockspec文件所在的目录,运行如下命令即可:luaro...

2019-06-13 22:30:31 254

转载 EDSR dataloader.py代码问题

参考链接:EDSR代码问题 RCAN代码问题

2019-06-09 10:13:30 1686

原创 leetcode 415. Add Strings

class Solution {public: string addStrings(string num1, string num2) { int l1 = num1.length(); int l2 = num2.length(); string s; int c=0,i=l1-1,j=l2-1,count=0;; ...

2019-04-16 09:08:36 147

原创 leetcode 914. X of a Kind in a Deck of Cards

#include<algorithm>#include<map>class Solution {public: bool hasGroupsSizeX(vector<int>& deck) { int l = deck.size(); if(l<2)return false; map...

2019-04-14 22:43:09 172

原创 leetcode 561. Array Partition I

class Solution {public: bool isOneBitCharacter(vector<int>& bits) { int l = bits.size(); int i=0; while(i<l-1) { if(bits[i]==1) ...

2019-04-14 21:47:55 139

原创 leetcode 796. Rotate String

class Solution {public: bool rotateString(string A, string B) { int l1 = A.length(); int l2 = B.length(); if(l1!=l2)return false; if(l1==0)return true; ...

2019-04-14 21:33:46 122

原创 leetcode 917. Reverse Only Letters

class Solution {public: bool isString(char s) { if((s<='z'&&s>='a')||(s<='Z'&&s>='A')) return true; else return false; } strin...

2019-04-14 21:12:09 125

原创 leetcode 557. Reverse Words in a String III

#include<stack>class Solution {public: string reverseWords(string s) { int l = s.length(); int i = 0; string res; stack<char> tmp; w...

2019-04-13 15:51:51 2242

原创 leetcode 762. Prime Number of Set Bits in Binary Representation

#include<cmath>class Solution {public: bool isPrime(int l) { if(l==0||l==1)return false; if(l==2||l==3)return true; for(int i=2;i<=sqrt(l);i++) { ...

2019-04-13 13:55:16 105

原创 leetcode 830. Positions of Large Groups

class Solution {public: vector<vector<int>> largeGroupPositions(string S) { int l = S.length(); vector<vector<int>> t; int i=0; w...

2019-04-12 22:44:22 92

原创 leetcode 1013. Partition Array Into Three Parts With Equal Sum

class Solution {public: bool canThreePartsEqualSum(vector<int>& A) { int l = A.size(); int sum=0; int i; for(i=0;i<l;i++) sum+=A[i]; ...

2019-04-12 22:32:19 212

原创 leetcode 700. Search in a Binary Search Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */cla...

2019-04-12 22:05:52 190

原创 leetcode 852. Peak Index in a Mountain Array

class Solution {public: int peakIndexInMountainArray(vector<int>& A) { int l =A.size(); int i=0,j=l-1; for(i;i<l-1;i++) { if(A[i]<A[i+...

2019-04-12 21:46:19 125

原创 leetcode 606. Construct String from Binary Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */cla...

2019-04-12 21:13:39 106

原创 leetcode 944. Delete Columns to Make Sorted

class Solution {public: int minDeletionSize(vector<string>& A) { int l = A.size(); int s = A[0].length(); int count =s; for(int i=0;i<s;i++)...

2019-04-12 20:33:06 118

原创 leetcode 671. Second Minimum Node In a Binary Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */cla...

2019-04-12 16:44:26 114

原创 leetcode 566. Reshape the Matrix

class Solution {public: vector<vector<int>> matrixReshape(vector<vector<int>>& nums, int r, int c) { vector<vector<int>> res(r); int m=num...

2019-04-12 16:09:13 87

原创 leetcode 461. Hamming Distance

class Solution {public: int hammingDistance(int x, int y) { int count = 0; while(x&&y) { int r1 = x%2; int r2 = y%2; if(r1!=r2...

2019-04-12 15:40:05 88

原创 leetcode 896. Monotonic Array

class Solution {public: bool isMonotonic(vector<int>& A) { bool increase=false; if(A.size()==0||A.size()==1)return true; int i; for(i=0;i<A....

2019-04-12 15:29:33 108

原创 leetcode 575. Distribute Candies

class Solution {public: int distributeCandies(vector<int>& candies) { set<int> cl; int count = 0; for(int i=0;i<candies.size();i++) { ...

2019-04-10 10:30:11 152

原创 leetcode 500. Keyboard Row

class Solution {public: vector<string> findWords(vector<string>& words) { int alpha[26] ={1,2,2,1,0,1,1,1,0,1,1,1,2,2,0,0,0,0,1,0,0,2,0,2,0,2}; vector<string&g...

2019-04-10 10:01:28 130

原创 leetcode 509. Fibonacci Number

class Solution {public: int fib(int N) { if(N==0)return 0; if(N==1)return 1; int first=0,second=1; for(int i=2;i<=N;i++) { int tmp = first+...

2019-04-10 09:52:16 169

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除