Ejemplo n.º 1
0
                    help='compressing ration %')
parser.add_argument('--path',
                    default='wts/unsupervised_ratio10',
                    help='path to pretrained model')
parser.add_argument('--data', default='BSD68', help='which data to use')
parser.add_argument('--outpath',
                    default=None,
                    help='where to save predictions')
opts = parser.parse_args()

ratio = opts.ratio / 100.0
if opts.path.endswith('.npz'):
    mfile = opts.path
else:
    wts = opts.path
    msave = ut.ckpter(wts + '/iter_*.model.npz')
    mfile = msave.latest

outpath = opts.outpath
if outpath is not None:
    if not os.path.exists(outpath):
        os.makedirs(outpath)

VLIST = 'data/%s.txt' % opts.data

PSZ = 33

# Setup Graphs
is_training = tf.placeholder_with_default(False, shape=[])
model = net.Net(is_training)
Ejemplo n.º 2
0
    elif niter >= drop[0] and niter < drop[1]:
        return LR / np.sqrt(10.)
    else:
        return LR / 10.0
    return LR

VALFREQ = 2e2
SAVEFREQ = 1e4
MAXITER = drop[-1]

if not os.path.exists(wts):
    os.makedirs(wts)
#########################################################################

# Check for saved weights & optimizer states
msave = ut.ckpter(wts + '/iter_*.model.npz')
ssave = ut.ckpter(wts + '/iter_*.state.npz')
ut.logopen(wts+'/train.log')
niter = msave.iter

#########################################################################

# Setup Graphs
is_training = tf.placeholder_with_default(False, shape=[])
model = net.Net(is_training)

# Images loading setup
tset = Dataset(TLIST, KTLIST, BSZ, niter, rand_kernel=False)
vset = Dataset(VLIST, KVLIST, BSZ, 0, isval=True)
batch, swpT, swpV = tvSwap(tset, vset)
imgs, left_kernels, right_kernels, left_ck, right_ck, seeds = batch