Ejemplo n.º 1
0
            pos_data.append(pos_tem)
            feature_data.append(feature_particle)
            patch_data.append(patch_particle)#存放每一帧patch的34*32HOG
                
            count = j-1#有效粒子计数
                
                
            '''
            计算每个有效patch的权重w
            '''
	    
	    res =[]
	    res.append(feature_particle)
	    feature_2=np.array(res)
	    print(feature_2.shape)
	    tem_w=cnc_rnn.predict(feature_2)
	    print tem_w
	    w = 1-((1-tem_w[0][0])**2+(0- tem_w[0][1])**2)**(0.5)
	
		#gc.collect()
	    print i,j
	    print w
		#print (w)
                
            w_data.append(w)#存放每一帧patch的权重w(未归一化)
            wx = pos_tem[0]*w#每一个patch的权重w 乘以 对应patch的x坐标
            wy = pos_tem[1]*w#每一个patch的权重w 乘以 对应patch的y坐标
            wxim.append(wx)#存放当前im的所有patch带权坐标x
            wyim.append(wy)#存放当前im的所有patch带权坐标y
                
            iniw[count] = iniw[count] + w#这里权值向量iniw在无效粒子处权值w为0
Ejemplo n.º 2
0
import hog
import cv2
import numpy as np
import sample

raw = 16
col = 32

img_dir = './balltrain/test.jpg'
image = cv2.imread(img_dir, cv2.IMREAD_GRAYSCALE)
feature = sample.HOG_feature(image)
res = []
res.append(feature)
feature_2 = np.array(res)
print(image.shape)
print(feature_2.shape)
'''
example:
feature_2=[ [image] [image] [image] ]
     
     [image]=[ [+++++]
               [+++++]
               [+++++]
                      ]
feature_2.shape=(1,9,32)
'''
import cnc_rnn
prediction = cnc_rnn.predict(feature_2)
print(prediction)
print(prediction[0][0])
Ejemplo n.º 3
0
                
               
            except:
                print(i)
                print(j)
                pass
    
    #计算当前im期望位置prex prey,归一化权重
    
    data = np.array(feature_data)
    print(data.shape)
    print(i)
    print(len(feature_particle))
    
    try:
        tem_w=cnc_rnn.predict(data)
    except:
        print(data)
        print(data.shape)
        print(type(feature_particle))
        for each_one in data:
            print(type(each_one))
        break
    #break


#for each_one in tem_w:
    #print(each_one)

'''    
    wsum = 0