Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about trainging problem #37

Open
xiaomingdaren123 opened this issue Jul 31, 2018 · 7 comments
Open

about trainging problem #37

xiaomingdaren123 opened this issue Jul 31, 2018 · 7 comments

Comments

@xiaomingdaren123
Copy link

hi,MarekKowalski,I used the code you provided to train the model. When I tested the image, it didn't respond. Using your model (DAN.npz) also meet same problem,but No problem with other images。I don't know what is going on.
966207052

2、load your network (DAN.npz),the validation error is 0.0177,the train error is 0.035395,When I train this network,the validation error is 0.04789,the train error is 0.0433754, If I continue training the network ,can I achieve the same result as you?How many epochs did you train(approximately)?Can these two stages train at the same time?

I hope you can help me ,thank you very much!

@MarekKowalski
Copy link
Owner

Hi,

You probably do not get any response because the face detection method does not detect the face.
Keep in mind that DAN performs only facial landmark localization not face detection. In the example code face detection is performed using OpenCV's face detection functionality. If you want to get landmarks for this image you may specify the face rectangle by yourself or use a better face detector.

As for the training results: in order to get the best results you should train the first stage separately and then the second stage. Also: do not train the first stage till it overfits, stop training when the error stops improving frequently (say, you don't get a new, better result in the last 20 minutes).

Thanks,

Marek

@xiaomingdaren123
Copy link
Author

hello,friend.
1、the file of meanFaceShape.npz,Is it the average of all landmarks in the dataset?
2、initialization == 'rect'、‘'similarity' 、'box' , What is the difference between them?

@MarekKowalski
Copy link
Owner

Hi,

  1. It is an average of all the face shapes (landmark sets per face) that were aligned together. Method described in Appendix A, here http://www2.compute.dtu.dk/courses/02511/docs/asm_overview.pdf
  2. Those are different ways of creating the initial shapes in the training set (this happens before data augmentation):
  • Similarity aligns the initial mean shape with the ground truth so that the SSE is minimized
  • Rect places the initial mean shape in a rectangle that bounds the ground truth landmarks
  • Box uses the same method as Rect but the rectangles are loaded from a file

Thanks,

Marek

@xiaomingdaren123
Copy link
Author

Thank you for your earnest answer to every question.thank you very much.
If I wantto get meanFaceShape.npz with my own data set.According to your reply .First of all,I should align all faces of the training set.Then, calculate the average of aligned face landmarks?Could you provide the code to generate meanFaceShape.npz?
This meanFaceShape.npz seems to have only been used during the data augmentation phase.If I don't do data augmentation, can I not use this file?
thank you ,friend.

@MarekKowalski
Copy link
Owner

The mean shape is also used as the initial shape for face alignment, so you will still need it. I do not have access to the code at the moment (it was on an old university computer). It should however be quite simple to implement. Look at the paper I linked to in my previous post.

@xyhuo001
Copy link

Hi, MareKowalski.I used the code you provided to train the model. when I run the DAN._V2.py,there were some problems,I try to solve the problem,unfortunately ,I didnit make it.I hope you could give me some suggestions. The problems as follows:
Traceback(most recent call last):
File"./DAN_V2/dan_model.py" ,line 112, in call
inputs_imgs= tf.reshape(inputs_imgs,[-1,self.img_size,self.img_size,1])
File"./anaconda3/lin/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py",line 3938,in reshape "Reshape",tensor=tensor,shape = shape,name=name)
File"./anaconda3/lin/python3.6/site-packages/tensorflow/python/framework/op_def_library.py",line 513,in_apply_op_helper raise err
File"./anaconda3/lin/python3.6/site-packages/tensorflow/python/framework/op_def_library.py",line 510,in_apply_op_helper preferred_dtype=defalut_dtype)
File"./anaconda3/lin/python3.6/site-packages/tensorflow/python/framework/ops",line 926,in_constant_tensor_to_tensor
ret =conversion_func(value,dtype=dtype,name=name,as_ref=as_ref)
File"./anaconda3/lin/python3.6/site-packages/tensorflow/python/framework/constant_op.py",line 229,in_constant_tensor_conversion_function
return constant(v,dtype=dtype,name=name)
File"./anaconda3/lin/python3.6/site-packages/tensorflow/python/framework/constant_op.py",line 208,in constant value,shape=shape,verify_shape=verity_shape))
File"./anaconda3/lin/python3.6/site-packages/tensorflow/python/framework/tensor_util.py",line 472,in make_tensor_proto
"supported type." % (type(values),values))

TypeError:Failed to convert object of type<class"tensorflow.python.data.ops.dataset_ops.PrefetechDataset"> to Tensor. Contents:<PrefetchDataset shapes:(,),types:(tf.float32,tf.float32)>.Consider casting elements to a supported type.

@MarekKowalski
Copy link
Owner

Hi,

I think this code is not from my repo, please start a thread in the repo it comes from.

Thanks,

Marek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants