- 博客(55)
- 收藏
- 关注
原创 Spark Streaming pipeline
import org.apache.spark._import org.apache.spark.streaming._// 首先配置一下本 quick example 将跑在本机,app name 是 NetworkWordCountval conf = new SparkConf().setMaster("local[2]").setAppName("NetworkWordCount"...
2018-03-14 09:55:03
536
原创 中文语音识别
#coding: utf-8 import tensorflow as tf import numpy as np import osimport iofrom collections import Counter import librosa from joblib import Parallel, delayed wav_path = './wav/tr...
2018-03-14 09:36:22
1396
原创 tf 利用双向LSTM实现分词
数据预处理:# -*- coding:utf-8 -*-import numpy as npimport pandas as pdimport matplotlib.pyplot as pltimport refrom tqdm import tqdm# 以字符串的形式读入所有数据with open('raw_data/msr_train.txt', 'rb') as inp:...
2018-02-28 18:03:09
1360
原创 tf 加载模型
with tf.Session(config = config) as sess: try: #定义了存储模型的文件路径,即:当前运行的python文件路径下,文件名为stock_rnn.ckpt saver.restore(sess, model_save_path) pri...
2018-02-28 17:54:20
1233
原创 tf VGG model
#!/usr/bin/env python2# -*- coding: utf-8 -*-"""Created on Thu Jan 4 14:18:15 2018@author: stefan"""import tensorflow as tfdef mmodel(images,batch_size): with tf.variable_scope('conv1_1')...
2018-02-28 17:49:46
416
原创 tf.variable_scope & tf.varaible_scope
# -*- coding:utf-8 -*-import tensorflow as tf# 设置GPU按需增长#config = tf.ConfigProto()#config.gpu_options.allow_growth = True#sess = tf.Session(config=config)sess = tf.Session()# 1.placeholderv1 ...
2018-02-28 17:48:33
490
原创 tf实现多层LSTM
# -*- coding:utf-8 -*-import tensorflow as tfimport numpy as npfrom tensorflow.contrib import rnnfrom tensorflow.examples.tutorials.mnist import input_data# 设置 GPU 按需增长#config = tf.ConfigProto(...
2018-02-28 17:46:37
3348
原创 tf实现逻辑回归
# -*- coding:utf-8 -*-#功能: 使用tensorflow实现一个简单的逻辑回归import tensorflow as tfimport numpy as npimport matplotlib.pyplot as plt#创建占位符X = tf.placeholder(tf.float32)Y = tf.placeholder(tf.float32)#创...
2018-02-28 17:44:46
454
原创 ViewController详解
在我之前的学习笔记中讨论过ViewController,过了这么久,对它也有了新的认识和体会,ViewController是我们在开发过程中碰到最多的朋友,今天就来好好认识一下它。ViewController是IOS开发中MVC模式中的C,ViewController是view的controller,ViewController的职责主要包括管理内部各个view的加载显示和卸载,同时负责与其他V...
2018-02-28 17:38:46
5865
原创 tf实现多层cnn
# -*- coding: utf-8 -*-import numpy as npimport tensorflow as tfimport matplotlib.pyplot as pltfrom tensorflow.examples.tutorials.mnist import input_data# 用tensorflow 导入数据mnist = input_data.rea...
2018-02-28 17:35:42
935
原创 tf的整体流程
# -*- coding: utf-8 -*-import tensorflow as tfimport numpy as np# 1.准备数据:使用 NumPy 生成假数据(phony data), 总共 100 个点.x_data = np.float32(np.random.rand(2, 100))y_data = np.dot([0.100, 0.200], x_data)...
2018-02-28 17:33:06
792
原创 34. Search for a Range
Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target...
2018-02-27 15:53:54
112
原创 添加椒盐噪声
#include <iostream>#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc/imgproc.hpp>void salt(cv::Mat image, int n){ int i, j;...
2018-02-27 15:50:41
1862
1
原创 膨胀腐蚀
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include "highgui.h"#include <stdlib.h>#include <stdio.h>using namespace cv;/// 全局变量Mat src, erosion_ds...
2018-02-27 15:50:14
196
原创 线性滤波器对图像进行平滑处理
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"using namespace std;using namespace cv;/// 全局变量int DELAY_CAPTION = 1500;int DELAY_BLUR = 100;int MAX_KERNEL_LENGTH ...
2018-02-27 15:49:44
717
原创 形态学变换
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include <stdlib.h>#include <stdio.h>using namespace cv;/// 全局变量Mat src, dst;int morph_elem = 0;int m...
2018-02-27 15:49:11
356
原创 sobel导数边缘检测(一阶导数求边缘)
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include <stdlib.h>#include <stdio.h>using namespace cv;/** @function main */int main(){ Mat src, src...
2018-02-27 15:48:47
945
原创 Laplace算子边缘检测(二阶导数)
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include <stdlib.h>#include <stdio.h>using namespace cv;/** @函数 main */int main(){ Mat src, src_gray, ...
2018-02-27 15:48:18
826
原创 Canny边缘检测
#include "opencv2/imgproc/imgproc.hpp"#include "opencv2/highgui/highgui.hpp"#include <stdlib.h>#include <stdio.h>using namespace cv;/// 全局变量Mat src, src_gray;Mat dst, detected_ed...
2018-02-27 15:47:50
242
原创 霍夫变换检测直线
#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include <iostream>using namespace cv;using namespace std;void help(){ cout << "\nThis program demonst...
2018-02-27 15:47:21
172
原创 霍夫变换检测圆
#include "opencv2/highgui/highgui.hpp"#include "opencv2/imgproc/imgproc.hpp"#include <iostream>#include <stdio.h>using namespace cv;/** @function main */int main(){ Mat src, src_...
2018-02-27 15:46:20
726
原创 数字图像处理(matlab)
图像反转:代码:I=imread('coins.png');R=255-I;subplot(1,2,1);imshow(I);title('原图');subplot(1,2,2);imshow(R);title('反转后'); 二值图像:代码:I=imread('coins.png')YZmax=max(max(I))YZmin=min(min(I))initialYZ=(YZmax+YZmin)...
2018-02-27 15:41:59
612
原创 灰度归一化算法比较(SQI,TT等)
gross.h#ifndef gross_h #define gross_h void GrossBrajovic(IplImage *src, std::string dstfilename);void Gross(IplImage *src, std::string filename);void fill0(double **u, int n);void interp(double...
2018-02-27 15:37:10
1231
原创 tensorflow小笔记
机器学习的一个通用过程:1.准备数据 -> 2.构造模型(设置求解目标函数) -> 3.求解模型TensorFlow中每一个计算都是计算图上的一个节点。TensorFlow会自动生成一个默认的计算图,如果没有特殊指定,运算会自动加入这个计算图中。首先我们要确立一种 Graph 的思想。在 TensorFlow 中,我们定义一个变量,相当于往 Graph 中添加了一个节点。tf.Vari...
2018-02-27 15:19:18
163
原创 几种图像放缩的方法
#include <iostream>#include <opencv2/core/core.hpp>#include <opencv2/imgproc/imgproc.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/opencv.hpp>#include ...
2018-02-27 15:15:12
1160
原创 py-faster-rcnn 修改demo.py文件将所有目标框都显示在同一张图里
#!/usr/bin/env python# --------------------------------------------------------# Faster R-CNN# Copyright (c) 2015 Microsoft# Licensed under The MIT License [see LICENSE for details]# Written by ...
2018-02-27 15:13:23
1762
原创 caffe python接口可视化特征
#coding:utf-8import numpy as npimport matplotlib.pyplot as pltimport osimport caffeimport sysimport pickleimport cv2caffe_root = '../' deployPrototxt = '/home/hrw/caffe/extractFeature/dep...
2018-02-27 15:09:44
265
原创 caffe python接口训练VGG
# -*- coding: utf-8 -*-"""@author: root"""#matplotlib是python最著名的绘图库import matplotlib.pyplot as pltimport caffe#import cv2from numpy import *caffe.set_device(0)caffe.set_mode_gpu()solver =...
2018-02-27 15:08:02
417
原创 caffe获取python接口的mean.npy文件
#!/usr/bin/env pythonMEAN_BIN = 'imagenet_mean.binaryproto'MEAN_NPY = 'mean.npy'from caffe.proto import caffe_pb2from caffe.io import blobproto_to_arrayprint('generating mean file...')mean_b...
2018-02-27 14:55:35
911
原创 caffe各种计算相似度的函数以及分类测试
import numpy as npimport sysimport collectionsfrom caffe.proto import caffe_pb2from numpy import *import matplotlib.pyplot as pltimport osimport shutilfrom PIL import Imageimport matplotlib.p...
2018-02-27 14:54:18
664
原创 seamCarving算法(c++版)
#include <cv.h>#include <highgui.h>#include <stdio.h>#include <stdlib.h>#include "cstringt.h"#include "io.h"#include <string>#include <vector>#i
2018-02-27 14:51:38
2317
原创 入职
报道第一天安装了所有的软件,包括(pycharm,eclipse,IDEA, vpn客户端)安装hadoop,kafka,sbt,spark,hive,hbase,maven等各种本地环境申请各种权限vpn之类第一次听说一些名字nginx,zookeeper,yarn ,etc其实刚来的时候我的背景是计算机视觉方向,研究生期间是模式识别和图像处理,做的几个课题都是人脸识别和图像分类的任务几个实习也...
2018-02-27 14:45:04
343
原创 2017秋招安居客面经
一面:自我介绍 根据项目提问 手推逻辑回归 罗辑回归如何处理多分类 过拟合 优化策略 调参方法 卷积网络的特点和优势 sigmoid和relu等了1个半小时…………二面: 自我介绍 问项目 ...
2018-02-27 14:33:12
311
原创 74.Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: ● Integers in each row are sorted from left to right. ● The first integer of ea...
2018-02-23 18:20:14
104
原创 81. Search in Rotated Sorted Array II
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Write a function to determine if a given target is in t...
2018-02-23 18:19:50
118
原创 69. Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.class Solution {public: int mySqrt(int x) { unsigned long long begin = 0; unsigned long long end = (x+1)/2; ...
2018-02-23 18:19:25
111
原创 35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.He...
2018-02-23 18:19:03
94
原创 11. Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two ...
2018-02-23 18:17:51
124
原创 3.Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", with th...
2018-02-23 18:17:30
112
原创 32.Longest Valid Parentheses
动态规划法将大问题化为小问题,我们不一定要一下子计算出整个字符串中最长括号对,我们可以先从后向前,一点一点计算。假设d[i]是从下标i开始到字符串结尾最长括号对长度,s[i]是字符串下标为i的括号。如果s[i-1]是左括号,如果i + d[i] + 1是右括号的话,那d[i-1] = d[i] + 1。如果不是则为0。如果s[i-1]是右括号,因为不可能有右括号开头的括号对,所以d[i-1] = ...
2018-02-23 18:17:04
110
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人