dpressel / rude-carnie Goto Github PK
View Code? Open in Web Editor NEWAge detection in Tensorflow
Age detection in Tensorflow
Good day! While testing rude-carnie found a problem with gender classification, with age's there is no problems:
InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [2048,8] rhs shape= [2048,2]
[[Node: save/Assign_377 = Assign[T=DT_FLOAT, _class=["loc:@output/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](output/weights, save/RestoreV2_377)]]
I got it when using gender clas. with OpenCV detector. With single image there is no problems.
Is anyone had same error?
///Well, fixed this problem by writing --class_type gender
Is there any trained model for gender predict ? Also the corresponding predict source ?
Hello!
Thanks for your excellent work.
I want to restore a pb model to support for android like this:
output_graph_def = graph_util.convert_variables_to_constants(session, session.graph_def,output_node_names=['output'])
with tf.gfile.FastGFile('model/model.pb', mode='wb') as f:
f.write(output_graph_def.SerializeToString())
Moreover, I have to get the name of input tensor and output like this:
private static final String inputName = "input";
private static final String outputName = "output";
TensorFlowInferenceInterface inferenceInterface;
inferenceInterface.feed(inputName, inputs, WIDTH, HEIGHT);
inferenceInterface.fetch(outputName, outputs);
But I couldn't find the input tensor name, is the line below the place I should modify? I am not sure..
images, labels, _ = distorted_inputs(FLAGS.train_dir, FLAGS.batch_size, FLAGS.image_size, FLAGS.num_preprocess_threads)
Would you please give me some advice? Thank you!
How do I do recognition in a realtime video?
I use not last version your code (without progress bar)
And I see memory leak at session.run()
now in your current version it here
https://github.com/dpressel/rude-carnie/blob/master/guess.py#L77
I make http service, but after new call classify ram memory less than before about 15Mb...
What do you think about?
Firstly, great work. Easy to use; I have been training the network myself on AWS and have got impressive results. I am trying to put together a PoC demo which will run the inference on a video stream. To achieve this, I am looking to use Tensorflow serving. But to serve the model, we must first export it using SavedModelBuilder.
So far I have this: https://gist.github.com/edge0701/dd0550cc46f83b7e0e0fd0c5b23fd392
I think the prediction signature is correct, but I know the classification signature isn't right. As I only want to do inference, I thought that I would only need the prediction signature, but I get an error: grpc.framework.interfaces.face.face.AbortionError: AbortionError(code=StatusCode.FAILED_PRECONDITION, details="Default serving signature key not found.")
I get this error even with my incorrect classification signature (export still runs fine).
I'd really appreciate some help trying to export the model. I have been stuck on this for a number of days now. It would be good to add an export script to the repo to aid others wishing to serve up the model.
@dpressel Thank you for your excellent code. I am new in Tensorflow and I have a question regarding the way you compute precision in eval.py. In eval.py, in line 133, you write:
precision1 = true_count1 / total_sample_count
I don't get why you divide with total_sample_count and not with num_eval, since num_eval corresponds to the number of validation files.
Please excuse my ignorance and thank you for your code and help.
it is not o issue actually it is a request .
I am just wondering that can we do testing on video not single picture ?
I tried it but it seems it is so heavy and die in middle but I am almost sure I am doing something wrong can you plz if you don't mind upload the guess file video version ?
best regards
Greetings!
I just finished 5 folds of your TF version of age&gender prediction code. (thx!)
However, the evaluation result is far lower than expected (at least described at paper).
[sorted results (exact/1-off)]
age: (1-off:0.734)
0.545/0.800
0.427/0.697
0.525/0.744
0.427/0.704
0.463/0.725
gender: (1-off: 0.8406)
0.397/0.858
0.561/0.840
0.540/0.831
0.471/0.852
0.603/0.822
gender is closed to paper (but still lower), and the result of age is quite far from the baseline.
One thing quite far form result is, I executed slightly modified version of this repository
(like training step to 50,000, integrating train-valid in one step...)
How much of the final result, from following entire process from end-to-end, is expected?
Regards,
inscite
when i execute python guess.py --model_dir /home/zhucj/rude-carnie/22801 --filename /home/zhucj/tf/abc/aligned/100003415@N08/landmark_aligned_face.2177.9527097954_74e91bbf71_o.jpg
some mistakes happend,why
NotFoundError (see above for traceback): Key LeviHassner/conv1/biases not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
Hello everyone! Is it possible to do Age and Gender recognition consistently? I want to use detection for picture only one time, and after have both of rec. with pictures what i have, without detection and command lane again. Will be glad if you have ideas how to do it ^^.
Hey there,
From reading over the README, I gather you may have meant to provide some sort of pre-trained model, or maybe some checkpoint files... Could you point me to those by any chance?
Thanks,
where can I download the pretrained model?
Hello, it seems to the eval.py
is written to be run alongside the training. So how to run eval.py
after the training. I am still confused.
Or can you provide a simple inference script?
thank you very much~~
i want to use the freeze graph to predict my picture,because now using .ckpt model to predict needs too much time.but when i freeze the graph i find the input placeholder'size is batch size,how can i input only one picture to predict?
for gender, and for age.
The paper model, not the Inception model.
Thanks
Does anyone know the image format used for training model provided by 'https://drive.google.com/drive/folders/0B8N1oYmGLVGWbDZ4Y21GLWxtV1E' ? I.e., the image format is 'RGB' or 'BGR' ?
I wonder why age_list is not continual in guess.py?
AGE_LIST = ['(0, 2)', '(4, 6)', '(8, 12)', '(15, 20)', '(25, 32)', '(38, 43)', '(48, 53)', '(60, 100)']
Hi Daniel,
If I'll take the .caffemodel and .prototxt of their Caffe implementation and convert it using the caffe-tensorflow script, do you think there's any chance it will work on your implementation?
Thanks,
Shlomi
Thank you very much a lot for your work!
I downloaded the pre-trained model , and when I did the guess ,I got this traceback:
Not found: Key LeviHassner/conv1/biases not found in checkpoint
Not found: Key LeviHassner/conv1/weights not found in checkpoint
Not found: Key LeviHassner/conv2/biases not found in checkpoint
NotFoundError (see above for traceback): Key LeviHassner/conv1/biases not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
Is it a problem with the model? How to solve it?
Why is that it is not possible to recognize in real time?
Hi mate where is the aligned folder of data ? I cannot seem to find it.
Hi, anyone have the same issue of downloading from http://www.openu.ac.il/home/hassner/Adience/data.html#agegender ?
Is the model trained on other dataset ?
Thanks
IMHO the best face detection has dlib http://dlib.net/
It will very good if you append support such face_detection_type
hey, finally i could mange to finish the traing in 90 min on an amazon cloud instance with gpu (tesla k 80)... but the predictions seems to be random... for example: justin bieber photo1: (0,2) on another photo he was (34,43)
tested over 10 random photos... portrait, color, greyscaled, landscaped photos... got only bad results...
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/conv1/biases not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/conv1/weights not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/conv2/biases not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/conv2/weights not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/conv3/biases not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/conv3/weights not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/full1/biases not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/full2/weights not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/full2/biases not found in checkpoint
W tensorflow/core/framework/op_kernel.cc:993] Not found: Key LeviHassner/full1/weights not found in checkpoint
What script do you run to generate the age_train.txt
and gender_train.txt
files? The adience dataset only contains the following fold files:
$ ls ../fold_*
../fold_0_data.txt ../fold_2_data.txt ../fold_4_data.txt ../fold_frontal_1_data.txt ../fold_frontal_3_data.txt
../fold_1_data.txt ../fold_3_data.txt ../fold_frontal_0_data.txt ../fold_frontal_2_data.txt ../fold_frontal_4_data.txt
Which ones did you use to create the training and test files. Also, you use some indexing for gender and age. Will your code work on non integer labels, like the default m,f,u
for gender and the ranges for age?
Hi, in the predicting process, I found that the input picture has to be transformed into various version, the final result is the sum of the predicting result for each, is this a method to increase the accuracy?
Hi,
Thanks for sharing this amazing work !
This is not an issue but I just wanted to confirm if anyone else is also getting very good results on Gender Identification while training/testing over only fold-0 or I am making some mistake here.
I am getting around 91.5% accuracy without making any change in the training process. Ran the following command after replacing the paths correctly.
python train.py --train_dir /home/dpressel/dev/work/AgeGenderDeepLearning/Folds/tf/gen_test_fold_is_0 --max_steps 30000 --eta 0.001
gender_dataset_prepared//run-7274/checkpoint-22000
128 11
2017-07-22 11:44:16.598992 (42.1 examples/sec; 3.042 sec/batch)
2017-07-22 11:44:19.379264 (46.1 examples/sec; 2.779 sec/batch)
2017-07-22 11:44:22.162947 (46.0 examples/sec; 2.783 sec/batch)
2017-07-22 11:44:24.612090 (52.3 examples/sec; 2.449 sec/batch)
2017-07-22 11:44:27.203950 (49.4 examples/sec; 2.591 sec/batch)
2017-07-22 11:44:29.621074 (53.0 examples/sec; 2.417 sec/batch)
2017-07-22 11:44:32.063554 (52.4 examples/sec; 2.442 sec/batch)
2017-07-22 11:44:34.589392 (50.7 examples/sec; 2.526 sec/batch)
2017-07-22 11:44:37.128826 (50.4 examples/sec; 2.539 sec/batch)
2017-07-22 11:44:39.553517 (52.8 examples/sec; 2.425 sec/batch)
2017-07-22 11:44:41.902865 (54.5 examples/sec; 2.349 sec/batch)
2017-07-22 11:44:41.903033: precision @ 1 = 0.915 (1288/1408)
2017-07-22 11:44:41.903047: precision @ 2 = 1.000 (1408/1408)
I am using files for imdb data set and I get loss=nan .
I feel there is problem in pre processing ?
any idea what can be the problem?
python guess.py --model_type inception --model_dir ./21936 --filename paul.jpg
Traceback (most recent call last):
File "guess.py", line 166, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "guess.py", line 119, in main
saver.restore(sess, model_checkpoint_path)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1428, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 767, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 965, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1015, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1035, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [8] rhs shape= [2]
[[Node: save/Assign_376 = Assign[T=DT_FLOAT, _class=["loc:@output/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/gpu:0"](output/biases, save/RestoreV2_376/_1)]]
Caused by op u'save/Assign_376', defined at:
File "guess.py", line 166, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "guess.py", line 118, in main
saver = tf.train.Saver()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1040, in __init__
self.build()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1070, in build
restore_sequentially=self._restore_sequentially)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 675, in build
restore_sequentially, reshape)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 414, in _AddRestoreOps
assign_ops.append(saveable.restore(tensors, shapes))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 155, in restore
self.op.get_shape().is_fully_defined())
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_state_ops.py", line 47, in assign
use_locking=use_locking, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2327, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1226, in __init__
self._traceback = _extract_stack()
InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [8] rhs shape= [2]
[[Node: save/Assign_376 = Assign[T=DT_FLOAT, _class=["loc:@output/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/gpu:0"](output/biases, save/RestoreV2_376/_1)]]
$ python -c 'import tensorflow as tf; print(tf.__version__)'
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
1.0.1
Hello!
I'm trying to use your model on gpu. On cpu it works flawless, but then I try to use it on gpu - it doesn't work.
Error traceback, in short:
InvalidArgumentError (see above for traceback): Cannot assign a device to node 'save/SaveV2': Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available.
[[Node: save/SaveV2 = SaveV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT.....
_device="/device:GPU:0"](save/Const, save/SaveV2/tensor_names, save/SaveV2/shape_and_slices, InceptionV3/Conv2d_1a_3x3/BatchNorm/beta, InceptionV3/Conv2d_1a_3x3/BatchNorm/moving_mean, InceptionV3/Conv2d_1a_3x3/BatchNorm/moving_variance, InceptionV3/Conv2d_1a_3x3/weights,
Full traceback and installed python libraries can be seen at https://pastebin.com/aR5CX3eG
I'm using Ubuntu 16.04.1 LTS on a p2.xlarge AWS instance with Tesla K80.
Any ideas why it doesn't work?
Hi, I experiment with inception_v3 for gender classification, but the highest accuracy of test set is 78%, I attach my code below, could you please find where my error is , thank you
inception_v3.py.txt
Hi, I train just as README
$ python train.py --train_dir /home/dpressel/dev/work/AgeGenderDeepLearning/Folds/tf/gen_test_fold_is_0 --max_steps 10000
But the loss doesn't decrease at all. Is there something wrong with the method?
Did this
$ python guess.py --model_type inception --model_dir /data/xdata/rude-carnie/checkpoints/.... --filename /home/dpressel/Downloads/portraits/prince.jpg
already included face detection before gender guess or age guess ?
I mean, should I perform face crop before using guess.py ?
thx
I want to use opencv mat to load and save image data. Does anyone know how can I transfer mat image into tensorflow data read by 'tf.gfile.FastGFile' ?
Hello there
I'm quite new in tensorflow and machine learning.
Following the doc, I can't find model in
$ python guess.py --model_dir /home/dpressel/dev/work/AgeGenderDeepLearning/Folds/tf/age_test_fold_is_1/run-20854 --filename /home/dpressel/Downloads/portraits/prince.jpg
I've cloned https://github.com/GilLevi/AgeGenderDeepLearning and there is no Folds/tf
folder nor a single file called run-20854
anywhere else.
I downloaded the pre-trained checkpoints from google drive, only to find there are two folders called 21936 and 22801 and the doc didn't mention how to use it.
I've tried
python guess.py --model_dir ./model/22801/ --filename sample.jpg
and it turns out the following error
2017-07-24 08:18:09.407164: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-24 08:18:09.407188: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-24 08:18:09.407194: W 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-07-24 08:18:09.407200: W 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.
2017-07-24 08:18:09.407204: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
2017-07-24 08:18:09.506781: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:893] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-07-24 08:18:09.507050: I tensorflow/core/common_runtime/gpu/gpu_device.cc:940] Found device 0 with properties:
name: GeForce GTX 1080
major: 6 minor: 1 memoryClockRate (GHz) 1.835
pciBusID 0000:01:00.0
Total memory: 7.92GiB
Free memory: 7.03GiB
2017-07-24 08:18:09.507070: I tensorflow/core/common_runtime/gpu/gpu_device.cc:961] DMA: 0
2017-07-24 08:18:09.507077: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0: Y
2017-07-24 08:18:09.507090: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080, pci bus id: 0000:01:00.0)
Executing on /cpu:0
selected default model
./model/22801/checkpoint-14999
2017-07-24 08:18:09.625685: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv1/weights not found in checkpoint
2017-07-24 08:18:09.625885: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv1/biases not found in checkpoint
2017-07-24 08:18:09.625843: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv2/biases not found in checkpoint
2017-07-24 08:18:09.626247: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv3/biases not found in checkpoint
2017-07-24 08:18:09.626424: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/full1/weights not found in checkpoint
2017-07-24 08:18:09.626522: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv2/weights not found in checkpoint
2017-07-24 08:18:09.626551: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/full1/biases not found in checkpoint
2017-07-24 08:18:09.626612: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv3/weights not found in checkpoint
2017-07-24 08:18:09.627491: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/full2/biases not found in checkpoint
2017-07-24 08:18:09.627569: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/full2/weights not found in checkpoint
Traceback (most recent call last):
File "guess.py", line 207, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "guess.py", line 166, in main
saver.restore(sess, model_checkpoint_path)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1548, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 789, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 997, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1132, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1152, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Key LeviHassner/conv1/weights not found in checkpoint
[[Node: save/RestoreV2_1 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_1/tensor_names, save/RestoreV2_1/shape_and_slices)]]
Caused by op u'save/RestoreV2_1', defined at:
File "guess.py", line 207, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "guess.py", line 165, in main
saver = tf.train.Saver()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1139, in __init__
self.build()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1170, in build
restore_sequentially=self._restore_sequentially)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 691, in build
restore_sequentially, reshape)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 407, in _AddRestoreOps
tensors = self.restore_op(filename_tensor, saveable, preferred_shard)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 247, in restore_op
[spec.tensor.dtype])[0])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_io_ops.py", line 640, in restore_v2
dtypes=dtypes, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2506, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1269, in __init__
self._traceback = _extract_stack()
NotFoundError (see above for traceback): Key LeviHassner/conv1/weights not found in checkpoint
[[Node: save/RestoreV2_1 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_1/tensor_names, save/RestoreV2_1/shape_and_slices)]]
And get similar result with
python guess.py --model_dir ./model/21936/ --filename sample.jpg
Can someone please give a hint how to use it? Thank you.
when I run the program like this:
python3 guess.py --model_dir ../inception-v3/ --filename ./prince.jpg
I get this message:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
return fn(*args)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1306, in _run_fn
status, run_metadata)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 88, in exit
next(self.gen)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: Tensor name "LeviHassner/conv1/biases" not found in checkpoint files ../inception-v3/model.ckpt-157585
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
Did I do something wrong??
Hi @dpressel ,
First of, thank you for this amazing project!
Coming to my issue, when I try running guess.py for a batch of images, the memory and execution time increases for each image. I checked memory using the 'top' and noticed the memory and cpu usage would constantly increase and eventually the program would crash.
I did a bit of digging and found this link where mrry suggests tcmalloc. I also came across couple of other links where this has been suggested but this didn't seem to make a difference.
Any ideas as to how to solve this?
I want to train the gender data. I found that i only can preprocess one fold one time(I try to combine the gender_train.txt files from different fold together, but the propoc.py shows that "too many values to unpack").
So I was wondering how to train all the image together.
While executing :
python guess.py --class_type gender --model_type inception --model_dir ../../data/22801 --filename ../../../Pictures/People-on-street.jpg
I'm getting this error :
Traceback (most recent call last):
File "guess.py", line 173, in <module>
tf.app.run()
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "guess.py", line 134, in main
saver.restore(sess, model_checkpoint_path)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1457, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 778, in run
run_metadata_ptr)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 982, in _run
feed_dict_string, options, run_metadata)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1032, in _do_run
target_list, options, run_metadata)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1052, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.OutOfRangeError: Read less bytes than requested
[[Node: save/RestoreV2_377 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2_377/tensor_names, save/RestoreV2_377/shape_and_slices)]]
Caused by op u'save/RestoreV2_377', defined at:
File "guess.py", line 173, in <module>
tf.app.run()
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "guess.py", line 133, in main
saver = tf.train.Saver()
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1056, in __init__
self.build()
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1086, in build
restore_sequentially=self._restore_sequentially)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 691, in build
restore_sequentially, reshape)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 407, in _AddRestoreOps
tensors = self.restore_op(filename_tensor, saveable, preferred_shard)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 247, in restore_op
[spec.tensor.dtype])[0])
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 669, in restore_v2
dtypes=dtypes, name=name)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 768, in apply_op
op_def=op_def)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2336, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/home/blur/Documents/virtualenv/tfenv-cpu/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1228, in __init__
self._traceback = _extract_stack()
OutOfRangeError (see above for traceback): Read less bytes than requested
[[Node: save/RestoreV2_377 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2_377/tensor_names, save/RestoreV2_377/shape_and_slices)]]
I don't really understand the meaning of it.
@dpressel How do I freeze the model and make prediction realtime?
Is their any possibility to catch up on a broken trainingsession (for instance - ssh connection to dedicated server gets lost - so pyhton traingsscript stops on trainingstep 420/12000 )
would like to continue on step 420 - is that possible?
Hello!
I want to load model use opencv dnn. However, function cv::dnn::ReadTFNetParamsFromBinaryFileOrDie can not load it. How can I do?
Hi I have retrieved the aligned folder from Adience website and updated the first command accordingly but I repeatedly get the following response:
python2.7 preproc.py --fold_dir /media/tinn/TINN/ComputerVision/Gender-Age/AgeGenderDeepLearning/Folds/train_val_txt_files_per_fold/test_fold_is_0 --train_list age_train.txt --valid_list age_val.txt --data_dir /media/tinn/TINN/_DATA/Images/Gender-Age/aligned --output_dir /media/tinn/TINN/ComputerVision/Gender-Age/AgeGenderDeepLearning/Folds/tf/age_test_fold_is_0
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally
Saving results to /media/tinn/TINN/ComputerVision/Gender-Age/AgeGenderDeepLearning/Folds/tf/age_test_fold_is_0
Determining list of input files and labels from /media/tinn/TINN/ComputerVision/Gender-Age/AgeGenderDeepLearning/Folds/train_val_txt_files_per_fold/test_fold_is_0/age_val.txt.
Found 0 JPEG files across 0 labels inside /media/tinn/TINN/_DATA/Images/Gender-Age/aligned.
Launching 2 threads for spacings: [[0, 0], [0, 0]]
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties:
name: GeForce GTX 750 Ti
major: 5 minor: 0 memoryClockRate (GHz) 1.1105
pciBusID 0000:01:00.0
Total memory: 1.95GiB
Free memory: 1.05GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 750 Ti, pci bus id: 0000:01:00.0)
2017-02-07 22:47:56.516437 [thread 1]: Wrote 0 images to /media/tinn/TINN/ComputerVision/Gender-Age/AgeGenderDeepLearning/Folds/tf/age_test_fold_is_0/validation-00001-of-00002
2017-02-07 22:47:56.516558 [thread 0]: Wrote 0 images to /media/tinn/TINN/ComputerVision/Gender-Age/AgeGenderDeepLearning/Folds/tf/age_test_fold_is_0/validation-00000-of-00002
2017-02-07 22:47:56.516638 [thread 1]: Wrote 0 images to 0 shards.
2017-02-07 22:47:56.516677 [thread 0]: Wrote 0 images to 0 shards.
2017-02-07 22:47:57.515985: Finished writing all 0 images in data set.
Do you have any suggestions as to why it is functioning as expected ?
hi
the model of age is ok
when I run the model of gender it occur some faults ?is the problem of checkpoint 21936?
someone who can solve this tiny problem
python guess.py --class_type gender --modelip-192-168-30-14:rude-carnie cassie$ python guess.py --class_type gender --modelip-192-168-30-14:rude-carnie cassie$ python guess.py --class_type gender --modelip-192-168-30-14:rude-carnie cassie$ python guess.py --class_type gender --model_dir /Users/cassie/Desktop/cassie/rude-carnie/21936 --filename /Users/cassie/Desktop/cassie/rude-carnie/15-20/15-20/215932245063278592-2-1.jpg
2017-07-24 18:50:04.084346: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-24 18:50:04.084369: W 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-07-24 18:50:04.084375: W 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.
2017-07-24 18:50:04.084379: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Executing on /cpu:0
selected default model
/Users/cassie/Desktop/cassie/rude-carnie/21936/checkpoint-14999
2017-07-24 18:50:04.453690: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv1/biases not found in checkpoint
2017-07-24 18:50:04.453690: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv2/biases not found in checkpoint
2017-07-24 18:50:04.453696: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv1/weights not found in checkpoint
2017-07-24 18:50:04.454927: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv2/weights not found in checkpoint
2017-07-24 18:50:04.454931: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv3/weights not found in checkpoint
2017-07-24 18:50:04.454933: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/conv3/biases not found in checkpoint
2017-07-24 18:50:04.455995: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/full2/weights not found in checkpoint
2017-07-24 18:50:04.456091: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/full1/biases not found in checkpoint
2017-07-24 18:50:04.456137: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/full2/biases not found in checkpoint
2017-07-24 18:50:04.456169: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key LeviHassner/full1/weights not found in checkpoint
Traceback (most recent call last):
File "guess.py", line 207, in
tf.app.run()
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "guess.py", line 166, in main
saver.restore(sess, model_checkpoint_path)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1548, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 789, in run
run_metadata_ptr)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 997, in _run
feed_dict_string, options, run_metadata)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1132, in _do_run
target_list, options, run_metadata)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1152, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Key LeviHassner/conv1/biases not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
Caused by op u'save/RestoreV2', defined at:
File "guess.py", line 207, in
tf.app.run()
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "guess.py", line 165, in main
saver = tf.train.Saver()
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1139, in init
self.build()
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1170, in build
restore_sequentially=self._restore_sequentially)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 691, in build
restore_sequentially, reshape)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 407, in _AddRestoreOps
tensors = self.restore_op(filename_tensor, saveable, preferred_shard)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 247, in restore_op
[spec.tensor.dtype])[0])
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 640, in restore_v2
dtypes=dtypes, name=name)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2506, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/Users/cassie/Cellar/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1269, in init
self._traceback = _extract_stack()
NotFoundError (see above for traceback): Key LeviHassner/conv1/biases not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
It is throwing the following error while running guess.py
File "guess.py", line 8, in <module>
from data import inputs
File "/cygdrive/c/Users/Documents/rude-carnie-master/rude-carnie-master/data.py", line 5, in <module>
from tensorflow.python.ops import array_ops
ImportError: No module named tensorflow.python.ops
Hey. wanted do the step of preprocessing the trianingdata.. and did not found the data
"--data_dir /data/xdata/age-gender/aligned "
Where can i get it?
Hello!
Thanks for all this beautifull work.
I was wondering how to load an image directly from a numpy array (grabbed from a video using opencv for instance) instead of a ".jpeg" file.
The goal is to run detection directly from a videofile.
with tf.gfile.FastGFile(filename, 'r') as f:
image_data = f.read()
# Convert any PNG to JPEG's for consistency.
if _is_png(filename):
print('Converting PNG to JPEG for %s' % filename)
image_data = coder.png_to_jpeg(image_data)
image = coder.decode_jpeg(image_data)
I saw that these lines do the conversion from .jpeg file to "tensorflow encoded image". Is there a way to encode numpy array from opencv?
Thanks a lot, if I found something I will edit my post.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.