Skip to content

Commit

Permalink
Fix typo, refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
cleardusk committed Dec 1, 2018
1 parent d26d749 commit 09d138b
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ models/shape_predictor_68_face_landmarks.dat
.DS_Store

demo_obama/
todo.md

utils/__pycacje__/
2 changes: 1 addition & 1 deletion benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from benchmark_aflw import calc_nme as calc_nme_alfw
from benchmark_aflw import ana as ana_aflw

from ddfa_utils import ToTensorGjz, NormalizeGjz, DDFATestDataset, reconstruct_vertex
from utils.ddfa import ToTensorGjz, NormalizeGjz, DDFATestDataset, reconstruct_vertex
import argparse


Expand Down
2 changes: 1 addition & 1 deletion benchmark_aflw.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
from glob import glob
from math import sqrt
from io_utils import _load
from utils.io import _load

d = 'test.configs'
yaw_list = _load(osp.join(d, 'AFLW_GT_crop_yaws.npy'))
Expand Down
2 changes: 1 addition & 1 deletion benchmark_aflw2000.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os.path as osp
import numpy as np
from math import sqrt
from io_utils import _load
from utils.io import _load

d = 'test.configs'
yaws_list = _load(osp.join(d, 'AFLW2000-3D.pose.npy'))
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import numpy as np
import cv2
import dlib
from ddfa_utils import ToTensorGjz, NormalizeGjz, str2bool
from utils.ddfa import ToTensorGjz, NormalizeGjz, str2bool
import scipy.io as sio
from inference_utils import get_suffix, calc_roi_box, crop_img, predict_68pts, dump_to_ply, dump_vertex, draw_landmarks, \
from utils.inference import get_suffix, calc_roi_box, crop_img, predict_68pts, dump_to_ply, dump_vertex, draw_landmarks, \
predict_dense
import argparse
import torch.backends.cudnn as cudnn
Expand Down
2 changes: 1 addition & 1 deletion params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import os.path as osp
import numpy as np
from io_utils import _load, _numpy_to_cuda, _numpy_to_tensor, _load_gpu
from utils.io import _load, _numpy_to_cuda, _numpy_to_tensor, _load_gpu


def make_abs_path(d):
Expand Down
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ In addition, I strongly recommend using Python3.6+ instead of older version for
```
If you can see these output log in terminal, you run it successfully.
```
Dump tp samples/test1_0.ply
Dump tp samples/test1_0.mat
Dump to samples/test1_0.ply
Dump to samples/test1_0.mat
Save 68 3d landmarks to samples/test1_0.txt
Dump tp samples/test1_1.ply
Dump tp samples/test1_1.mat
Dump to samples/test1_1.ply
Dump to samples/test1_1.mat
Save 68 3d landmarks to samples/test1_1.txt
Save visualization result to samples/test1_3DDFA.jpg
```
Expand Down
6 changes: 3 additions & 3 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import mobilenet_v1
import torch.backends.cudnn as cudnn

from ddfa_utils import DDFADataset, ToTensorGjz, NormalizeGjz
from ddfa_utils import str2bool, AverageMeter
from io_utils import mkdir
from utils.ddfa import DDFADataset, ToTensorGjz, NormalizeGjz
from utils.ddfa import str2bool, AverageMeter
from utils.io import mkdir
from vdc_loss import VDCLoss
from wpdc_loss import WPDCLoss

Expand Down
Empty file added utils/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion ddfa_utils.py → utils/ddfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import cv2
import pickle
import argparse
from io_utils import _numpy_to_tensor, _load_cpu, _load_gpu
from .io import _numpy_to_tensor, _load_cpu, _load_gpu
from params import *


Expand Down
4 changes: 2 additions & 2 deletions inference_utils.py → utils/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from math import sqrt
import scipy.io as sio
import matplotlib.pyplot as plt
from ddfa_utils import reconstruct_vertex
from .ddfa import reconstruct_vertex


def get_suffix(filename):
Expand Down Expand Up @@ -97,7 +97,7 @@ def dump_to_ply(vertex, tri, wfp):

def dump_vertex(vertex, wfp):
sio.savemat(wfp, {'vertex': vertex})
print('Dump tp {}'.format(wfp))
print('Dump to {}'.format(wfp))


def _predict_vertices(param, roi_box, dense):
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion vdc_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import torch
import torch.nn as nn
from io_utils import _load, _numpy_to_cuda, _numpy_to_tensor
from utils.io import _load, _numpy_to_cuda, _numpy_to_tensor
from params import *

_to_tensor = _numpy_to_cuda # gpu
Expand Down
6 changes: 2 additions & 4 deletions visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
# coding: utf-8

from benchmark import extract_param
from ddfa_utils import reconstruct_vertex
from io_utils import _dump, _load
from utils.ddfa import reconstruct_vertex
from utils.io import _dump, _load
import os.path as osp
from skimage import io
import matplotlib.pyplot as plt
from benchmark_aflw2000 import convert_to_ori
from mpl_toolkits.mplot3d import Axes3D
import cv2
import scipy.io as sio


Expand Down
2 changes: 1 addition & 1 deletion wpdc_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
import torch.nn as nn
from math import sqrt
from io_utils import _load, _numpy_to_cuda, _numpy_to_tensor, _load_gpu
from utils.io import _load, _numpy_to_cuda, _numpy_to_tensor, _load_gpu
from params import *

_to_tensor = _numpy_to_cuda # gpu
Expand Down

0 comments on commit 09d138b

Please sign in to comment.