Giter VIP home page Giter VIP logo

Comments (6)

seathiefwang avatar seathiefwang commented on July 22, 2024 1

问题1
我的失误,造成了误解,可以看一下两个函数的内容,其实是没有区别的。
问题2
# 将图片数据与标签转换成数组
imgs = np.array(imgs)
labs = np.array([[0,1] if lab == my_faces_path else [1,0] for lab in labs])
前面已经将标签变成[0, 1]格式,所以res[0]取值就是0或1了。

from facerecognition-tensorflow.

XuBino avatar XuBino commented on July 22, 2024

imgs = np.array(imgs)
labs = np.array([[0,1] if lab == my_faces_path else [1,0] for lab in labs])
前面已经将标签变成[0, 1]格式,所以res[0]取值就是0或1了。
对,就是这块有点看不懂。这里把自己人脸的标签变成[0,1],其他人的变成[1,0],这里的标签是数组吧?那不应该是res[0]==0下标为0的元素==0的时候才是True 吗?求耐心指导,非常感谢,谢谢你!

from facerecognition-tensorflow.

seathiefwang avatar seathiefwang commented on July 22, 2024

predict = tf.argmax(output, 1)
这一行代码,tf.argmax返回的是索引位置,你去看一下这个函数具体用法。

from facerecognition-tensorflow.

XuBino avatar XuBino commented on July 22, 2024

嗯,这个函数我知道了,按行比较返回最大值的索引
前面是labs = np.array([[0,1] if lab == my_faces_path else [1,0] for lab in labs])
这里
predict = tf.argmax(output, 1)
res = sess.run(predict, feed_dict={x: [image/255.0], keep_prob_5:1.0, keep_prob_75: 1.0})
if res[0] == 1:
return True
else:
return False
然后res[0]==0或者1 所以不应该是==0的时候才true吗?我怎么感觉写反了?而且我刚录了5000张人脸,然后识别结果全是false,改成res[0]==0 正确了。我一会儿得回宿舍了,可能就上不了这个网站了。方便加个联系方式我好向你请教一下吗?非常感谢!!!

from facerecognition-tensorflow.

seathiefwang avatar seathiefwang commented on July 22, 2024

predict = tf.argmax(output, 1)
这一句代码 output的shape(None, 2), 存放了形如这样的数据:[[1,0], [0,1], [0,1], [1,0]]
经过 tf.argmax之后,得到 predict = [0, 1, 1, 0],
之后res[0] ==0实际就是表示[1, 0]了。

from facerecognition-tensorflow.

XuBino avatar XuBino commented on July 22, 2024

这块终于懂了,后期若还有啥不懂的还会继续来提问,望老哥你可以耐心指导一下,谢谢你啦

from facerecognition-tensorflow.

Related Issues (20)

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.