Ⅰ 利用Python對praat構建的語音數據集如何進行訓練
摘要 【python語音識別訓練_用 Python 訓練自己的語音識別系統,這波操作穩了_weixin_39942037的博客-CSDN博客】https://blog.csdn.net/weixin_39942037/article/details/111446620
Ⅱ python音頻ZCR有什麼用
穩定音頻信號。python音頻ZCR是指一個信號的符號變化的比率,用戶可以根據比率自行調節ZCR的過零率,以此來穩定音頻信號波動。
Ⅲ python需要學習什麼內容
Python的學習內容還是比較多的,我們將學習的過程劃分為4個階段,每個階段學習對應的內容,具體的學習順序如下:
Python學習順序:
①Python軟體開發基礎
掌握計算機的構成和工作原理
會使用Linux常用工具
熟練使用Docker的基本命令
建立Python開發環境,並使用print輸出
使用Python完成字元串的各種操作
使用Python re模塊進行程序設計
使用Python創建文件、訪問、刪除文件
掌握import 語句、From…import 語句、From…import* 語句、方法的引用、Python中的包
②Python軟體開發進階
能夠使用Python面向對象方法開發軟體
能夠自己建立資料庫,表,並進行基本資料庫操作
掌握非關系資料庫MongoDB的使用,掌握Redis開發
能夠獨立完成TCP/UDP服務端客戶端軟體開發,能夠實現ftp、http伺服器,開發郵件軟體
能開發多進程、多線程軟體
③Python全棧式WEB工程師
能夠獨立完成後端軟體開發,深入理解Python開發後端的精髓
能夠獨立完成前端軟體開發,並和後端結合,熟練掌握使用Python進行全站Web開發的技巧
④Python多領域開發
能夠使用Python熟練編寫爬蟲軟體
能夠熟練使用Python庫進行數據分析
招聘網站Python招聘職位數據爬取分析
掌握使用Python開源人工智慧框架進行人工智慧軟體開發、語音識別、人臉識別
掌握基本設計模式、常用演算法
掌握軟體工程、項目管理、項目文檔、軟體測試調優的基本方法
互聯網行業目前還是最熱門的行業之一,學習IT技能之後足夠優秀是有機會進入騰訊、阿里、網易等互聯網大廠高薪就業的,發展前景非常好,普通人也可以學習。
想要系統學習,你可以考察對比一下開設有相關專業的熱門學校,好的學校擁有根據當下企業需求自主研發課程的能力,中博軟體學院、南京課工場、南京北大青鳥等開設python專業的學校都是不錯的,建議實地考察對比一下。
祝你學有所成,望採納。
Ⅳ 如何優雅的用Python玩轉語音聊天機器人
所需硬體:
樹莓派B+
人體紅外線感應模塊
內置麥克風攝像頭(實測樹莓派免驅淘寶鏈接)
申請API:
網路語音api
圖靈api
語音聊天機器人實現原理:當有人來到跟前時--》觸發聊天功能,開始以每2s檢測錄制語音--》通過網路語音api合成文字--》傳遞給圖靈api返回回答信息--》通過網路語音合成播放
【人體感應識別部分Python代碼renti.py】
#/usr/bin/python#coding:utf-8import RPi.GPIO as GPIOimport timeimport osimport signalimport atexitGPIO.setmode(GPIO.BCM) GPIO_PIR = 14 GPIO.setup(GPIO_PIR,GPIO.IN) # Echojing = 0dong = 0 sum = 0sum1 = 0oldren = 0sleep = 0def ganying(): i = 0 ok = 0 error = 0 while i < 10: if GPIO.input(GPIO_PIR) == 1 : ok = ok + 1 if GPIO.input(GPIO_PIR) == 0 : error = error + 1 time.sleep(0.01) i = i + 1 ren = ok/(error+1) return ren
1
GPIO_PIR = 14
為 紅外線檢測模塊與樹莓派的針腳,腳本函數返回0表示無人,>0 為有人
【Python語音識別聊天部分robot.py】
#/usr/bin/python# -*- coding:utf-8 -*-import sysreload(sys)sys.setdefaultencoding( "utf-8" )import urllibimport urllib2import jsonimport uuidimport base64import osimport timefrom renti import * #獲取網路tokenappid=7647466apikey="網路API"secretkey="網路API" _url="h.com/oauth/2.0/token?grant_type=client_credentials&client_id=" + apikey + "&client_secret=" + secretkey; y_post=urllib2.urlopen(_url)y_read=y_post.read()y_token=json.loads(y_read)['access_token']#print y_read#print y_token #------------------function------------- def luyin(): os.system('arecord -D plughw:1,0 -c 1 -d 2 1.wav -r 8000 -f S16_LE 2>/dev/null') def fanyi():
#---------------語音識別部分 mac_address="haogeoyes" with open("1.wav",'rb') as f: s_file = f.read() speech_base64=base64.b64encode(s_file).decode('utf-8') speech_length=len(s_file) data_dict = {'format':'wav', 'rate':8000, 'channel':1, 'cuid':mac_address, 'token':y_token, 'lan':'zh', 'speech':speech_base64, 'len':speech_length} json_data = json.mps(data_dict).encode('utf-8') json_length = len(json_data) asr_server = 'm/server_api' request = urllib2.Request(url=asr_server) request.add_header("Content-Type", "application/json") request.add_header("Content-Length", json_length) fs = urllib2.urlopen(url=request, data=json_data) result_str = fs.read().decode('utf-8') json_resp = json.loads(result_str) if json_resp.has_key('result'): out_txt=json_resp['result'][0] else: out_txt="Null" return out_txt def tuling(b): f=urllib.urlopen("23.com/openapi/api?key="此處為圖靈API"&info=%s" % b) f=json.loads(f.read())['text'] return f def hecheng(text,y_token): #text="你好我是機器人牛牛很高興能夠認識你" geturl="u.com/text2audio?tex="+text+"&lan=zh&per=1&pit=9&spd=6&cuid=CCyo6UGf16ggKZGwGpQYL9Gx&ctp=1&tok="+y_token return os.system('omxplayer "%s" > /dev/null 2>&1 '%(geturl)) #return os.system('omxplayer "%s" > /dev/null 2>&1 '%(geturl)) def nowtime(): return time.strftime('%Y-%m-%d %H:%M:%S ') #---------------main-----------------num=0 #num用來判斷是第一次說話,還是在對話過程中first=1 #判斷是不是第一說話 當1000次沒有人動認為是第一次while True: if ganying()!=0: run=open('run.log','a') if first==0: hecheng("你好,我是牛牛機器人,你可以和我聊天,不過說話的時候你必須靠近話筒近一點,",y_token) hecheng("說點什麼吧,2秒鍾內說完哦.",y_token) first=1 #為1一段時間就不執行 num=0 #從新計數 #print ganying() run.write(nowtime()+"說點神馬吧..........."+'\n') print nowtime()+"說點神馬吧.........." luyin() #開始錄音 out=fanyi().encode("utf-8") #翻譯文字 run.write(nowtime()+"我說:"+out+'\n') print nowtime()+"我說:"+out if out == "Null": text="沒有聽清楚你說什麼" os.system('omxplayer "shenme.wav" > /dev/null 2>&1 ') else: text=tuling(out) hecheng(text,y_token) print nowtime()+"牛牛:"+text run.write(nowtime()+"牛牛:"+text+'\n') run.close() else: #print ganying() #調試查看是否為0有人沒人 #print num num=num+1 #num長時間增大說明沒有人在旁邊 if num > 1000: first=0 #0表示第一次說話
萬事俱備 運行nohup python robot.py 哈哈就可以脫離屏幕開始愉快的語音聊天啦
下面看看聊天的日誌記錄吧
後續更新。。。。。。Python如何用語音優雅的控制小車
Ⅳ 如何用 Python 構建神經網路擇時模型
import math
import random
random.seed(0)
def rand(a,b): #隨機函數
return (b-a)*random.random()+a
def make_matrix(m,n,fill=0.0):#創建一個指定大小的矩陣
mat = []
for i in range(m):
mat.append([fill]*n)
return mat
#定義sigmoid函數和它的導數
def sigmoid(x):
return 1.0/(1.0+math.exp(-x))
def sigmoid_derivate(x):
return x*(1-x) #sigmoid函數的導數
class BPNeuralNetwork:
def __init__(self):#初始化變數
self.input_n = 0
self.hidden_n = 0
self.output_n = 0
self.input_cells = []
self.hidden_cells = []
self.output_cells = []
self.input_weights = []
self.output_weights = []
self.input_correction = []
self.output_correction = []
#三個列表維護:輸入層,隱含層,輸出層神經元
def setup(self,ni,nh,no):
self.input_n = ni+1 #輸入層+偏置項
self.hidden_n = nh #隱含層
self.output_n = no #輸出層
#初始化神經元
self.input_cells = [1.0]*self.input_n
self.hidden_cells= [1.0]*self.hidden_n
self.output_cells= [1.0]*self.output_n
#初始化連接邊的邊權
self.input_weights = make_matrix(self.input_n,self.hidden_n) #鄰接矩陣存邊權:輸入層->隱藏層
self.output_weights = make_matrix(self.hidden_n,self.output_n) #鄰接矩陣存邊權:隱藏層->輸出層
#隨機初始化邊權:為了反向傳導做准備--->隨機初始化的目的是使對稱失效
for i in range(self.input_n):
for h in range(self.hidden_n):
self.input_weights[i][h] = rand(-0.2 , 0.2) #由輸入層第i個元素到隱藏層第j個元素的邊權為隨機值
for h in range(self.hidden_n):
for o in range(self.output_n):
self.output_weights[h][o] = rand(-2.0, 2.0) #由隱藏層第i個元素到輸出層第j個元素的邊權為隨機值
#保存校正矩陣,為了以後誤差做調整
self.input_correction = make_matrix(self.input_n , self.hidden_n)
self.output_correction = make_matrix(self.hidden_n,self.output_n)
#輸出預測值
def predict(self,inputs):
#對輸入層進行操作轉化樣本
for i in range(self.input_n-1):
self.input_cells[i] = inputs[i] #n個樣本從0~n-1
#計算隱藏層的輸出,每個節點最終的輸出值就是權值*節點值的加權和
for j in range(self.hidden_n):
total = 0.0
for i in range(self.input_n):
total+=self.input_cells[i]*self.input_weights[i][j]
# 此處為何是先i再j,以隱含層節點做大循環,輸入樣本為小循環,是為了每一個隱藏節點計算一個輸出值,傳輸到下一層
self.hidden_cells[j] = sigmoid(total) #此節點的輸出是前一層所有輸入點和到該點之間的權值加權和
for k in range(self.output_n):
total = 0.0
for j in range(self.hidden_n):
total+=self.hidden_cells[j]*self.output_weights[j][k]
self.output_cells[k] = sigmoid(total) #獲取輸出層每個元素的值
return self.output_cells[:] #最後輸出層的結果返回
#反向傳播演算法:調用預測函數,根據反向傳播獲取權重後前向預測,將結果與實際結果返回比較誤差
def back_propagate(self,case,label,learn,correct):
#對輸入樣本做預測
self.predict(case) #對實例進行預測
output_deltas = [0.0]*self.output_n #初始化矩陣
for o in range(self.output_n):
error = label[o] - self.output_cells[o] #正確結果和預測結果的誤差:0,1,-1
output_deltas[o]= sigmoid_derivate(self.output_cells[o])*error#誤差穩定在0~1內
#隱含層誤差
hidden_deltas = [0.0]*self.hidden_n
for h in range(self.hidden_n):
error = 0.0
for o in range(self.output_n):
error+=output_deltas[o]*self.output_weights[h][o]
hidden_deltas[h] = sigmoid_derivate(self.hidden_cells[h])*error
#反向傳播演算法求W
#更新隱藏層->輸出權重
for h in range(self.hidden_n):
for o in range(self.output_n):
change = output_deltas[o]*self.hidden_cells[h]
#調整權重:上一層每個節點的權重學習*變化+矯正率
self.output_weights[h][o] += learn*change + correct*self.output_correction[h][o]
#更新輸入->隱藏層的權重
for i in range(self.input_n):
for h in range(self.hidden_n):
change = hidden_deltas[h]*self.input_cells[i]
self.input_weights[i][h] += learn*change + correct*self.input_correction[i][h]
self.input_correction[i][h] = change
#獲取全局誤差
error = 0.0
for o in range(len(label)):
error = 0.5*(label[o]-self.output_cells[o])**2 #平方誤差函數
return error
def train(self,cases,labels,limit=10000,learn=0.05,correct=0.1):
for i in range(limit): #設置迭代次數
error = 0.0
for j in range(len(cases)):#對輸入層進行訪問
label = labels[j]
case = cases[j]
error+=self.back_propagate(case,label,learn,correct) #樣例,標簽,學習率,正確閾值
def test(self): #學習異或
cases = [
[0, 0],
[0, 1],
[1, 0],
[1, 1],
] #測試樣例
labels = [[0], [1], [1], [0]] #標簽
self.setup(2,5,1) #初始化神經網路:輸入層,隱藏層,輸出層元素個數
self.train(cases,labels,10000,0.05,0.1) #可以更改
for case in cases:
print(self.predict(case))
if __name__ == '__main__':
nn = BPNeuralNetwork()
nn.test()
Ⅵ 關於python的問題
你的程序大部分都沒錯,只是對列表my_list中的字元串元素"5"轉數值元素時,要把轉換結果賦值給原元素,
否則列表my_list沒改變,導致處理字元串元素"5"時,出現不支持字元串和整數相除操作的錯誤.
完整的Python程序如下(改動的地方見注釋,僅一處有問題)
my_list = [1, 2, 3, 4, "5"]
my_list[4]=int(my_list[4]) #這里把int(my_list[4])改成my_list[4]=int(my_list[4])
number = int(input("請輸入一個number:"))
for i in my_list:
print(f"{i}/{number}={i/number}")
源代碼(注意源代碼的縮進)
Ⅶ python代碼問題。
如果在是Python解釋器里運行的話,沒有問題。「X,L」就是列印出X,L的值。問題應該在最後一行的X,L,如果在寫成一個腳本由Python執行的話,就不能這么寫了。要用"print X,L"明確告訴Python輸出X,L的值。
Python(英語發音:/ˈpaɪθən/), 是一種面向對象、解釋型計算機程序設計語言,由Guido van Rossum於1989年底發明,第一個公開發行版發行於1991年,Python 源代碼同樣遵循 GPL(GNU General Public License)協議。Python語法簡潔而清晰,具有豐富和強大的類庫。它常被昵稱為膠水語言,能夠把用其他語言製作的各種模塊(尤其是C/C++)很輕松地聯結在一起。常見的一種應用情形是,使用Python快速生成程序的原型(有時甚至是程序的最終界面),然後對其中有特別要求的部分,用更合適的語言改寫,比如3D游戲中的圖形渲染模塊,性能要求特別高,就可以用C/C++重寫,而後封裝為Python可以調用的擴展類庫。需要注意的是在您使用擴展類庫時可能需要考慮平台問題,某些可能不提供跨平台的實現。
折疊在Python中學習機器學習的四個步驟:
1、首先你要使用書籍、課程、視頻來學習 Python 的基礎知識[2]
2、然後你必需掌握不同的模塊,比如 Pandas、Numpy、Matplotlib、NLP (自然語言處理),來處理、清理、繪圖和理解數據。
3、接著你必需能夠從網頁抓取數據,無論是通過網站API,還是網頁抓取模塊Beautiful Soap。通過網頁抓取可以收集數據,應用於機器學習演算法。
4、最後一步,你必需學習機器學習工具,比如 Scikit-Learn,或者在抓取的數據中執行機器學習演算法(ML-algorithm)。
Ⅷ 如何用python調用百度語音識別
1、首先需要打開網路AI語音系統,開始編寫代碼,如圖所示,編寫好回車。
Ⅸ 怎樣用python構建一個卷積神經網路模型
上周末利用python簡單實現了一個卷積神經網路,只包含一個卷積層和一個maxpooling層,pooling層後面的多層神經網路採用了softmax形式的輸出。實驗輸入仍然採用MNIST圖像使用10個feature map時,卷積和pooling的結果分別如下所示。
部分源碼如下:
[python]view plain
#coding=utf-8
'''''
Createdon2014年11月30日
@author:Wangliaofan
'''
importnumpy
importstruct
importmatplotlib.pyplotasplt
importmath
importrandom
import
#test
defsigmoid(inX):
if1.0+numpy.exp(-inX)==0.0:
return999999999.999999999
return1.0/(1.0+numpy.exp(-inX))
defdifsigmoid(inX):
returnsigmoid(inX)*(1.0-sigmoid(inX))
deftangenth(inX):
return(1.0*math.exp(inX)-1.0*math.exp(-inX))/(1.0*math.exp(inX)+1.0*math.exp(-inX))
defcnn_conv(in_image,filter_map,B,type_func='sigmoid'):
#in_image[num,featuremap,row,col]=>in_image[Irow,Icol]
#featuresmap[kfilter,row,col]
#type_func['sigmoid','tangenth']
#out_feature[kfilter,Irow-row+1,Icol-col+1]
shape_image=numpy.shape(in_image)#[row,col]
#print"shape_image",shape_image
shape_filter=numpy.shape(filter_map)#[kfilter,row,col]
ifshape_filter[1]>shape_image[0]orshape_filter[2]>shape_image[1]:
raiseException
shape_out=(shape_filter[0],shape_image[0]-shape_filter[1]+1,shape_image[1]-shape_filter[2]+1)
out_feature=numpy.zeros(shape_out)
k,m,n=numpy.shape(out_feature)
fork_idxinrange(0,k):
#rotate180tocalculateconv
c_filter=numpy.rot90(filter_map[k_idx,:,:],2)
forr_idxinrange(0,m):
forc_idxinrange(0,n):
#conv_temp=numpy.zeros((shape_filter[1],shape_filter[2]))
conv_temp=numpy.dot(in_image[r_idx:r_idx+shape_filter[1],c_idx:c_idx+shape_filter[2]],c_filter)
sum_temp=numpy.sum(conv_temp)
iftype_func=='sigmoid':
out_feature[k_idx,r_idx,c_idx]=sigmoid(sum_temp+B[k_idx])
eliftype_func=='tangenth':
out_feature[k_idx,r_idx,c_idx]=tangenth(sum_temp+B[k_idx])
else:
raiseException
returnout_feature
defcnn_maxpooling(out_feature,pooling_size=2,type_pooling="max"):
k,row,col=numpy.shape(out_feature)
max_index_Matirx=numpy.zeros((k,row,col))
out_row=int(numpy.floor(row/pooling_size))
out_col=int(numpy.floor(col/pooling_size))
out_pooling=numpy.zeros((k,out_row,out_col))
fork_idxinrange(0,k):
forr_idxinrange(0,out_row):
forc_idxinrange(0,out_col):
temp_matrix=out_feature[k_idx,pooling_size*r_idx:pooling_size*r_idx+pooling_size,pooling_size*c_idx:pooling_size*c_idx+pooling_size]
out_pooling[k_idx,r_idx,c_idx]=numpy.amax(temp_matrix)
max_index=numpy.argmax(temp_matrix)
#printmax_index
#printmax_index/pooling_size,max_index%pooling_size
max_index_Matirx[k_idx,pooling_size*r_idx+max_index/pooling_size,pooling_size*c_idx+max_index%pooling_size]=1
returnout_pooling,max_index_Matirx
defpoolwithfunc(in_pooling,W,B,type_func='sigmoid'):
k,row,col=numpy.shape(in_pooling)
out_pooling=numpy.zeros((k,row,col))
fork_idxinrange(0,k):
forr_idxinrange(0,row):
forc_idxinrange(0,col):
out_pooling[k_idx,r_idx,c_idx]=sigmoid(W[k_idx]*in_pooling[k_idx,r_idx,c_idx]+B[k_idx])
returnout_pooling
#out_featureistheoutputofconv
defbackErrorfromPoolToConv(theta,max_index_Matirx,out_feature,pooling_size=2):
k1,row,col=numpy.shape(out_feature)
error_conv=numpy.zeros((k1,row,col))
k2,theta_row,theta_col=numpy.shape(theta)
ifk1!=k2:
raiseException
foridx_kinrange(0,k1):
foridx_rowinrange(0,row):
foridx_colinrange(0,col):
error_conv[idx_k,idx_row,idx_col]=
max_index_Matirx[idx_k,idx_row,idx_col]*
float(theta[idx_k,idx_row/pooling_size,idx_col/pooling_size])*
difsigmoid(out_feature[idx_k,idx_row,idx_col])
returnerror_conv
defbackErrorfromConvToInput(theta,inputImage):
k1,row,col=numpy.shape(theta)
#print"theta",k1,row,col
i_row,i_col=numpy.shape(inputImage)
ifrow>i_roworcol>i_col:
raiseException
filter_row=i_row-row+1
filter_col=i_col-col+1
detaW=numpy.zeros((k1,filter_row,filter_col))
#thesamewithconvvalidinmatlab
fork_idxinrange(0,k1):
foridx_rowinrange(0,filter_row):
foridx_colinrange(0,filter_col):
subInputMatrix=inputImage[idx_row:idx_row+row,idx_col:idx_col+col]
#print"subInputMatrix",numpy.shape(subInputMatrix)
#rotatetheta180
#printnumpy.shape(theta)
theta_rotate=numpy.rot90(theta[k_idx,:,:],2)
#print"theta_rotate",theta_rotate
dotMatrix=numpy.dot(subInputMatrix,theta_rotate)
detaW[k_idx,idx_row,idx_col]=numpy.sum(dotMatrix)
detaB=numpy.zeros((k1,1))
fork_idxinrange(0,k1):
detaB[k_idx]=numpy.sum(theta[k_idx,:,:])
returndetaW,detaB
defloadMNISTimage(absFilePathandName,datanum=60000):
images=open(absFilePathandName,'rb')
buf=images.read()
index=0
magic,numImages,numRows,numColumns=struct.unpack_from('>IIII',buf,index)
printmagic,numImages,numRows,numColumns
index+=struct.calcsize('>IIII')
ifmagic!=2051:
raiseException
datasize=int(784*datanum)
datablock=">"+str(datasize)+"B"
#nextmatrix=struct.unpack_from('>47040000B',buf,index)
nextmatrix=struct.unpack_from(datablock,buf,index)
nextmatrix=numpy.array(nextmatrix)/255.0
#nextmatrix=nextmatrix.reshape(numImages,numRows,numColumns)
#nextmatrix=nextmatrix.reshape(datanum,1,numRows*numColumns)
nextmatrix=nextmatrix.reshape(datanum,1,numRows,numColumns)
returnnextmatrix,numImages
defloadMNISTlabels(absFilePathandName,datanum=60000):
labels=open(absFilePathandName,'rb')
buf=labels.read()
index=0
magic,numLabels=struct.unpack_from('>II',buf,index)
printmagic,numLabels
index+=struct.calcsize('>II')
ifmagic!=2049:
raiseException
datablock=">"+str(datanum)+"B"
#nextmatrix=struct.unpack_from('>60000B',buf,index)
nextmatrix=struct.unpack_from(datablock,buf,index)
nextmatrix=numpy.array(nextmatrix)
returnnextmatrix,numLabels
defsimpleCNN(numofFilter,filter_size,pooling_size=2,maxIter=1000,imageNum=500):
decayRate=0.01
MNISTimage,num1=loadMNISTimage("F:\train-images-idx3-ubyte",imageNum)
printnum1
row,col=numpy.shape(MNISTimage[0,0,:,:])
out_Di=numofFilter*((row-filter_size+1)/pooling_size)*((col-filter_size+1)/pooling_size)
MLP=BMNN2.MuiltilayerANN(1,[128],out_Di,10,maxIter)
MLP.setTrainDataNum(imageNum)
MLP.loadtrainlabel("F:\train-labels-idx1-ubyte")
MLP.initialweights()
#MLP.printWeightMatrix()
rng=numpy.random.RandomState(23455)
W_shp=(numofFilter,filter_size,filter_size)
W_bound=numpy.sqrt(numofFilter*filter_size*filter_size)
W_k=rng.uniform(low=-1.0/W_bound,high=1.0/W_bound,size=W_shp)
B_shp=(numofFilter,)
B=numpy.asarray(rng.uniform(low=-.5,high=.5,size=B_shp))
cIter=0
whilecIter<maxIter:
cIter+=1
ImageNum=random.randint(0,imageNum-1)
conv_out_map=cnn_conv(MNISTimage[ImageNum,0,:,:],W_k,B,"sigmoid")
out_pooling,max_index_Matrix=cnn_maxpooling(conv_out_map,2,"max")
pool_shape=numpy.shape(out_pooling)
MLP_input=out_pooling.reshape(1,1,out_Di)
#printnumpy.shape(MLP_input)
DetaW,DetaB,temperror=MLP.backwardPropogation(MLP_input,ImageNum)
ifcIter%50==0:
printcIter,"Temperror:",temperror
#printnumpy.shape(MLP.Theta[MLP.Nl-2])
#printnumpy.shape(MLP.Ztemp[0])
#printnumpy.shape(MLP.weightMatrix[0])
theta_pool=MLP.Theta[MLP.Nl-2]*MLP.weightMatrix[0].transpose()
#printnumpy.shape(theta_pool)
#print"theta_pool",theta_pool
temp=numpy.zeros((1,1,out_Di))
temp[0,:,:]=theta_pool
back_theta_pool=temp.reshape(pool_shape)
#print"back_theta_pool",numpy.shape(back_theta_pool)
#print"back_theta_pool",back_theta_pool
error_conv=backErrorfromPoolToConv(back_theta_pool,max_index_Matrix,conv_out_map,2)
#print"error_conv",numpy.shape(error_conv)
#printerror_conv
conv_DetaW,conv_DetaB=backErrorfromConvToInput(error_conv,MNISTimage[ImageNum,0,:,:])
#print"W_k",W_k
#print"conv_DetaW",conv_DetaW