dongwu92 / AutoPortraitMatting

Tensorflow implementation of Automatic Portrait Matting on paper "Automatic Portrait Segmentation for Image Stylization"
Apache License 2.0
478 stars 151 forks source link

请问先运行完FCN.py成功,再运行FCN_plus.py报错,怎么解决?I can run the FCN.py successfully,but I have a problem in running the FCN_plus.py.Asking for help,thanks #60

Open fanshuaidi opened 3 years ago

fanshuaidi commented 3 years ago

E:\anaconda3\python.exe "G:/Document/Graduation_ project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCNplus.py" WARNING:tensorflow:From G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py:237: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

setting up vgg initialized conv layers ... WARNING:tensorflow:From G:/Document/Graduation_ project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py:88: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:From G:\Document\Graduation_ project\AutoPortraitMatting-master\AutoPortraitMatting-master\TensorflowUtils_plus.py:65: calling Constant.init (from tensorflow.python.ops.initops) with dtype is deprecated and will be removed in a future version. Instructions for updating: Call initializer instance with the dtype argument instead of passing it to the constructor WARNING:tensorflow:From G:\Document\Graduation project\AutoPortraitMatting-master\AutoPortraitMatting-master\TensorflowUtils_plus.py:66: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead.

WARNING:tensorflow:From G:\Document\Graduation_ project\AutoPortraitMatting-master\AutoPortraitMatting-master\TensorflowUtils_plus.py:127: The name tf.nn.avg_pool is deprecated. Please use tf.nn.avg_pool2d instead.

OMP: Info #204: KMP_AFFINITY: decoding x2APIC ids. OMP: Info #202: KMP_AFFINITY: Affinity capable, using global cpuid leaf 11 info OMP: Info #154: KMP_AFFINITY: Initial OS proc set respected: {0,1,2,3,4,5,6,7} OMP: Info #156: KMP_AFFINITY: 8 available OS procs OMP: Info #157: KMP_AFFINITY: Uniform topology OMP: Info #179: KMP_AFFINITY: 1 packages x 4 cores/pkg x 2 threads/core (4 total cores) OMP: Info #206: KMP_AFFINITY: OS proc to physical thread map: OMP: Info #171: KMP_AFFINITY: OS proc 0 maps to package 0 core 0 thread 0 OMP: Info #171: KMP_AFFINITY: OS proc 1 maps to package 0 core 0 thread 1 OMP: Info #171: KMP_AFFINITY: OS proc 2 maps to package 0 core 1 thread 0 OMP: Info #171: KMP_AFFINITY: OS proc 3 maps to package 0 core 1 thread 1 OMP: Info #171: KMP_AFFINITY: OS proc 4 maps to package 0 core 2 thread 0 OMP: Info #171: KMP_AFFINITY: OS proc 5 maps to package 0 core 2 thread 1 OMP: Info #171: KMP_AFFINITY: OS proc 6 maps to package 0 core 3 thread 0 OMP: Info #171: KMP_AFFINITY: OS proc 7 maps to package 0 core 3 thread 1 OMP: Info #242: KMP_AFFINITY: pid 3784 thread 0 bound to OS proc set {0} OMP: Info #242: KMP_AFFINITY: pid 3784 thread 3 bound to OS proc set {6} OMP: Info #242: KMP_AFFINITY: pid 3784 thread 1 bound to OS proc set {2} OMP: Info #242: KMPAFFINITY: pid 3784 thread 2 bound to OS proc set {4} WARNING:tensorflow:From G:\Document\Graduation project\AutoPortraitMatting-master\AutoPortraitMatting-master\TensorflowUtils_plus.py:123: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

WARNING:tensorflow:From G:\Document\Graduation_ project\AutoPortraitMatting-master\AutoPortraitMatting-master\TensorflowUtils_plus.py:75: The name tf.truncated_normal is deprecated. Please use tf.random.truncated_normal instead.

WARNING:tensorflow:From G:/Document/Graduation_ project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py:100: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob. WARNING:tensorflow:From G:/Document/Graduation_ project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py:134: calling argmax (from tensorflow.python.ops.math_ops) with dimension is deprecated and will be removed in a future version. Instructions for updating: Use the axis argument instead WARNING:tensorflow:From E:\anaconda3\lib\site-packages\tensorflow\python\util\dispatch.py:180: calling expand_dims (from tensorflow.python.ops.arrayops) with dim is deprecated and will be removed in a future version. Instructions for updating: Use the axis argument instead WARNING:tensorflow:From G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py:244: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

2021-02-25 00:05:06.079382: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations: AVX AVX2 To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags. 2021-02-25 00:05:06.081405: I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with default inter op setting: 8. Tune using inter_op_parallelismthreads for best performance. WARNING:tensorflow:From G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py:247: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.

WARNING:tensorflow:From E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version. Instructions for updating: Use standard file APIs to check for files with this prefix. Traceback (most recent call last): File "E:\anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call return fn(*args) File "E:\anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "E:\anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [3,3,6,64] rhs shape= [3,3,3,64] [[{{node save/Assign_13}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 1286, in restore {self.saver_def.filename_tensor_name: save_path}) File "E:\anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 950, in run run_metadata_ptr) File "E:\anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run feed_dict_tensor, options, run_metadata) File "E:\anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run run_metadata) File "E:\anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1370, 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= [3,3,6,64] rhs shape= [3,3,3,64] [[node save/Assign13 (defined at G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py:247) ]]

Errors may have originated from an input operation. Input Source operations connected to node save/Assign_13: inference/conv1_1w (defined at G:\Document\Graduation project\AutoPortraitMatting-master\AutoPortraitMatting-master\TensorflowUtils_plus.py:66)

Original stack trace for 'save/Assign13': File "G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCNplus.py", line 296, in pred() File "G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py", line 247, in pred saver = tf.train.Saver() File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 825, in init self.build() File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 837, in build self._build(self._filename, build_save=True, build_restore=True) File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 875, in _build build_restore=build_restore) File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 508, in _build_internal restore_sequentially, reshape) File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 350, in _AddRestoreOps assign_ops.append(saveable.restore(saveable_tensors, shapes)) File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saving\saveable_object_util.py", line 72, in restore self.op.get_shape().is_fully_defined()) File "E:\anaconda3\lib\site-packages\tensorflow\python\ops\state_ops.py", line 227, in assign validate_shape=validate_shape) File "E:\anaconda3\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 65, in assign use_locking=use_locking, name=name) File "E:\anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "E:\anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func return func(*args, **kwargs) File "E:\anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op op_def=op_def) File "E:\anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in init self._traceback = tf_stack.extract_stack()

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "G:/Document/Graduation_ project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCNplus.py", line 296, in pred() File "G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py", line 249, in pred saver.restore(sess, ckpt.model_checkpoint_path) File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 1322, in restore err, "a mismatch between the current graph and the graph") tensorflow.python.framework.errors_impl.InvalidArgumentError: 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= [3,3,6,64] rhs shape= [3,3,3,64] [[node save/Assign13 (defined at G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py:247) ]]

Errors may have originated from an input operation. Input Source operations connected to node save/Assign_13: inference/conv1_1w (defined at G:\Document\Graduation project\AutoPortraitMatting-master\AutoPortraitMatting-master\TensorflowUtils_plus.py:66)

Original stack trace for 'save/Assign13': File "G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCNplus.py", line 296, in pred() File "G:/Document/Graduation project/AutoPortraitMatting-master/AutoPortraitMatting-master/FCN_plus.py", line 247, in pred saver = tf.train.Saver() File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 825, in init self.build() File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 837, in build self._build(self._filename, build_save=True, build_restore=True) File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 875, in _build build_restore=build_restore) File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 508, in _build_internal restore_sequentially, reshape) File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saver.py", line 350, in _AddRestoreOps assign_ops.append(saveable.restore(saveable_tensors, shapes)) File "E:\anaconda3\lib\site-packages\tensorflow\python\training\saving\saveable_object_util.py", line 72, in restore self.op.get_shape().is_fully_defined()) File "E:\anaconda3\lib\site-packages\tensorflow\python\ops\state_ops.py", line 227, in assign validate_shape=validate_shape) File "E:\anaconda3\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 65, in assign use_locking=use_locking, name=name) File "E:\anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "E:\anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func return func(*args, **kwargs) File "E:\anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op op_def=op_def) File "E:\anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in init self._traceback = tf_stack.extract_stack()

进程已结束,退出代码 1

fanshuaidi commented 3 years ago

是tf的版本问题吗,但看起来报错是model不匹配

lrjj commented 3 years ago

May I ask if you have downloaded the data set of your data folder successfully? I cannot download it through Matlab, could you share it?