from sys import argv
from glob import glob
from os.path import join, split, splitext, isdir
from shutil import move
for archname in glob(join(argv[1], '*.zip')):
splited = split(archname)
pathname, dirname, filename = splited[0], splitext(splited[-1])[0], splited[-1]
if isdir(join(pathname, dirname)):
move(arch, join(pathname, dirname, filename))
print "File %s moved in %s/%s/%s" % (archname, pathname, dirname, filename)
r = range(ker_size)
R = map(lambda i: map(lambda j: (i,j), r), r)
C = range(chs)
for x, y in map(lambda x: map(lambda y: (x,y), im_size[1]), range(im_size[0])):
#loop over channels
for c in C:
acc = 0
#loop over kernel
a, b = y - ctr, x - ctr
for i,j in R:
n, m = a + j, b + i
if 0 <= m < im_size[0] and 0 <= n < im_size[1]:
acc += data[m][n][c] * kernel[i][j]
out_data[x][y][c] = acc