Git Product home page Git Product logo

cnn-facial-landmark's Introduction

Hi there 👋

I'm Yin Guobing (in Chinese: 尹国冰), a real human being! 🏃

I was born and grown up in China, a place of long history and ancient culture. After getting my master's degree in physics, I unwittingly broke into the world of computer vision and started my adventure. This is a place where I keep my open source projects that you might find helpful. 🌱

These projects do not aim to replace the existing mature solutions, instead, they consider the ease of understanding as first priority and were written with care and ❤️. Most of them also have companian posts and videos which make them easier to understand through visual illustration. You can find them from my blog.

如果您有在广州或者深圳的工作机会,欢迎联系!

关键词:大语言模型、多模态、深度学习图像处理、Rust。

cnn-facial-landmark's People

Contributors

yinguobing 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

cnn-facial-landmark's Issues

landmark

Are you working on updating it ?

pb转coreml遇到的问题

pb文件转coreml遇到这个error:
ValueError: Input 0 of node Reshape was passed float from input_image_tensor:0 incompatible with expected uint8.
看楼主博文提到这个问题需要指定输入tensor的第一个维度为1;请问下这个是要freeze graph的时候做还是在到处saved_model时候做
谢谢

检测效果不理想

您好,我在您的博客中看到从网上随机抓取图片进行检测后,效果不理想,我也遇到了同样的问题,请问您找到原因了吗?

Retrainng with new dataset and generating frozen_inference.pb model file

Hi,

I am working in your eye-lid detection algorithm which uses tensor-flow library. i was stuck in a procedure how to retrain the algorithm with new face and landmark annotated data-set. I have tried with procedure given in tensor-flow and able to get frozen_inference.pb file. but while loading it in your algorithm am getting below error.

KeyError: "The name 'logits/BiasAdd:0' refers to a Tensor which does not exist. The operation, 'logits/BiasAdd', does not exist in the graph."


Please help me in the procedure how to retrain with new face data-set and get the frozen_inference,pb file.

Kindly do the needful..

Regards,
Niranjan B

detect_face.py

你好,想问一下,detect_face.py 这个文件的链接还有么,之前的都失效了,找不到了

开始训练以后出现问题

使用landmark.py开始训练
训练100步以后提示
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Saving checkpoints for 1 into ./train/model.ckpt.
INFO:tensorflow:loss = 11.351076, step = 1
INFO:tensorflow:global_step/sec: 0.848605
INFO:tensorflow:loss = 0.0079134945, step = 101 (117.843 sec)
INFO:tensorflow:Saving checkpoints for 200 into ./train/model.ckpt.
INFO:tensorflow:Loss for final step: 0.0037037705.
INFO:tensorflow:Calling model_fn.

model_fn_results = self._model_fn(features=features, **kwargs)
File "landmark.py", line 27, in cnn_model_fn
inputs = tf.to_float(features['x'], name="input_to_float")
KeyError: 'x'

PermissionDeniedError Traceback (most recent call last)

When I Run the landmark.py file it has given me following error message. How to solve this error?

INFO:tensorflow:Using default config.
INFO:tensorflow:Using config: {'_model_dir': '/train', '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_steps': None, '_save_checkpoints_secs': 600, '_session_config': allow_soft_placement: true
graph_options {
  rewrite_options {
    meta_optimizer_iterations: ONE
  }
}
, '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_service': None, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x000002A8609C2C88>, '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}
WARNING:tensorflow:From C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
INFO:tensorflow:Calling model_fn.
WARNING:tensorflow:From <ipython-input-1-3205b076f1ee>:27: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
WARNING:tensorflow:From <ipython-input-1-3205b076f1ee>:39: conv2d (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.conv2d instead.
WARNING:tensorflow:From <ipython-input-1-3205b076f1ee>:47: max_pooling2d (from tensorflow.python.layers.pooling) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.max_pooling2d instead.
WARNING:tensorflow:From <ipython-input-1-3205b076f1ee>:153: flatten (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.flatten instead.
WARNING:tensorflow:From <ipython-input-1-3205b076f1ee>:160: dense (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.dense instead.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Saving checkpoints for 0 into /train\model.ckpt.
---------------------------------------------------------------------------
PermissionDeniedError                     Traceback (most recent call last)
~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
   1333     try:
-> 1334       return fn(*args)
   1335     except errors.OpError as e:

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\client\session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
   1318       return self._call_tf_sessionrun(
-> 1319           options, feed_dict, fetch_list, target_list, run_metadata)
   1320 

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\client\session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
   1406         self._session, options, feed_dict, fetch_list, target_list,
-> 1407         run_metadata)
   1408 

PermissionDeniedError: Failed to create a directory: /; Permission denied
	 [[{{node save/MergeV2Checkpoints}}]]

During handling of the above exception, another exception occurred:

PermissionDeniedError                     Traceback (most recent call last)
<ipython-input-1-3205b076f1ee> in <module>
    320 
    321 if __name__ == '__main__':
--> 322     tf.app.run()

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\platform\app.py in run(main, argv)
    123   # Call the main function, passing through any arguments
    124   # to the final program.
--> 125   _sys.exit(main(argv))
    126 

<ipython-input-1-3205b076f1ee> in main(unused_argv)
    297 
    298     if mode == tf.estimator.ModeKeys.TRAIN:
--> 299         estimator.train(input_fn=_train_input_fn, steps=200000)
    300 
    301         # Export result as SavedModel.

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in train(self, input_fn, hooks, steps, max_steps, saving_listeners)
    356 
    357       saving_listeners = _check_listeners_type(saving_listeners)
--> 358       loss = self._train_model(input_fn, hooks, saving_listeners)
    359       logging.info('Loss for final step: %s.', loss)
    360       return self

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in _train_model(self, input_fn, hooks, saving_listeners)
   1122       return self._train_model_distributed(input_fn, hooks, saving_listeners)
   1123     else:
-> 1124       return self._train_model_default(input_fn, hooks, saving_listeners)
   1125 
   1126   def _train_model_default(self, input_fn, hooks, saving_listeners):

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in _train_model_default(self, input_fn, hooks, saving_listeners)
   1156       return self._train_with_estimator_spec(estimator_spec, worker_hooks,
   1157                                              hooks, global_step_tensor,
-> 1158                                              saving_listeners)
   1159 
   1160   def _train_model_distributed(self, input_fn, hooks, saving_listeners):

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in _train_with_estimator_spec(self, estimator_spec, worker_hooks, hooks, global_step_tensor, saving_listeners)
   1401         save_summaries_steps=save_summary_steps,
   1402         config=self._session_config,
-> 1403         log_step_count_steps=log_step_count_steps) as mon_sess:
   1404       loss = None
   1405       any_step_done = False

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py in MonitoredTrainingSession(master, is_chief, checkpoint_dir, scaffold, hooks, chief_only_hooks, save_checkpoint_secs, save_summaries_steps, save_summaries_secs, config, stop_grace_period_secs, log_step_count_steps, max_wait_secs, save_checkpoint_steps, summary_dir)
    506       session_creator=session_creator,
    507       hooks=all_hooks,
--> 508       stop_grace_period_secs=stop_grace_period_secs)
    509 
    510 

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py in __init__(self, session_creator, hooks, stop_grace_period_secs)
    932     super(MonitoredSession, self).__init__(
    933         session_creator, hooks, should_recover=True,
--> 934         stop_grace_period_secs=stop_grace_period_secs)
    935 
    936 

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py in __init__(self, session_creator, hooks, should_recover, stop_grace_period_secs)
    646         stop_grace_period_secs=stop_grace_period_secs)
    647     if should_recover:
--> 648       self._sess = _RecoverableSession(self._coordinated_creator)
    649     else:
    650       self._sess = self._coordinated_creator.create_session()

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py in __init__(self, sess_creator)
   1120     """
   1121     self._sess_creator = sess_creator
-> 1122     _WrappedSession.__init__(self, self._create_session())
   1123 
   1124   def _create_session(self):

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py in _create_session(self)
   1125     while True:
   1126       try:
-> 1127         return self._sess_creator.create_session()
   1128       except _PREEMPTION_ERRORS as e:
   1129         logging.info('An error was raised while a session was being created. '

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py in create_session(self)
    810       # Inform the hooks that a new session has been created.
    811       for hook in self._hooks:
--> 812         hook.after_create_session(self.tf_sess, self.coord)
    813       return _CoordinatedSession(
    814           _HookedSession(self.tf_sess, self._hooks), self.coord,

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\basic_session_run_hooks.py in after_create_session(self, session, coord)
    566     self._summary_writer.add_meta_graph(meta_graph_def)
    567     # The checkpoint saved here is the state at step "global_step".
--> 568     self._save(session, global_step)
    569     self._timer.update_last_triggered_step(global_step)
    570 

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\basic_session_run_hooks.py in _save(self, session, step)
    597       l.before_save(session, step)
    598 
--> 599     self._get_saver().save(session, self._save_path, global_step=step)
    600     self._summary_writer.add_session_log(
    601         SessionLog(

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\saver.py in save(self, sess, save_path, global_step, latest_filename, meta_graph_suffix, write_meta_graph, write_state, strip_default_attrs)
   1169           model_checkpoint_path = sess.run(
   1170               self.saver_def.save_tensor_name,
-> 1171               {self.saver_def.filename_tensor_name: checkpoint_file})
   1172 
   1173         model_checkpoint_path = compat.as_str(model_checkpoint_path)

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\client\session.py in run(self, fetches, feed_dict, options, run_metadata)
    927     try:
    928       result = self._run(None, fetches, feed_dict, options_ptr,
--> 929                          run_metadata_ptr)
    930       if run_metadata:
    931         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\client\session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
   1150     if final_fetches or final_targets or (handle and feed_dict_tensor):
   1151       results = self._do_run(handle, final_targets, final_fetches,
-> 1152                              feed_dict_tensor, options, run_metadata)
   1153     else:
   1154       results = []

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\client\session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
   1326     if handle is None:
   1327       return self._do_call(_run_fn, feeds, fetches, targets, options,
-> 1328                            run_metadata)
   1329     else:
   1330       return self._do_call(_prun_fn, handle, feeds, fetches)

~\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
   1346           pass
   1347       message = error_interpolation.interpolate(message, self._graph)
-> 1348       raise type(e)(node_def, op, message)
   1349 
   1350   def _extend_graph(self):

PermissionDeniedError: Failed to create a directory: /; Permission denied
	 [[node save/MergeV2Checkpoints (defined at C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py:1403) ]]

Caused by op 'save/MergeV2Checkpoints', defined at:
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
    app.start()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\ipykernel\kernelapp.py", line 505, in start
    self.io_loop.start()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tornado\platform\asyncio.py", line 132, in start
    self.asyncio_loop.run_forever()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\asyncio\base_events.py", line 438, in run_forever
    self._run_once()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\asyncio\base_events.py", line 1451, in _run_once
    handle._run()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\asyncio\events.py", line 145, in _run
    self._callback(*self._args)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tornado\ioloop.py", line 758, in _run_callback
    ret = callback()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tornado\stack_context.py", line 300, in null_wrapper
    return fn(*args, **kwargs)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tornado\gen.py", line 1233, in inner
    self.run()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tornado\gen.py", line 1147, in run
    yielded = self.gen.send(value)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\ipykernel\kernelbase.py", line 357, in process_one
    yield gen.maybe_future(dispatch(*args))
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tornado\gen.py", line 326, in wrapper
    yielded = next(result)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\ipykernel\kernelbase.py", line 267, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tornado\gen.py", line 326, in wrapper
    yielded = next(result)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\ipykernel\kernelbase.py", line 534, in execute_request
    user_expressions, allow_stdin,
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tornado\gen.py", line 326, in wrapper
    yielded = next(result)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\ipykernel\ipkernel.py", line 294, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\ipykernel\zmqshell.py", line 536, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\IPython\core\interactiveshell.py", line 2819, in run_cell
    raw_cell, store_history, silent, shell_futures)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\IPython\core\interactiveshell.py", line 2845, in _run_cell
    return runner(coro)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\IPython\core\async_helpers.py", line 67, in _pseudo_sync_runner
    coro.send(None)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\IPython\core\interactiveshell.py", line 3020, in run_cell_async
    interactivity=interactivity, compiler=compiler, result=result)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\IPython\core\interactiveshell.py", line 3185, in run_ast_nodes
    if (yield from self.run_code(code, result)):
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\IPython\core\interactiveshell.py", line 3267, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-3205b076f1ee>", line 322, in <module>
    tf.app.run()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "<ipython-input-1-3205b076f1ee>", line 299, in main
    estimator.train(input_fn=_train_input_fn, steps=200000)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 358, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1124, in _train_model
    return self._train_model_default(input_fn, hooks, saving_listeners)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1158, in _train_model_default
    saving_listeners)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1403, in _train_with_estimator_spec
    log_step_count_steps=log_step_count_steps) as mon_sess:
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py", line 508, in MonitoredTrainingSession
    stop_grace_period_secs=stop_grace_period_secs)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py", line 934, in __init__
    stop_grace_period_secs=stop_grace_period_secs)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py", line 648, in __init__
    self._sess = _RecoverableSession(self._coordinated_creator)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py", line 1122, in __init__
    _WrappedSession.__init__(self, self._create_session())
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py", line 1127, in _create_session
    return self._sess_creator.create_session()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py", line 805, in create_session
    self.tf_sess = self._session_creator.create_session()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py", line 562, in create_session
    self._scaffold.finalize()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\monitored_session.py", line 219, in finalize
    self._saver.build()
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\saver.py", line 844, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\saver.py", line 881, in _build
    build_save=build_save, build_restore=build_restore)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\saver.py", line 504, in _build_internal
    save_tensor = self._AddShardedSaveOps(filename_tensor, per_device)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\saver.py", line 295, in _AddShardedSaveOps
    return self._AddShardedSaveOpsForV2(filename_tensor, per_device)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\training\saver.py", line 277, in _AddShardedSaveOpsForV2
    sharded_prefixes, checkpoint_prefix, delete_old_dirs=True)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 547, in merge_v2_checkpoints
    delete_old_dirs=delete_old_dirs, name=name)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\framework\ops.py", line 3300, in create_op
    op_def=op_def)
  File "C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow\python\framework\ops.py", line 1801, in __init__
    self._traceback = tf_stack.extract_stack()

PermissionDeniedError (see above for traceback): Failed to create a directory: /; Permission denied
	 [[node save/MergeV2Checkpoints (defined at C:\Users\iHacker\Anaconda3\envs\mainenv\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py:1403) ]]

人脸关键点坐标顺序问题

首先,感谢你的分享!
想确认下,ibug\afw\helen\lfpw\300w\300vw,这六个数据集的68点标注,坐标顺序都是一样的吗?
具体顺序是什么样的呢?求分享。

Training with own dataset

Hello Sir,
Did you can explain with details how to train own dataset ( custom dataset ) to detect custom object for exemple , I need to training my dataset to detect the region of iris in the eye ,
So i need to add keypoints for the iris region
Thanks

accuracy

@yinguobing
please if you can while updating the code ( training) add the necessary statement for calculation the accuracy at each step with training and the accuracy of testing
( example : step 1 loss = ..... , accuracy= ....)
thanks alot

完整的代码

您好,研究你写的博客,在哪里下载您的完整的代码呢?

data.csv的内容是什么?

您好,请问data.csv的内容是什么格式的?是不是有3列内容,第一列是图片的路径,第二列是对应图片标注的68个点的横坐标,第三列是相应的68个点的纵坐标。
谢谢

这个问题怎么解决?很多人都遇到了,求指教

INFO:tensorflow:Calling model_fn.
Traceback (most recent call last):
File "H:/F Disk/cnn/master/landmark.py", line 329, in
tf.app.run()
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "H:/F Disk/cnn/master/landmark.py", line 308, in main
estimator.export_savedmodel('./save_model', serving_input_receiver_fn)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 650, in export_savedmodel
mode=model_fn_lib.ModeKeys.PREDICT)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 703, in _export_saved_model_for_mode
strip_default_attrs=strip_default_attrs)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 811, in _export_all_saved_models
mode=model_fn_lib.ModeKeys.PREDICT)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 879, in _add_meta_graph_for_mode
config=self.config)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1107, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "H:/F Disk/cnn/master/landmark.py", line 27, in cnn_model_fn
inputs = tf.to_float(features['x'], name="input_to_float")
KeyError: 'x'

Process finished with exit code 1

detect_face.py

麻烦问一下哪里可以找到detect_face.py文件呢?

prediction wih 3D

Hello ,
I want to know how can i use 3D in the model to get good values?

KeyError: 'file_basename' when execute generate_tfrecord.py

Hello ,
I have organize my data and i want to generate train.record and test.record and valid.record , but when i execute :

python3 generate_tfrecord.py

I get those errors:

0it [00:00, ?it/s]
Traceback (most recent call last):
File "C:\Users\starinfo\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\indexes\base.py", line 4381, in get_value
return libindex.get_value_box(s, key)
File "pandas_libs\index.pyx", line 52, in pandas._libs.index.get_value_box
File "pandas_libs\index.pyx", line 48, in pandas._libs.index.get_value_at
File "pandas_libs\util.pxd", line 113, in pandas._libs.util.get_value_at
File "pandas_libs\util.pxd", line 98, in pandas._libs.util.validate_indexer
TypeError: 'str' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:

Who have idea how to solve those problems?

Cnn model

Hello!

Great work!
Can you share the pre-train cnn-model for face landmarks detection?

Thanks!

reshape错误

您好,我使用你的源码和训练集,把数据做成tfrecord,但是我在训练的时候,提示错误,错误如下: tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 16384 values, but the requested shape has 49152 请问出了什么错误吗?

Detect from webcam

Hello Ying,
I want to know , is it possible to test the model with Webcam?

方便提供训练的数据集吗

读了您的博文,收获很大,非常感谢您的工作!
请问您方便分享一下您处理之后的数据集吗?即每张图片和对应Landmark的数据集,盼复。

Continue training with different number of points

Hello, thank for sharing your work.
After we train the model, with the facial 136 points, how can we continue the training with a different number of points, let say 60?
The only layer I would change is :

logits = tf.layers.dense( inputs=dense1, units=60, activation=None, use_bias=True, name="logits")

But the number of parameter of the network will be change. So, we cannot continue from the previous checkpoint. Who can we deal with it, programmatically?

If I try to restore the previous checkpoints (trained for the 136 facial points), to the new graph that outputs 60 points. I get the following error:
`InvalidArgumentError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [1024,60] rhs shape= [1024,136]`

How can I restore the checkpoint only for the previous layers, not for the Logits layer (that now has a different shape)?

False prediction with cnn-facial-landmark ( own dataset )

Hello Sir,
I have trained my own dataset for eyes and iris detection from scratch,
After reached more than 100000 steps , i get this error :

tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: ; No such file or directory
So i think maybe is not a influential error , i used tensorfboard to see the graph :
image

it seems good ( evolution avg loss ) .
But when i tested , i get some bad results as you can see :
iriss

Three things may causes this problem :

  • False annotation ( i annotated my dataset (300VW using OpenFace )
  • Starting from scratch ( pre-trained doesn't work , it causes problem )
  • I haven't 3D model for 40 landmarks

What can causes this false prediction?

請問一下, 運用PTS_Tool.py來畫出68個特徵點在圖片上出現問題

https://yinguobing.com/facial-landmark-localization-by-deep-learning-data-collate/
根據你這篇博文的說明,下載了pts_tool.py和face_detector.py等程式碼,執行會發生下面錯誤dnn 的fail,查了之後感覺好像是cudnn沒install, 但我已經安裝了... 不知道是何原因? 因為cv2無法run在python3之上, 所以我是用 Anaconda run Python 3.6.5解決這問題,接著就遇到dnn 錯誤的問題

fail log:
(cv3) faust@faust-GX501VIK:~/LinuxCode/image_utility$ python3.6 pts_tools.py
Traceback (most recent call last):
File "pts_tools.py", line 8, in
import face_detector as fd
File "/home/faust/LinuxCode/image_utility/face_detector.py", line 7, in
from cv2 import dnn
ImportError: cannot import name 'dnn'

Error when execute extract_face_from_ibug.py

Hello ,
I have organize my data , but when i execute extract_face_from_ibug.py i get this error :

python extract_face_from_ibug.py

PTS file numbers: 218597
0%| | 0/218597 [00:00<?, ?it/s]
Traceback (most recent call last):
File "extract_face_from_ibug.py", line 143, in
main()
File "extract_face_from_ibug.py", line 115, in main
subset_name = head.split('/')[-2]
IndexError: list index out of range

How can i solve it ?
Thanks

无法运行

UnicodeEncodeError: 'utf-8' codec can't encode character '\udcd5' in position 4491: surrogates not allowed

input_fun

Hi ....
I have a question ..
is there 50 epoch in every step ?
or there is 200000 steps in each epoch ?

CNN model for facial landmark

I would like to know the facial landmark CNN training model procedures for obtaining the model file(frozen.pb) step by step

facial

INFO:tensorflow:Using default config.
INFO:tensorflow:Using config: {'_model_dir': './train', '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_steps': None, '_save_checkpoints_secs': 600, '_session_config': allow_soft_placement: true
graph_options {
rewrite_options {
meta_optimizer_iterations: ONE
}
}
, '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_service': None, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x00000221171CD940>, '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
Traceback (most recent call last):
File "E:/drive G/CNN/cnn-facial-landmark-save_model_ok/landmark.py", line 339, in
tf.app.run()
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "E:/drive G/CNN/cnn-facial-landmark-save_model_ok/landmark.py", line 297, in main
estimator.train(input_fn=_train_input_fn, steps=100000)
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\estimator\estimator.py", line 356, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1181, in _train_model
return self._train_model_default(input_fn, hooks, saving_listeners)
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1211, in _train_model_default
features, labels, model_fn_lib.ModeKeys.TRAIN, self.config)
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1173, in _call_model_fn
raise ValueError('model_fn should return an EstimatorSpec.')
ValueError: model_fn should return an EstimatorSpec.

Process finished with exit code 1
what is the problem ???????

extract face from ibug

请问extract face from ibug跑通了但是生成的图片并没有关键点 是为什么呢 我的pts_tool文件的结果是所有图片扫描后就没有了,结果如下
Fitting failed!
Using minimal box.
opps! 394 566
我的extract face from ibug结果如下
New file saved:
C:/Users/Xuxiaojun/PycharmProjects/untitled15/223k/300vw\300vw-dataset-image_99.jpg
C:/Users/Xuxiaojun/PycharmProjects/untitled15/223k/300vw\300vw-dataset-image_99.json
All done! Total file: 135, invalid: 0, succeed: 135

Process finished with exit code 0
图片上没有关键点。
pts的data_dir DATA_DIR = "C:/Users/Xuxiaojun/PycharmProjects/untitled15/dataset/ibug"
extract face from ibug的DATA_DIR = "C:/Users/Xuxiaojun/PycharmProjects/untitled15/dataset/ibug"
两者是否需要保持一致呢?我看作者的pts的dir只是写到了dataset,并没有具体到那个数据集 但是我的不具体就会报错 而且写其他的数据集也会报错 请问一下为什么呢。麻烦大家了

freeze_graph时Output找不到问题

File "/home/linxiongcai/tensorflow-new/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/util/deprecation.py", line 318, in new_func
return func(*args, **kwargs)
File "/home/linxiongcai/tensorflow-new/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/framework/graph_util_impl.py", line 245, in convert_variables_to_constants
inference_graph = extract_sub_graph(input_graph_def, output_node_names)
File "/home/linxiongcai/tensorflow-new/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/util/deprecation.py", line 318, in new_func
return func(*args, **kwargs)
File "/home/linxiongcai/tensorflow-new/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/framework/graph_util_impl.py", line 181, in extract_sub_graph
_assert_nodes_are_present(name_to_node, dest_nodes)
File "/home/linxiongcai/tensorflow-new/tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph.runfiles/org_tensorflow/tensorflow/python/framework/graph_util_impl.py", line 137, in _assert_nodes_are_present
assert d in name_to_node, "%s is not in graph" % d
AssertionError: logits/BiasAdd:0 is not in graph

freeze_graph代码:
bazel-bin/tensorflow/python/tools/freeze_graph
--input_saved_model_dir=/home/facial_landmark/cnn-facial-landmark/cnn-facial-landmark-save_model/saved_model/1553825325
--output_graph=/home/facial_landmark/cnn-facial-landmark/cnn-facial-landmark-save_model/saved_model/1553825325/frozen.pb
--output_node_names='logits/BiasAdd:0'

Number of points for annotation

Hello ,
I want to know is there a relationship between the number of points and the convolutional neural network?
what can be the number of points that CNN-facial landmarks accept for training and for testing .
For exemple in this picture , i have 10 points : ( 5 for right iris and 5 for left iris )
image
What is the maximal number of landmarks that can i using for annotation iris region?
is it depends on you tool or on the convolutional neural network created?
Thanks

Using summary to vizualize the graph

Hello ,
I want to vizuale the model graph using summaries , for exemple every 1000 steps
How to do that ? is it possible using this by modifying code in landmark.py
Thanks

landmark_video.py

when i try to execute the ( landmark_video.py) , i get this error
Traceback (most recent call last):
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\client\session.py", line 1092, in _run
subfeed, allow_tensor=True, allow_operation=False)
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\framework\ops.py", line 3478, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\framework\ops.py", line 3520, in _as_graph_element_locked
"graph." % (repr(name), repr(op_name)))
KeyError: "The name 'input_image_tensor:0' refers to a Tensor which does not exist. The operation, 'input_image_tensor', does not exist in the graph."

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:/drive G/CNN/cnn-facial-landmark-save_model_ok/landmark_video.py", line 106, in
main()
File "E:/drive G/CNN/cnn-facial-landmark-save_model_ok/landmark_video.py", line 89, in main
landmarks = detect_marks(face_img, sess, detection_graph)
File "E:/drive G/CNN/cnn-facial-landmark-save_model_ok/landmark_video.py", line 28, in detect_marks
feed_dict={'input_image_tensor:0': image_np})
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\client\session.py", line 929, in run
run_metadata_ptr)
File "C:\Users\HP\Anaconda3\envs\ten\lib\site-packages\tensorflow\python\client\session.py", line 1095, in _run
'Cannot interpret feed_dict key as Tensor: ' + e.args[0])
TypeError: Cannot interpret feed_dict key as Tensor: The name 'input_image_tensor:0' refers to a Tensor which does not exist. The operation, 'input_image_tensor', does not exist in the graph.

what is the problem ?????

estimator.export_savedmodel 保存模型时发生错误

Traceback (most recent call last):
File "D:/pycharm/rinima/landmark.py", line 322, in
tf.app.run()
File "D:\anaconda\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "D:/pycharm/rinima/landmark.py", line 302, in main
estimator.export_savedmodel("saved_model", serving_input_receiver_fn)
File "D:\anaconda\lib\site-packages\tensorflow\python\estimator\estimator.py", line 511, in export_savedmodel
config=self.config)
File "D:\anaconda\lib\site-packages\tensorflow\python\estimator\estimator.py", line 694, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "D:/pycharm/rinima/landmark.py", line 27, in cnn_model_fn
inputs = tf.to_float(features['x'], name="input_to_float")
KeyError: 'x'

accuracy calculation

Hey....
I want to calculate the accuracy at each step
eval_metric_ops = {
"accuracy": tf.metrics.accuracy(
labels=label_tensor, predictions=logits)
}
return tf.estimator.EstimatorSpec(
mode=mode, loss=loss, eval_metric_ops=eval_metric_ops)

is this right ??
thanks alot

thanku

写的棒棒的。入门很好哈哈哈

Pythone.exe crush and not working when run python3 landmark.py

Hello Sir ,

  • Cuda 10.0
  • Cudnn 7.5
  • Graphic Card : Nvidia Geforce 840m
  • Windows 10 x64
  • Tensorflow 1.13
  • OpenCV 4.1
  • Python 3.6
    When i run this command : ( I don't if this command do training or no )

python3 landmark.py

i get this error :
image

When i debug the project with Visual Studio 2017 :

image

You say in the readme that tensorflow 1.13 may causes problem , and i should update the code , What kind of change did should i do in the source code landmark.py?
Thanks,

tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 37632 values, but the requested shape has 49152

Hello Sir,
I tried to train my own dataset for eyes detection , i have created my dataset with pts files and i have annoteted the dataset by generating .json file from pts files that i have created .
The number of points for eyes dataset is 80 ( both x and y coordinates ), after executing pts_tools.py , extract_face_from_ibug.py and generate_record.py .
I start the train by executing:

python3 landmark.py

Note : i changed the number of logits from 136 to 80
I get this error :

tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 37632 values, but the requested shape has 49152
[[{{node Reshape}}]]
[[node IteratorGetNext (defined at landmark.py:249) ]]
[[node IteratorGetNext (defined at landmark.py:249) ]]

I think that the error comes from extrac_face_from_ibug.py , in effect , Target_size in this file is 112
So :

112 * 112 * 3=37632
128 * 128 * 3=49152

I changed 128 by 112 in landmark.py ,
the training work now but i don't know that is a solution or no , also it can't be started with pre-trained model ,
Did you have any idea how to solve this?
Thanks

300W解压问题

我的300w数据集除了part1可以正常解压外,其他的都无法解压,用的7zip。
请问,你遇到过这种情况吗?

FFmpeg

请问FFmpeg必须安装在优般图系统吗 Windows系统可以吗?

Speed and accuracy of your landmark detection

First of all a great tutorial sir..it really helped me to understand landmark detection so easily..My query is how is the performance of your landmark detection model on 300W? and can you share the timing of your model in CPU? It seems in CPU its taking really more time(~200ms)..Did you check it?And did you try with the input size (64 * 64)..WIll it help the speed keeping the similar accuracy?

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.