guoqiangqi / PFLD

Implementation of PFLD A Practical Facial Landmark Detector , reference to https://arxiv.org/pdf/1902.10859.pdf
626 stars 166 forks source link

多余的sees.run #71

Open sljlp opened 4 years ago

sljlp commented 4 years ago

请问各位,main方法中在构建网络时可以看到,attributes_w_n可以由attribute自动推理出来, 但是在train方法中为什么要多加这一步: attributes_w_n = sess.run(list_ops['attributes_w_n_batch'],feed_dict={list_ops['image_batch']: images,list_ops['attribute_batch']: attributes}) 然后在下面feed_dict中填入: feed_dict = { list_ops['image_batch']: images, list_ops['landmark_batch']: landmarks, list_ops['attribute_batch']: attributes, list_ops['phase_train_placeholder']: True, list_ops['euler_angles_gt_batch'] : eulers, list_ops['attributes_w_n_batch']: attributes_w_n } 之后才去执行其他的,然而在test方法中则没有这一步,请问,加与不加有什么区别?我对tensorflow尚不非常了解,劳烦讲一下,谢谢

luckynote commented 4 years ago

这是为了更大化利用gpu资源。 如果不设置为计算图中操作,这部分操作要在CPU进行,CPU计算速度比较慢,gpu呈现一段时间为0状态,训练时间大大增加。

---原始邮件--- 发件人: "Roc"<notifications@github.com> 发送时间: 2019年12月16日(周一) 下午4:31 收件人: "guoqiangqi/PFLD"<PFLD@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [guoqiangqi/PFLD] 多余的sees.run (#71)

请问各位,main方法中在构建网络时可以看到,attributes_w_n可以由attribute自动推理出来, 但是在train方法中为什么要多加这一步: attributes_w_n = sess.run(list_ops['attributes_w_n_batch'],feed_dict={list_ops['image_batch']: images,list_ops['attribute_batch']: attributes}) 然后在下面feed_dict中填入: feed_dict = { list_ops['image_batch']: images, list_ops['landmark_batch']: landmarks, list_ops['attribute_batch']: attributes, list_ops['phase_train_placeholder']: True, list_ops['euler_angles_gt_batch'] : eulers, list_ops['attributes_w_n_batch']: attributes_w_n } 之后才去执行其他的,然而在test方法中则没有这一步,请问,加与不加有什么区别?我对tensorflow尚不非常了解,劳烦讲一下,谢谢

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

sljlp commented 4 years ago

多谢这么快回复 @luckynote 我的意思是,保留计算图中的设置而不使用run这一步,这样也可以让tensorflow在计算图中自动计算出attribute_w_n,也就是,在: feed_dict = { list_ops['image_batch']: images, list_ops['landmark_batch']: landmarks, list_ops['attribute_batch']: attributes, list_ops['phase_train_placeholder']: True, list_ops['euler_angles_gt_batch'] : eulers, list_ops['attributes_w_n_batch']: attributes_w_n } 中,去掉最后一个输入ist_ops['attributes_w_n_batch']: attributes_w_n,变为: feed_dict = { list_ops['image_batch']: images, list_ops['landmark_batch']: landmarks, list_ops['attribute_batch']: attributes, list_ops['phase_train_placeholder']: True, list_ops['euler_angles_gt_batch'] : eulers, }, 这样在训练代码中可以吗? 我不太明白为什么要多加一步: attributes_w_n = sess.run(list_ops['attributes_w_n_batch'],feed_dict={list_ops['image_batch']: images,list_ops['attribute_batch']: attributes}) ,而且看计算图中,要计算attribute_w_n, 并不需要image_batch