Giter VIP home page Giter VIP logo

fendouai / facerank Goto Github PK

View Code? Open in Web Editor NEW
855.0 48.0 211.0 1.29 MB

FaceRank - Rank Face by CNN Model based on TensorFlow (add keras version). FaceRank-人脸打分基于 TensorFlow (新增 Keras 版本) 的 CNN 模型(QQ群:167122861)。技术支持:http://tensorflow123.com

Home Page: http://panchuang.net/

License: GNU General Public License v3.0

Python 100.00%
tensorflow face-recognition keras machine-learning deep-learning convolutional-neural-networks cnn-model dataset

facerank's Introduction

Face Rank - Rank Face by CNN Model based on TensorFlow

Keras Version

https://github.com/fendouai/FaceRank/tree/master/FaceRank_with_keras

RankFace

A deep learning based model to judge the AQ, Appearance Quotient, of faces. (For Chinese Young Girls Only) https://github.com/Entropy-xcy/RankFace

中文说明(QQ群:522785813)

项目总体说明:https://github.com/fendouai/FaceRank/blob/master/cn_readme.md

运行详细说明:https://github.com/fendouai/FaceRank/blob/master/toturial.md

Gitee(速度更快)

项目总体说明:https://gitee.com/fendouai/FaceRank/blob/master/cn_readme.md

运行详细说明:https://gitee.com/fendouai/FaceRank/blob/master/toturial.md

Result Pic

Result Pic

Privacy

Because of privacy,the training images dataset is not provided. maybe some carton images will be given later.

Dataset

  • 130 pictures with size 128*128 from web with tag image: 1-3.jpg means rank 1,3st train pic you can add your own pics to the resize_images folder

Model

Model is CNN based on TensorFlow based on : https://github.com/aymericdamien/TensorFlow-Examples/

Run

After you installed TensorFlow ,just run train_model.py.

  • train the model
  • save the model to model dir

Test

After you run the train_model.py ,just run the run_model.py to test.

Download

The model is trained can be download at http://www.tensorflownews.com/

WechatGroup

If it is out of time,you can go to http://www.tensorflownews.com/ ,I will update the wechat group qcode here.

Thanks

@HadXu develop the keras version https://github.com/fendouai/FaceRank/tree/master/FaceRank_with_keras

facerank's People

Contributors

fendouai avatar hadxu 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  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

facerank's Issues

ValueError: Cannot feed value of shape (0,) for Tensor 'Placeholder:0', which has shape '(?, 128, 128, 3)'

/usr/bin/python3.5 /home/jacli/FaceRank/run_model.py
(?, 128, 128, 24)
(?, 64, 64, 24)
(?, 64, 64, 96)
(?, 32, 32, 96)
WARNING:tensorflow:From /home/jacli/FaceRank/run_model.py:107: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version.
Instructions for updating:

Future major versions of TensorFlow will allow gradients to flow
into the labels input on backprop by default.

See tf.nn.softmax_cross_entropy_with_logits_v2.

[]
0
(0,)
Traceback (most recent call last):
File "/home/jacli/FaceRank/run_model.py", line 147, in
pred_result_test=sess.run(pred_result, feed_dict={x: batch_xs,keep_prob: 1.})
File "/home/jacli/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/home/jacli/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1128, in _run
str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (0,) for Tensor 'Placeholder:0', which has shape '(?, 128, 128, 3)'

Process finished with exit code 1

resize_image的里的图片应该放什么资源,里面资料url里面没有,model放好了,报错了

E:\ProgramData\Anaconda3\python.exe D:/360c/FaceRank-master/train_model.py
(?, 128, 128, 24)
(?, 64, 64, 24)
(?, 64, 64, 96)
(?, 32, 32, 96)
2017-09-08 10:54:08.382260: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-09-08 10:54:08.382260: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
['2', '3', '4']
3
count: 1
<class 'str'>

--sco---
Traceback (most recent call last):
File "D:/360c/FaceRank-master/train_model.py", line 148, in
batch_y[int(score) - 1] = 1
ValueError: invalid literal for int() with base 10: ''

Process finished with exit code 1

运行FaceRank-master/run_model.py的方法,报错了,model的文件从百度下载放进去了

E:\ProgramData\Anaconda3\python.exe D:/360c/FaceRank-master/run_model.py
(?, 128, 128, 24)
(?, 64, 64, 24)
(?, 64, 64, 96)
(?, 32, 32, 96)
2017-09-08 10:56:33.912298: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-09-08 10:56:33.912298: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
File "D:/360c/FaceRank-master/run_model.py", line 144, in
pred_result_test=sess.run(pred_result, feed_dict={x: batch_xs,keep_prob: 1.})
[]
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 895, in run
0
run_metadata_ptr)
(0,)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1100, in _run
% (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (0,) for Tensor 'Placeholder:0', which has shape '(?, 128, 128, 3)'

Process finished with exit code 1

关于数据集

哈喽,大佬好。
请教下数据集的标签是怎么来的,据我所知华工给的数据是很多人的评分,15,也不是110啊,怎么转成1~10的啊?
多谢

"OSError: [Errno 12] Cannot allocate memory" when load image with fit_generator

OSError: [Errno 12] Cannot allocate memory.

27 def train_data_generator():
28 image_data_list = []
29 label = []
30 progress = 0
31 pos_file_list = os.listdir(pos_image_path)
32 neg_file_list = os.listdir(neg_image_path)
33 while True:
34 for i in range(sample_num):
35 url = os.path.join(pos_image_path +'/' + pos_file_list[i])
36 image = load_img(url, target_size=(128, 128))
37 image_data_list.append(img_to_array(image))
38 label.append(1)
39 image.close()
40 progress = progress + 1
41 url = os.path.join(neg_image_path + '/' + neg_file_list[i])
42 image = load_img(url, target_size=(128, 128))
43 image_data_list.append(img_to_array(image))
44 label.append(0)
45 image.close()
46 progress = progress + 1
47 if progress == fit_gen_batch_size:
48 img_data = np.array(image_data_list)
49 img_data = img_data.astype('float32')
50 img_data /= 255
51 #print("generator image_data=",len(img_data),"label=",len(label))
52 yield img_data, label
53 label.clear()
54 img_data[:]=0
55 image_data_list.clear()
56 progress = 0
57 gc.collect()

model放好了 run_model 出现这个错误 把run_mode.pyl里的batch_size值改小 还是报这个错

2018-03-13 15:20:04.122000: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\3
6\tensorflow\core\common_runtime\bfc_allocator.cc:680] Stats:
Limit: 1631711232
InUse: 1229069056
MaxInUse: 1631711232
NumAllocs: 51
MaxAllocSize: 422898176

2018-03-13 15:20:04.122000: W C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\3
6\tensorflow\core\common_runtime\bfc_allocator.cc:279] _______________________
**************************************************************************x
2018-03-13 15:20:04.123000: W C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\3
6\tensorflow\core\framework\op_kernel.cc:1202] OP_REQUIRES failed at assign_op.h
:111 : Resource exhausted: OOM when allocating tensor with shape[98304,1024] and
type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_b
fc
Traceback (most recent call last):
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\clie
nt\session.py", line 1361, in _do_call
return fn(*args)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\clie
nt\session.py", line 1340, in _run_fn
target_list, status, run_metadata)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\fram
ework\errors_impl.py", line 516, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocat
ing tensor with shape[98304,1024] and type float on /job:localhost/replica:0/tas
k:0/device:GPU:0 by allocator GPU_0_bfc
[[Node: save/Assign_7 = Assign[T=DT_FLOAT, _class=["loc:@Variable_2"],
use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/
device:GPU:0"](Variable_2/Adam, save/RestoreV2/_23)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add repor
t_tensor_allocations_upon_oom to RunOptions for current allocation info.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "run_model.py", line 117, in
saver.restore(sess, "./model/model.ckpt")
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\trai
ning\saver.py", line 1755, in restore
{self.saver_def.filename_tensor_name: save_path})
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\clie
nt\session.py", line 905, in run
run_metadata_ptr)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\clie
nt\session.py", line 1137, in _run
feed_dict_tensor, options, run_metadata)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\clie
nt\session.py", line 1355, in _do_run
options, run_metadata)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\clie
nt\session.py", line 1374, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocat
ing tensor with shape[98304,1024] and type float on /job:localhost/replica:0/tas
k:0/device:GPU:0 by allocator GPU_0_bfc
[[Node: save/Assign_7 = Assign[T=DT_FLOAT, _class=["loc:@Variable_2"],
use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/
device:GPU:0"](Variable_2/Adam, save/RestoreV2/_23)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add repor
t_tensor_allocations_upon_oom to RunOptions for current allocation info.

Caused by op 'save/Assign_7', defined at:
File "run_model.py", line 113, in
saver=tf.train.Saver()
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\trai
ning\saver.py", line 1293, in init
self.build()
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\trai
ning\saver.py", line 1302, in build
self._build(self._filename, build_save=True, build_restore=True)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\trai
ning\saver.py", line 1339, in _build
build_save=build_save, build_restore=build_restore)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\trai
ning\saver.py", line 796, in _build_internal
restore_sequentially, reshape)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\trai
ning\saver.py", line 471, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\trai
ning\saver.py", line 161, in restore
self.op.get_shape().is_fully_defined())
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\ops
state_ops.py", line 280, in assign
validate_shape=validate_shape)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\ops
gen_state_ops.py", line 61, in assign
use_locking=use_locking, name=name)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\fram
ework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\fram
ework\ops.py", line 3271, in create_op
op_def=op_def)
File "D:\Program Files (x86)\anaconda\lib\site-packages\tensorflow\python\fram
ework\ops.py", line 1650, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-
access

ResourceExhaustedError (see above for traceback): OOM when allocating tensor wit
h shape[98304,1024] and type float on /job:localhost/replica:0/task:0/device:GPU
:0 by allocator GPU_0_bfc
[[Node: save/Assign_7 = Assign[T=DT_FLOAT, _class=["loc:@Variable_2"],
use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/
device:GPU:0"](Variable_2/Adam, save/RestoreV2/_23)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add repor
t_tensor_allocations_upon_oom to RunOptions for current allocation info.

模型过拟合?

我用的是华工实验室的数据,另外自己加入了100张平分为4、5的图像,可是无论什么照片进去,出来的结果评分都是2分(满分5分),所以是不是模型欠拟合的问题?

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.