- 博客(120)
- 资源 (9)
- 问答 (1)
- 收藏
- 关注
原创 CUDA例子
#include "cuda_runtime.h"#include "device_launch_parameters.h"#include <stdio.h>#define N 10__global__ void add(int *a, int *b, int *c){ int tid =blockIdx.x; c[tid] = a[tid] + b[tid];}int
2016-07-18 13:38:10
6773
原创 正则表达式基础
.表示除\n之外的任意字符 *表示匹配0-无穷 +表示匹配1-无穷 Python通过re模块提供对正则表达式的支持。 使用re的一般步骤是先使用re.compile()函数,将正则表达式的字符串形式编译为Pattern实例,然后使用Pattern实例处理文本并获得匹配结果(一个Match实例),最后使用Match实例获得信息,进行其他的操作。举一个简单的例子,在寻找一个字符串中所有的英文字符:
2016-07-14 23:38:09
440
原创 c++杂乱知识
应老师需求,出错处理,搞不懂谁没事在输入年级的时候输入字母啊!!!!检测输入的是非数字 cout << "输入你的年级" << endl; cin >> grade; while ( cin.get() != '\n') { fflush(stdin); cout << "请重新输入" << endl; cin.clear
2016-06-23 23:43:28
361
原创 c++文件操作和new相关
ifstream 输入文件流 input file stream 用于从文件读数据(从文件读入) ofstream 输出文件流 output file stream 用于向文件写数据(输出到文件)
2016-05-22 00:46:31
451
原创 汇编
1.切换到MASM5文件夹下。 将程序保存为asm格式, cmd中运行masm test;生成obj文件 cmd中运行link test;生成exe文件 cmd中运行debug test.exe
2016-05-11 20:03:19
412
原创 QT5基础教程
1.在窗口输出Hello BM//mainWindow.h#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>namespace Ui {class MainWindow;}class MainWindow : public QMainWindow{ Q_OBJECTpublic: explicit M
2016-05-10 21:17:32
2644
原创 CAFFE基础汇总
层之间的数据流动是以Blobs的方式进行 1.数据来源于数据库数据层是每个模型的最底层,是模型的入口,不仅提供数据的输入,也提供数据从Blobs转换成别的格式进行保存输出。通常数据的预处理(如减去均值, 放大缩小, 裁剪和镜像等),也在这一层设置参数实现。transform_param { scale: 0.00390625 #scale为0.00390625,实际上就是1/255
2016-05-08 22:00:18
386
原创 matlab .m文件的编写&使用
1.matlab如何定义函数①首先建立M文件或直接点击(File/New/Function)建立函数文件,其中函数文件的格式是:function 输出变量 = 函数名称(输入变量) % 注释 % 函数体②如下所示,是编写的一个求1到n之和的求和函数 eg_sum,按照上述格式,编写代码如下并保存文件,注意文件命名时不能以数字开头:function s=eg_sum(n)s=0;for (i=1
2016-05-02 15:04:03
14416
1
原创 Codeblocks c++11 std::thread问题
在linux下写多线程时候,碰到以下问题: terminate called after throwing an instance of ‘std::system_error’ what(): Enable multithreading to use std::thread: Operation not permitted解决办法: Setting=》compiler settings
2016-04-21 15:36:16
2220
1
原创 C++线程 基础教程
#include <iostream>#include <thread>using namespace std;void call(int tid){ cout << "Launched by thread " << tid << endl;}int main(){ thread t[10];//启动一组线程 for(int i=0;i<10;i++) {
2016-04-18 18:08:36
467
原创 matlab矩阵基础
A(:,3)%在矩阵或向量中,则表示的是取一整行或一整列。A(a1:b1,a2:b2)%截取矩阵A的a1行到a2行,a2-b2列的矩阵元素,%真彩色的图片是一个三维数组,数组的前两维分别对应图片的高和宽,第三维%的长度为3,其元素分别代表红绿蓝三基色的值。x=x(end:-1:1,:,:); % RGB上下翻转x=x(:,end:-1:1,:); % RGB左右翻转
2016-04-06 21:46:14
661
转载 solver参数详解
转自原文在Deep Learning中,往往loss function是非凸的,没有解析解,我们需要通过优化方法来求解。solver的主要作用就是交替调用前向(forward)算法和后向(backward)算法来更新参数,从而最小化loss,实际上就是一种迭代的优化算法。到目前的版本,caffe提供了六种优化算法来求解最优参数,在solver配置文件中,通过设置type类型来选择。·
2016-04-03 10:09:18
4768
原创 Python多线程
#!/usr/bin/python#coding=utf-8# multiprocessing.pyimport osprint 'Process (%s) start...' % os.getpid()#getpid是获得当前进程的进程号pid = os.fork()#ork()调用一次,返回两次,因为操作系统自动把当前进程(称为父进程)复制了一份(称为子进程)# 然后,分别在父进程和
2016-03-30 18:17:14
312
原创 python 文件操作
for parent,dirnames,filenames in os.walk(rootdir): #三个参数:分别返回1.父目录 2.所有文件夹名字(不含路径) 3.所有文件名字 print "parent is"+ parent #输出从根目录到上层目录的全部目录 for dirname in dirnames: print "d
2016-03-29 11:08:43
392
原创 c++继承
#include <iostream>using namespace std;class A{public: int get(int a,int b) { return a*b; }private: int a,b;};class Point:private A{public: void Ceshi(); private:
2016-03-21 17:06:17
352
原创 哈夫曼编码横向打印
#include<stdio.h> #include<stdlib.h> #include<Windows.h>#define MAXSIZE 30 typedef struct{ char data; float weight; int parent; int lchild; int rchild;}HTNode;typedef stru
2016-03-19 20:54:36
2841
原创 杭电1003 MaxSum动态规划
/*#include<iostream>#include<vector>using namespace std;int main(){ int n,i,sum,x,N; int begin,end; cin>>N;//Case 个数 for(x=1;x<=N;x++) { sum=0; int max=-1001;
2016-03-19 17:04:28
592
原创 python图片转字符
首先安装pip sudoapt−getinstallpython−pippython−devbuild−essential sudo apt-get install python-pip python-dev build-essential sudo pip install –upgrade pip $ sudo pip install –upgrade virtualenv #cod
2016-03-15 21:33:39
1327
原创 判断输入的是否是整数
#include<iostream>using namespace std;int main(){ int n; char f; do{ cout << "\n请输入一个非负整数n" << endl; cin >> n; while (cin.get() != '\n' || n < 0) {
2016-03-13 10:44:00
1561
原创 Python批量重命名
#coding=utf-8import osall_list=os.listdir(os.getcwd())#os.getcwd()为显示当前文件路径x=1for i in all_list: if('.jpg' in i)or('.JPG' in i): os.rename(i,"41512001%3d.jpg"%x) #以学号命名,%3d意思是将个
2016-03-05 18:56:35
685
原创 虚函数&纯虚函数
虚函数的作用是允许在派生类中重新定义与基类同名的函数,并且可以通过基类指针引用来访问基类和派生类中的同名函数。#include<iostream>using namespace std;class Student{public: Student(int,string,float); virtual void display();//virtual 声明为虚函数protecte
2016-03-01 12:41:41
655
原创 caffe常见问题
1.显存不足 “error == cudaSuccess (2 vs. 0) out of memory” 减小该模型的train_val.prototxt中的batch_size(如果减到1还不行的话,准备换显卡吧)。
2016-02-28 16:36:18
1754
转载 谷歌大脑科学家 Caffe缔造者 贾扬清 微信讲座完整版
一、讲座正文: 大家好!我是贾扬清,目前在Google Brain,今天有幸受雷鸣师兄邀请来和大家聊聊Caffe。 没有太多准备,所以讲的不好的地方还请大家谅解。 我用的ppt23基本上和我们在CVPR上要做的tutorial是类似的,所以大家如果需要更多的内容的话,可以去tutorial.caffe.berkeleyvision.org,也欢迎来参加我们的tutorial:) 网页上应该还
2016-02-28 14:28:48
1057
原创 Python爬虫
1.爬图片#coding=utf-8import urllibimport redef getHtml(url): page = urllib.urlopen(url) html = page.read() return htmldef getImg(html): reg = 'src="(http.*.jpg)"' imgre =
2016-01-25 18:38:32
498
原创 Python
类class采用__init__()来完成初始化class Ball: def __init__(self,color,size,direction): self.color=color self.size=size self.direction=direction def bounce(it): if(i
2016-01-23 10:16:53
820
原创 caffe训练测试自己的数据集
http://blog.csdn.net/sloanqin/article/details/49152351 http://blog.csdn.net/liumaolincycle/article/details/48475479 http://www.docin.com/p-871820919.html 注意: ①修改路径时候使用绝对路径 ②训练时,如果loss值或输出值非常大,或显示成
2016-01-17 18:50:05
1012
原创 caffe之MNIST基础详解
cd $CAFFE_ROOT./data/mnist/get_mnist.sh./examples/mnist/create_mnist.shget_mnist.sh:下载mnist的数据集。create_mnist.sh是将下载好的mnist数据集转化为lmdb格式,新版本的caffe中默认将MNIST数据集转换为lmdb格式的文件。当然,你也可以根据需要用它生成leveldb格式的文件
2016-01-17 10:00:53
1208
原创 Ubuntu codeblocks中文不显示及配色方案
1.不显示中文 首先,通过Ubuntu的软件中心安装codeblocks 在环境设置里进行如下设置: settings -> Environment 把Terminal to launch console programs那个选项改成gnome-terminal -t TITLE−x原来是xterm−TTITLE -x 原来是xterm -T TITLE -e2.配色方案; ①
2016-01-15 18:30:21
2215
原创 排序
void maopao(int a[]) {//简单的冒泡排序 int i, j,temp,n=10; for (i = 1; i < n;i++) for (j = 0; j < n - i; j++) { if (a[j]>a[j + 1]) { temp = a[j]; a[j] = a[j
2015-12-25 17:49:09
441
原创 查找
1.二叉排序树#include#include#define Status inttypedef struct BiTNode{ int data; struct BiTNode *lchild, *rchild;}BiTNode,*BiTree;Status SearchBST(BiTree T, int key, BiTree f, BiTree *p){//在根指针T
2015-12-17 19:22:56
444
原创 ubuntu QQ
1.安装wine-1.6(不知道是不是必须的)sudo apt-get install wine1.6wine安装过程中有些问题,就是可能会弹出一个协议,让你去点击“确定” 我们需要按“Tab”或者或者空格键点击“确定”。才能进行下一步哦!2.下载wine版本的QQ 百度云http://pan.baidu.com/s/1sjTaw3bunzip解压
2015-12-08 20:31:55
691
原创 vim插件管理器vundle
filetype off set nocompatible set rtp+=~/.vim/bundle/vundle call vundle#rc() " let Vundle manage Vundle, required! Bundle 'gmarik/vundle'"My bundles here:Bundle 'altercation/vim-
2015-12-08 06:51:18
513
原创 C++类与对象基础
/*Point类的构造函数是内联成员函数如果没有定义复制构造函数,系统会为你生成一个默认的复制构造函数Point类复制构造函数被调用4次,xp1,xp2先被传了实参后,调用两次Point复制构造函数,然后xp1,xp2去初始化p1,p2又调用两次Point类复制构造函数*/#include#includeusing namespace std;class Point //Po
2015-12-06 21:08:05
618
原创 图
1.图的数组表示法//无向图#include#include#define INFINITY 999#define MAX_VERTEX 20#define char VertexType //顶点类型#define int EdgeType //边上的权值类型typedef struct { VertexType vexs[MAX_VERTAX];//顶点表 EdgeT
2015-12-02 01:06:15
909
原创 matlab基础
>> x=0:pi/10:2*pi; %构造向量,以pi/10为单位>> y1=sin(x);>> y2=cos(x);>> plot(x,y1,x,y2)>>
2015-11-14 17:29:52
493
原创 Deep Learning 相关网址
从老师让我研究Deep Learning已经有半个学期了,唉,可是一点成效都没有,一入Deep Learning深似海,可我连环境都搭建不好,也许是我懒,一遇到大的困难就想逃避,但Caffe的环境搭建好复杂,几乎每一步都会出错,而且一些问题一直没有解决,自己一人瞎摸索,学长学姐的研究领域与我不同,老师只能统筹大局,在细节上也帮不到自己,感觉就是在浪费时间.CUDA掌握的也远远不够,不知何去何从,不
2015-11-11 17:54:25
467
原创 二叉树的基本操作
#include#include#define TElemType char#define Status int#define OK 1typedef struct BiTNode{ TElemType data; struct BiTNode *lchild, *rchild;}BiTNode, *BiTree;Status Create(BiTree *T){ TEle
2015-11-10 23:49:05
604
原创 数组和广义表
#include#include#define MAXSIZE 100#define Status inttypedef struct{ int i, j;//非零元的行下标和列下标 int e;}Triple;typedef struct{ Triple data[MAXSIZE + 1];//非零元的三元组表,data[0]未用 int mu, nu, tu;//矩阵中
2015-10-30 09:17:52
494
原创 串,模式匹配Index
#include#include#include#define MAXSIZE 40#define OK 1#define Status inttypedef char SString[MAXSIZE+1]//0号单元存放串的长度Status StrAssign(SString T,char *chars)//生成一个其值等于chars的子串{ i
2015-10-27 20:01:24
722
贪吃蛇网络版
2016-09-03
CUDA图像反转代码
2015-09-17
cuda opencv GPU模块的使用出错
2015-07-22
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅