Beispiel #1
0
 def generator_val():
     while True:
         for it in range(0, len(val_data_names), batch_size):
             val_data_X, val_data_Y = load_images(
                 val_data_names[it:it + batch_size],
                 division=8,
                 crop=b_crop,
                 rescale=b_rescale,
                 scale=b_scale,
                 b_debug=b_debug,
                 normcv2=b_normcv2,
                 rows=rows,
                 fulldepth=fulldepth,
                 cols=cols,
                 removeBackground=removeBackground,
                 equalize=equalize)
             yield val_data_X, val_data_Y
Beispiel #2
0
 def generator():
     random.shuffle(train_data_names)
     while True:
         for it in range(0, len(train_data_names), batch_size):
             X, Y = load_images(train_data_names[it:it + batch_size],
                                division=8,
                                b_debug=b_debug,
                                crop=b_crop,
                                rescale=b_rescale,
                                scale=b_scale,
                                normcv2=b_normcv2,
                                fulldepth=fulldepth,
                                rows=rows,
                                cols=cols,
                                removeBackground=removeBackground,
                                equalize=equalize)
             yield X, Y
        seq = test_data_names[image]['image'].split('\\')[-3]
        frame = 0
        if checkBadFrame(seq, frame):
            print 'skipped', seq, frame
            continue
        if test_data_names[image]['face'] == 0:
            print 'SKIP NO GT', seq, frame
            continue
        t = time.time()

        test_data_X, _ = load_images(test_data_names[image:image + 1],
                                     crop=b_crop,
                                     rescale=b_rescale,
                                     scale=b_scale,
                                     b_debug=False,
                                     normcv2=b_normcv2,
                                     rows=rows,
                                     fulldepth=False,
                                     cols=cols,
                                     equalize=True,
                                     removeBackground=True,
                                     division=4)

        pred = model.predict(x=test_data_X, batch_size=batch_size, verbose=0)
        for index, i in enumerate(pred):
            gt_head = bool(test_data_names[image + index]['face'])
            if gt_head:
                gt_coord = test_data_names[image + index]['facecord']
            head = False
            img = cv2.imread(test_data_names[image + index]['image'],
                             cv2.IMREAD_ANYDEPTH)
            img = cv2.resize(img, (cols, rows))