Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dotconv( imdesc,fdesc ) :
- assert imdesc.ndim == 3 and fdesc.ndim == 3
- iw,ih,id = imdesc.shape
- fw,fh,fd = fdesc.shape
- assert id == fd
- assert fw < iw and fh < ih
- ow,oh = iw-fw+1,ih-fh+1
- output = numpy.zeros( [ow,oh] )
- for x in xrange(ow) :
- for y in xrange(oh) :
- window = imdesc[x:x+fw,y:y+fh,:]
- output[x,y] = dot_product( window.flatten(),fdesc.flatten() )
- return output
Advertisement
Add Comment
Please, Sign In to add comment