Giter VIP home page Giter VIP logo

zjjmaimai / deep-alignment-network-a-convolutional-neural-network-for-robust-face-alignment Goto Github PK

View Code? Open in Web Editor NEW
220.0 220.0 71.0 175 KB

This is a Tensorflow implementations of paper "Deep Alignment Network: A convolutional neural network for robust face alignment".

Home Page: https://github.com/zjjMaiMai/Deep-Alignment-Network-A-convolutional-neural-network-for-robust-face-alignment

Python 100.00%
convolutional-neural-networks deep-alignment-network tensorflow

deep-alignment-network-a-convolutional-neural-network-for-robust-face-alignment's People

Contributors

zjjmaimai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep-alignment-network-a-convolutional-neural-network-for-robust-face-alignment's Issues

Why no weight decay?

i study the loss of the original implementation and yours, and find no L2 normalization or the so called weight decay, does it possible? i just cannot understand.

Pre-train model

Hi,
Please check the link down your pre-train model
Thanks

在model_dir中找不到trained model

你好:
我下载了文中给出的预训练模型,来测试视频中的效果,但是在给出路径后,一直提示找不到模型,请问大概是哪里出错了呀?

Function of AffineImage

There is something wrong when test on CPU about affineImage function, the error is ( InvalidArgumentError flat indices[12543,:]=[111,112] does not index into param(shape:[112,112])), I locate the error at OutImage = (1-dx)*(1-dy)*tf.gather_nd()...........
Running on the GPU test good, but the CPU occurs above error

Normal face, mean and std are not used for testing?

When mode is set to predict, mean_shape, imgs_mean and imgs_std are set to None. So I think inputs are not normalized and normal face is not used when building the network.

If I'm correct, why are these variables not used for predicting? Thanks for any idea!

loss问题

貌似您在loss部分没有使用一般的瞳孔间距来归一化,用的是最大landmark减最小的landmark,这对实验结果有影响吗?另外您在repo过程中的矩阵变换部分参考的资料,是否可以共享一下,万分感谢!

how to predict without face detection

I'm kind of confused in the testing stage. The paper declares the DAN can still obtain good results without face detections but I cannot find implementation details about this step. I tried to use a fixed small bbox in the center of picture to initialize the mean shape while this method failed. Anybody could give me suggestions? Thanks a lot.

minor file

Would you please offer the minor file? This link I can't download successfully. Thanks a lot.

Is there pre-trained model?

Could you please put the pre-trained model to this project ? or do you know how to use the pre-trained model in the origin theano project

Can't run pre-train model.

I have downloaded the pre-train model on https://pan.baidu.com/s/1o83h4H8.But when I use the model,it says "Key global_step not found in checkpoint". I guess you used different network parameter names for training. How can I modify it? The result of my training is not good,the landmarks are not in position.Could you please tall me if your landmarks result on picture are accurate?
Very grateful, wish you a happy life.

Mirror landmarks link

Could you please kindly provide the Mirror landmarks file again?
The link seems broken.

pre-train model link

Thank you for your sharing code.
The Pre-trained code link is boken. could you please tell me a avaliable link? Thanks.

about speed

you say: Speed : 4ms per Image on GTX 1080 Ti
I test my forward in windows with tensorflow1.2 , time about 46ms
Do you know whether the difference is caused by tensorflow1.7?

Face Normalization

I can not see any explanation about Face Normalization. It this project can normalize the faces? Could you provide some details please?

The Inference Speed

The paper says the inference speed of the model is 45 fps.
What about your model?
I found the pre-trained model is 279M which is very big.

关于数据处理

你好,我按照preprocessing.py 保存下来的数据,点画在图像上对不住,有一点偏差,,,计算过程好像没问题,难道是计算仿射变换矩阵的精度太低了吗?

error in Eval model Acc

When I run the last step using command1, the error " Dst tensor is not initialized" happens. If I using command2 with absolute path, the error "join() argument must be str or bytes, not 'NoneType'"happens,dose anybody knows how to solve it?

command1: python DAN_V2.py -ds 2 --data_dir=./test_images_pre_out/ --data_dir_test=./test_images/ -nlm 68 -mode eval
command2: python DAN_V2.py -ds 2 --data_dir=/home/.../DAN_V2/test_images_pre_out/ -nlm 68 -mode eval

command1 error:
2018-11-22 18:39:34.989433: W tensorflow/core/common_runtime/bfc_allocator.cc:279] **********************************************************************************xxxxxxxxxxx
2018-11-22 18:39:34.989452: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at assig117 : Resource exhausted: OOM when allocating tensor with shape[25088,256] and type float on /job:locaeplica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
Traceback (most recent call last):
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/clieion.py", line 1322, in _do_call
return fn(*args)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/clieion.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/clieion.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InternalError: Dst tensor is not initialized.
[[Node: save/RestoreV2/_555 = _Recvclient_terminated=false, recv_device="/job:localhost/replask:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnatiensor_name="edge_560_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/dPU:0"]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "DAN_V2.py", line 143, in
tf.app.run(argv=sys.argv)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/platp.py", line 125, in run
_sys.exit(main(argv))
File "DAN_V2.py", line 139, in main
dan_run_loop.dan_main(flags,vgg16_model_fn,input_function)
File "/home.../DAN_V2/dan_run_loop.py", line 194, in dan_main
eval_results = estimator.evaluate(input_fn=input_fn_eval,steps=flags.max_train_steps)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/estistimator.py", line 460, in evaluate
output_dir=self.eval_dir(name))
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/estistimator.py", line 1386, in _evaluate_run
config=self._session_config)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/traialuation.py", line 209, in _evaluate_once
session_creator=session_creator, hooks=hooks) as session:
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/trainitored_session.py", line 826, in init
stop_grace_period_secs=stop_grace_period_secs)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/trainitored_session.py", line 549, in init
self._sess = _RecoverableSession(self._coordinated_creator)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/trainitored_session.py", line 1012, in init
_WrappedSession.init(self, self._create_session())
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/trainitored_session.py", line 1017, in _create_session
return self._sess_creator.create_session()
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/trainitored_session.py", line 706, in create_session
self.tf_sess = self._session_creator.create_session()
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/trainitored_session.py", line 477, in create_session
init_fn=self._scaffold.init_fn)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/traission_manager.py", line 281, in prepare_session
config=config)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/traission_manager.py", line 195, in _restore_checkpoint
saver.restore(sess, checkpoint_filename_with_path)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/traiver.py", line 1752, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/clieion.py", line 900, in run
run_metadata_ptr)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/clieion.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/clieion.py", line 1316, in _do_run
run_metadata)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/clieion.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InternalError: Dst tensor is not initialized.
[[Node: save/RestoreV2/_555 = _Recvclient_terminated=false, recv_device="/job:localhost/replask:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnatiensor_name="edge_560_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/dPU:0"]]


command2: python DAN_V2.py -ds 2 --data_dir=/home/.../DAN_V2/test_images_pre_out/ -nlm 68 -mode eval
error2:
INFO:tensorflow:Using config: {'_master': '', '_num_worker_replicas': 1, '_device_fn': None, '_service': None, '_save_checkpoints_secs': 1000000000.0, '_session_config': allow_soft_placement: true
, '_is_chief': True, '_evaluation_master': '', '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x7ff281278048>, '_keep_checkpoint_every_n_hours': 10000, '_global_id_in_cluster': 0, '_num_ps_replicas': 0, '_model_dir': './model_dir', '_keep_checkpoint_max': 5, '_task_type': 'worker', '_tf_random_seed': None, '_log_step_count_steps': 100, '_save_summary_steps': 100, '_save_checkpoints_steps': None, '_train_distribute': None, '_task_id': 0}
Traceback (most recent call last):
File "DAN_V2.py", line 143, in
tf.app.run(argv=sys.argv)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "DAN_V2.py", line 139, in main
dan_run_loop.dan_main(flags,vgg16_model_fn,input_function)
File "/home/.../DAN_V2/dan_run_loop.py", line 194, in dan_main
eval_results = estimator.evaluate(input_fn=input_fn_eval,steps=flags.max_train_steps)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py", line 453, in evaluate
input_fn, hooks, checkpoint_path)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py", line 1346, in _evaluate_build_graph
model_fn_lib.ModeKeys.EVAL))
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py", line 985, in _get_features_and_labels_from_input_fn
result = self._call_input_fn(input_fn, mode)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py", line 1074, in _call_input_fn
return input_fn(**kwargs)
File "/home/.../DAN_V2/dan_run_loop.py", line 186, in input_fn_eval
1, flags.num_parallel_calls, flags.multi_gpu)
File "DAN_V2.py", line 52, in vgg16_input_fn
img_path,pts_path = get_filenames(data_dir)
File "DAN_V2.py", line 37, in get_filenames
p = os.path.join(data_dir, ext)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/posixpath.py", line 89, in join
genericpath._check_arg_types('join', a, *p)
File "/usr/local/public/anaconda2/envs/tf1.4_py35/lib/python3.5/genericpath.py", line 143, in _check_arg_types
(funcname, s.class.name)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

测试的错误率

你的误差率是1.34 %,而我的是1.6%,请问我应该修改什么参数呢,我是按照你的步骤和代码来训练的啊

how to predict one img?

thanks for you sharing.
it seemed that author used to try to predict on video.
can you share the code?
Your help will be greatly appreciated.

Freezing a model

Hi zjjMaiMai,
After I trained a model I have full check point file and graph.pbtxt, but when I want to freeze model, I cannot execute it.
I flow this:
bazel build tensorflow/tools:freeze_graph
bazel-bin/tensorflow/tools/freeze_graph
--input_graph=/tmp/model/graph.pbtxt
--input_checkpoint=/tmp/model/model.ckpt-1000
--output_graph=/tmp/frozen_graph.pb
--output_node_names="Sotfmax"
But it is error:

tensorflow.python.framework.errors_impl.NotFoundError: Op type not registered 'ImageProjectiveTransform' in binary running on diffdeep-server. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) tf.contrib.resampler should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed

Please kindly help me, Thanks!

关于训练文件

MenpoTrain.txt 这些文件是在哪里下载呀 ibug里面吗? 谢谢

transform function

Hi, I cann't understand the transform function in DataSetPre.py
def transform(form,to):
destMean = np.mean(to, axis=0)
srcMean = np.mean(form, axis=0)

srcVec = (form - srcMean).flatten()
destVec = (to - destMean).flatten()
a = np.dot(srcVec, destVec) / np.linalg.norm(srcVec) ** 2
b = 0
for i in range(form.shape[0]):
    b += srcVec[2 * i] * destVec[2 * i + 1] - srcVec[2 * i + 1] * destVec[2 * i] 
b = b / np.linalg.norm(srcVec) ** 2

T = np.array([[a, b], [-b, a]])
srcMean = np.dot(srcMean, T)

return T, destMean - srcMean

which algorithm have you used to transform the original landmark to the meanshape,what's the meaning of a, b and T?

the code does work

i try the model trained by myself, it dose work.The code needn't bbox, but origin code need it,so i think the code is wrong!

About GetMeanShape

In the function GetMeanShape,
halfsize = int((ymean - ymin) * 2.0), I think it's not proper to *2.

Dimensions are not equal

def __gen_heatmap(self,shapes):
shapes = shapes[:,:,tf.newaxis,tf.newaxis,:]
value = self.pixels - shapes
value = tf.norm(value,axis=-1)
value = 1.0 / (tf.reduce_min(value,axis=1) + 1.0)
value = tf.expand_dims(value,axis=-1)
return value

self.pixels 和shapes的维度不一样呀?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.