natanielruiz
2017-09-14 ec99c6649af6bdbd3c836f20cdc81170e7045cc8
Training hopenet and normal for different alpha values on AFLW
4个文件已删除
3 文件已重命名
3个文件已修改
840 ■■■■■ 已修改文件
code/batch_testing/batch_testing_AFLW_preangles.py 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
code/old/test_old.py 补丁 | 查看 | 原始文档 | blame | 历史
code/old/test_shape.py 补丁 | 查看 | 原始文档 | blame | 历史
code/old/train_shape.py 补丁 | 查看 | 原始文档 | blame | 历史
code/test_preangles.py 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
code/train.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
code/train_AFLW.py 197 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
code/train_AFLW_preangles.py 265 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
code/train_biwi.py 205 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
code/train_preangles.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
code/batch_testing/batch_testing_AFLW_preangles.py
File was deleted
code/old/test_old.py
code/old/test_shape.py
code/old/train_shape.py
code/test_preangles.py
@@ -60,9 +60,6 @@
    print 'Loading data.'
    # transformations = transforms.Compose([transforms.Scale(224),
    # transforms.RandomCrop(224), transforms.ToTensor()])
    transformations = transforms.Compose([transforms.Scale(224),
    transforms.CenterCrop(224), transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])])
@@ -90,10 +87,6 @@
    # Test the Model
    model.eval()  # Change model to 'eval' mode (BN uses moving mean/var).
    total = 0
    n_margins = 20
    yaw_correct = np.zeros(n_margins)
    pitch_correct = np.zeros(n_margins)
    roll_correct = np.zeros(n_margins)
    idx_tensor = [idx for idx in xrange(66)]
    idx_tensor = torch.FloatTensor(idx_tensor).cuda(gpu)
@@ -132,29 +125,14 @@
        pitch_error += torch.sum(torch.abs(pitch_predicted - label_pitch) * 3)
        roll_error += torch.sum(torch.abs(roll_predicted - label_roll) * 3)
        # Binned Accuracy
        # for er in xrange(n_margins):
        #     yaw_bpred[er] += (label_yaw[0] in range(yaw_bpred[0,0] - er, yaw_bpred[0,0] + er + 1))
        #     pitch_bpred[er] += (label_pitch[0] in range(pitch_bpred[0,0] - er, pitch_bpred[0,0] + er + 1))
        #     roll_bpred[er] += (label_roll[0] in range(roll_bpred[0,0] - er, roll_bpred[0,0] + er + 1))
        # print label_yaw[0], yaw_bpred[0,0]
        # Save images with pose cube.
        # TODO: fix for larger batch size
        if args.save_viz:
            name = name[0]
            cv2_img = cv2.imread(os.path.join(args.data_dir, name + '.jpg'))
            #print os.path.join('output/images', name + '.jpg')
            #print label_yaw[0] * 3 - 99, label_pitch[0] * 3 - 99, label_roll[0] * 3 - 99
            #print yaw_predicted * 3 - 99, pitch_predicted * 3 - 99, roll_predicted * 3 - 99
            utils.plot_pose_cube(cv2_img, yaw_predicted[0] * 3 - 99, pitch_predicted[0] * 3 - 99, roll_predicted[0] * 3 - 99)
            cv2.imwrite(os.path.join('output/images', name + '.jpg'), cv2_img)
    print('Test error in degrees of the model on the ' + str(total) +
    ' test images. Yaw: %.4f, Pitch: %.4f, Roll: %.4f' % (yaw_error / total,
    pitch_error / total, roll_error / total))
    # Binned accuracy
    # for idx in xrange(len(yaw_correct)):
    #     print yaw_correct[idx] / total, pitch_correct[idx] / total, roll_correct[idx] / total
code/train.py
@@ -251,7 +251,7 @@
            loss_pitch += alpha * loss_reg_pitch
            loss_roll += alpha * loss_reg_roll
            loss_yaw *= 0.35
            loss_yaw *= 1
            # Finetuning loss
            loss_seq = [loss_yaw, loss_pitch, loss_roll]
code/train_AFLW.py
File was deleted
code/train_AFLW_preangles.py
File was deleted
code/train_biwi.py
File was deleted
code/train_preangles.py
@@ -197,7 +197,7 @@
            loss_pitch += alpha * loss_reg_pitch
            loss_roll += alpha * loss_reg_roll
            loss_yaw *= 0.35
            loss_yaw *= 1
            loss_seq = [loss_yaw, loss_pitch, loss_roll]
            # loss_seq = [loss_reg_yaw, loss_reg_pitch, loss_reg_roll]