原创 (Tensorflow之七)L1_regularizer與L2_regularizer正則化

一、源碼 import tensorflow as tf a = tf.constant([2.0,3.0,4.0]) b = tf.contrib.layers.l1_regularizer(1.0)(a) c = tf.co

原创 (Tensorflow之八)MNIST數字識別源碼--實戰Google深度學習框架5.2小節

針對原書本的一點小bug進行了修改,直接貼上源碼,供大家參考 訓練集與測試集的模型需手動下載,下載地址:http://yann.lecun.com/exdb/mnist/ import tensorflow as tf #引入tf中的tf

原创 (Tensorflow之三)神經網絡程序一

import tensorflow as tf from numpy.random import RandomState #輸入層(設有3個輸入變量1x3) rdm = RandomState(1) IN = rdm.rand(1000

原创 (VS2017+OPENCV3.3.1)人臉檢測,detectMultiScale內存泄漏處理方法

一、人臉識別代碼 #include "opencv2/objdetect.hpp" #include "opencv2/highgui.hpp" #include "opencv2/imgproc.hpp" #include <iostr

原创 (Tensorflow之四)激活函數、交叉熵及優化器

一、激活函數 激活函數的主要作用是提供網絡的非線性建模能力。如果沒有激活函數,那麼該網絡僅能夠表達線性映射,此時即便有再多的隱藏層,其整個網絡跟單層神經網絡也是等價的。因此也可以認爲,只有加入了激活函數之後,深度神經網絡才具備了分

原创 (Tensorflow之六)滑動平均模型ExponentialMovingAverage

1、計算方法 設{a1,a2,a3,...,an} ,其衰減率爲decay ,對應的影子變量爲: {m1,m2,m3,...,mn} ,則: mn=decay∗mn−1+(1−decay)∗an 可以展開來分析: m1=a

原创 二叉樹的創建、先序、中序、後序遍歷

#include <stdio.h> #include <stdlib.h> #define ERROR 0 #define OK 1 typede

原创 棧的基本操作

#include <stdio.h> #include <stdlib.h> #define ERROR 0 #define OK 1 #defin

原创 conio.h

C語言圖形函數(一) (轉載自http://blog.csdn.net/deit_aaron/article/details/7256308) C語言圖形編程(一,字符屏幕) 一,屏幕操作函數 1. clrscr()清除字符窗口函數 2

原创 (Tensorflow之二)張量、會話、向前傳播

一、張量 張量本身只是一個計算的過程,不會存儲結果;例如: a = tf.constant(30) b = tf.constant(20) c = a + b print(c) 結果:Tensor(“add:0”, sha

原创 (VS2017+OPENCV3.3.1)攝像頭小工具,每5分鐘保存一幀畫面

#include "stdafx.h" #include <opencv2/opencv.hpp> #include <iostream> #inc

原创 (Tensorflow之五)Python 中 if __name__ = '__main__'

__name__:模塊名 python中的模塊名可以分成兩類,一類是xxx.py文件,那麼模塊名就是xxx,例如test.py,那麼模塊名是test,調用方法就是import test;另一類是__main__,當直接運行xxx

原创 ARM中的特殊寄存器

SP(R13) 特殊寄存器 LR(R14) 1、當存在子程序時,保存有子程序的返回地址 2、當異常中斷髮生時,保存有異常模式的返回地址 PC(R15) 保存程序的當前地址 例 :(bootloader中start.S文件) reset:

原创 (Tensorflow之一)python2.7+tensorflow+opencv的環境搭建(ubuntu)

注:最好是用python2.7版本,試過3.5版本的,與OPENCV兼容不好,一大堆問題。 一、安裝2.7版本tensorflow $ pip install tensorflow 二、安裝opencv_python sudo apt-g

原创 [Tensorflow之九]Tensorflow模型的保存與加載

一、保存模型 例: import tensorflow as tf var1 = tf.Variable(tf.constant(1.0,shape=[1]),name='num1') var2 = tf.Variable(tf.cons