From 07f0f32ba80ed28deb1d980638b6d7da43187561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=BA=E6=B0=B4=E7=BE=8E=E4=BA=BA=E9=B1=BC?= <522341892@qq.com> Date: Thu, 12 May 2022 05:52:43 +0000 Subject: [PATCH 1/2] update TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/src/DMSPDeblur.py. --- .../contrib/cv/DMSP_ID1290_for_Tensorflow/src/DMSPDeblur.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/src/DMSPDeblur.py b/TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/src/DMSPDeblur.py index 4052bf652..56481f471 100644 --- a/TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/src/DMSPDeblur.py +++ b/TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/src/DMSPDeblur.py @@ -53,7 +53,8 @@ def filter_image(image, kernel, mode='valid'): """ Implements color filtering (convolution using a flipped kernel) """ chs = [] for d in range(image.shape[2]): - channel = sig.convolve2d(image[:,:,d], np.flipud(np.fliplr(kernel)), mode=mode) + # channel = sig.convolve2d(image[:,:,d], np.flipud(np.fliplr(kernel)), mode=mode) + channel = sig.fftconvolve(image[:, :, d], np.flipud(np.fliplr(kernel)), mode=mode) chs.append(channel) return np.stack(chs, axis=2) @@ -61,7 +62,8 @@ def convolve_image(image, kernel, mode='valid'): """ Implements color image convolution """ chs = [] for d in range(image.shape[2]): - channel = sig.convolve2d(image[:,:,d], kernel, mode=mode) + # channel = sig.convolve2d(image[:,:,d], kernel, mode=mode) + channel = sig.fftconvolve(image[:, :, d], kernel, mode=mode) chs.append(channel) return np.stack(chs, axis=2) -- Gitee From 8514e8855a624600d26fc4fa15b941fef0ef5885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=BA=E6=B0=B4=E7=BE=8E=E4=BA=BA=E9=B1=BC?= <522341892@qq.com> Date: Thu, 12 May 2022 08:52:32 +0000 Subject: [PATCH 2/2] update TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/README.md. --- .../cv/DMSP_ID1290_for_Tensorflow/README.md | 157 ++++++++++-------- 1 file changed, 90 insertions(+), 67 deletions(-) diff --git a/TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/README.md b/TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/README.md index e72954050..d5f4366cd 100644 --- a/TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/README.md +++ b/TensorFlow/contrib/cv/DMSP_ID1290_for_Tensorflow/README.md @@ -151,86 +151,109 @@ $ python ./src/demo_DMSP.py 通过“模型训练”中的训练指令启动单卡训练 ``` -2022-02-23 22:32:03.855277: W tensorflow/core/platform/profile_utils/cpu_utils.cc:98] Failed to find bogomips in /proc/cpuinfo; cannot determine CPU frequency -2022-02-23 22:32:03.864021: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0xaaaade38ad00 initialized for platform Host (this does not guarantee that XLA will be used). Devices: -2022-02-23 22:32:03.864068: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version -============start non-blind deblurring on Berkeley segmentation dataset============== -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:37: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead. +WARNING:tensorflow:From /usr/local/Ascend/tfplugin/latest/tfplugin/python/site-packages/npu_bridge/estimator/npu/npu_optimizer.py:127: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead. -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:37: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead. +WARNING:tensorflow:From demo_DMSP.py:25: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead. -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:38: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead. +WARNING:tensorflow:From demo_DMSP.py:51: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead. -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:38: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead. +2022-03-21 23:33:35.537585: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA +2022-03-21 23:33:35.575026: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2600000000 Hz +2022-03-21 23:33:35.580988: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x559177050270 initialized for platform Host (this does not guarantee that XLA will be used). Devices: +2022-03-21 23:33:35.581050: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version +2022-03-21 23:33:35.584501: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/Ascend/ascend-toolkit/latest/fwkacllib/lib64:/usr/lib:/usr/local/python3.7.5/lib: +2022-03-21 23:33:35.584541: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303) +2022-03-21 23:33:35.584575: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (ubuntu): /proc/driver/nvidia/version does not exist +============start non-blind deblurring on Berkeley segmentation dataset============== +WARNING:tensorflow:From /home/test_user05/dmsp-tensorflow/DAE_model.py:37: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead. -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:42: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead. +WARNING:tensorflow:From /home/test_user05/dmsp-tensorflow/DAE_model.py:38: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead. -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:42: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead. +WARNING:tensorflow:From /home/test_user05/dmsp-tensorflow/DAE_model.py:42: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead. -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:7: calling Constant.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version. +WARNING:tensorflow:From /home/test_user05/dmsp-tensorflow/DAE_model.py:7: calling Constant.__init__ (from tensorflow.python.ops.init_ops) 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 /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:7: calling Constant.__init__ (from tensorflow.python.ops.init_ops) 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 /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:8: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead. - -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:8: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead. +WARNING:tensorflow:From /home/test_user05/dmsp-tensorflow/DAE_model.py:8: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead. ====================dae================ {'layer0': , 'layer1': , 'layer2': , 'layer3': , 'layer4': , 'layer5': , 'layer6': , 'layer7': , 'layer8': , 'layer9': , 'layer10': , 'layer11': , 'layer12': , 'layer13': , 'layer14': , 'layer15': , 'layer16': , 'layer17': , 'layer18': , 'layer19': , 'layer20': , 'layer21': , 'layer22': , 'layer23': , 'layer24': , 'layer25': , 'layer26': , 'layer27': , 'layer28': , 'layer29': , 'layer30': , 'layer31': , 'layer32': , 'layer33': , 'layer34': , 'layer35': , 'layer36': , 'layer37': , 'layer38': } ====================dae output========= Tensor("strided_slice_1:0", shape=(?, ?, ?, 3), dtype=float32) -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:51: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead. - -WARNING:tensorflow:From /home/ma-user/modelarts/user-job-dir/code/dmsp-tensorflow/DAE_model.py:51: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead. - -2022-02-23 22:32:14.897055: I /home/jenkins/agent/workspace/Compile_GraphEngine_Centos_ARM/tensorflow/tf_adapter/kernels/geop_npu.cc:694] The model has been compiled on the Ascend AI processor, current graph id is:1 -Initialized with PSNR: 17.78958876047073 -2022-02-23 22:32:40.320450: I /home/jenkins/agent/workspace/Compile_GraphEngine_Centos_ARM/tensorflow/tf_adapter/kernels/geop_npu.cc:694] The model has been compiled on the Ascend AI processor, current graph id is:11 -Finished psnr = 27.65 (1.5 examples/sec; 0.646 sec/batch) -Initialized with PSNR: 21.71935774044799 -Finished psnr = 29.31 (1.4 examples/sec; 0.697 sec/batch) -Initialized with PSNR: 12.418238314349477 -Finished psnr = 21.70 (1.4 examples/sec; 0.704 sec/batch) -Initialized with PSNR: 17.761670521195924 -Finished psnr = 27.69 (1.5 examples/sec; 0.672 sec/batch) -Initialized with PSNR: 23.028104067351563 -Finished psnr = 32.53 (1.4 examples/sec; 0.704 sec/batch) -Initialized with PSNR: 15.075084013742561 -Finished psnr = 27.08 (1.4 examples/sec; 0.703 sec/batch) -Initialized with PSNR: 17.302924438930848 -Finished psnr = 24.16 (1.2 examples/sec; 0.824 sec/batch) -Initialized with PSNR: 17.10059787725738 -Finished psnr = 25.20 (1.3 examples/sec; 0.751 sec/batch) -Initialized with PSNR: 16.07467978560146 -Finished psnr = 25.66 (1.4 examples/sec; 0.712 sec/batch) -Initialized with PSNR: 15.523285818788821 -Finished psnr = 25.79 (1.4 examples/sec; 0.718 sec/batch) -Initialized with PSNR: 20.173765682212093 -Finished psnr = 33.91 (1.5 examples/sec; 0.688 sec/batch) -Initialized with PSNR: 17.809478987327715 -Finished psnr = 29.48 (1.6 examples/sec; 0.640 sec/batch) -Initialized with PSNR: 18.0941733503732 -Finished psnr = 33.18 (1.4 examples/sec; 0.702 sec/batch) -Initialized with PSNR: 17.11170706335929 -Finished psnr = 24.92 (1.4 examples/sec; 0.705 sec/batch) -Initialized with PSNR: 16.409065638468267 -Finished psnr = 29.45 (1.4 examples/sec; 0.727 sec/batch) -Initialized with PSNR: 16.58872443970573 -Finished psnr = 26.77 (1.4 examples/sec; 0.702 sec/batch) -Initialized with PSNR: 16.632015946049982 -Finished psnr = 28.54 (1.2 examples/sec; 0.805 sec/batch) -Initialized with PSNR: 14.895557404412923 -Finished psnr = 25.84 (1.3 examples/sec; 0.741 sec/batch) -Initialized with PSNR: 17.557421710572992 -Finished psnr = 25.67 (1.4 examples/sec; 0.702 sec/batch) -Initialized with PSNR: 23.73822886222646 -Finished psnr = 31.20 (1.1 examples/sec; 0.895 sec/batch) -Initialized with PSNR: 14.288116614544533 -Finished psnr = 21.96 (1.4 examples/sec; 0.735 sec/batch) -Initialized with PSNR: 19.533104118880125 -Finished psnr = 28.99 (1.4 examples/sec; 0.710 sec/batch) +WARNING:tensorflow:From /home/test_user05/dmsp-tensorflow/DAE_model.py:51: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead. + +2022-03-21 23:33:35.866972: W /home/jenkins/agent/workspace/Compile_GraphEngine_Centos_X86/tensorflow/tf_adapter/util/ge_plugin.cc:124] [GePlugin] can not find Environment variable : JOB_ID +2022-03-21 23:33:39.807011: I /home/jenkins/agent/workspace/Compile_GraphEngine_Centos_X86/tensorflow/tf_adapter/kernels/geop_npu.cc:749] The model has been compiled on the Ascend AI processor, current graph id is:1 +Initialized with PSNR: 18.26756789065104 +2022-03-21 23:33:52.281454: I /home/jenkins/agent/workspace/Compile_GraphEngine_Centos_X86/tensorflow/tf_adapter/kernels/geop_npu.cc:749] The model has been compiled on the Ascend AI processor, current graph id is:11 +Finished psnr = 25.43 (20.0 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 19.61013455418367 +Finished psnr = 29.58 (20.0 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 16.046844525072277 +Finished psnr = 26.21 (19.3 examples/sec; 0.052 sec/batch) +Initialized with PSNR: 19.088294082853533 +Finished psnr = 24.01 (20.3 examples/sec; 0.049 sec/batch) +Initialized with PSNR: 27.903391840839276 +Finished psnr = 33.05 (19.9 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 17.58393445793693 +Finished psnr = 25.87 (19.3 examples/sec; 0.052 sec/batch) +Initialized with PSNR: 21.496189549703043 +Finished psnr = 27.39 (20.3 examples/sec; 0.049 sec/batch) +Initialized with PSNR: 17.183577420828943 +Finished psnr = 24.84 (19.2 examples/sec; 0.052 sec/batch) +Initialized with PSNR: 18.31449854593027 +Finished psnr = 27.68 (20.2 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 14.78985085202309 +Finished psnr = 22.40 (19.9 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 18.795507564810553 +Finished psnr = 27.73 (19.6 examples/sec; 0.051 sec/batch) +Initialized with PSNR: 16.154563492696358 +Finished psnr = 24.16 (19.9 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 19.207686742438906 +Finished psnr = 27.37 (19.9 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 18.436603775139783 +Finished psnr = 27.64 (20.2 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 23.00822262524223 +Finished psnr = 29.49 (20.7 examples/sec; 0.048 sec/batch) +Initialized with PSNR: 15.08249880666261 +Finished psnr = 23.16 (20.5 examples/sec; 0.049 sec/batch) +Initialized with PSNR: 21.944237300656955 +Finished psnr = 29.84 (19.7 examples/sec; 0.051 sec/batch) +Initialized with PSNR: 18.858999334757787 +Finished psnr = 26.01 (19.7 examples/sec; 0.051 sec/batch) +Initialized with PSNR: 27.03897411812029 +Finished psnr = 30.47 (19.6 examples/sec; 0.051 sec/batch) +Initialized with PSNR: 19.014816037693265 +Finished psnr = 25.69 (19.9 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 12.90457146806597 +Finished psnr = 21.65 (19.1 examples/sec; 0.052 sec/batch) +Initialized with PSNR: 17.119117047716557 +Finished psnr = 28.03 (19.1 examples/sec; 0.052 sec/batch) +Initialized with PSNR: 17.062774129482317 +Finished psnr = 25.44 (20.5 examples/sec; 0.049 sec/batch) +Initialized with PSNR: 19.525629211675938 +Finished psnr = 26.07 (19.6 examples/sec; 0.051 sec/batch) +Initialized with PSNR: 17.46573433130799 +Finished psnr = 24.58 (20.1 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 19.200946422804122 +Finished psnr = 30.53 (19.9 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 17.729834721734107 +Finished psnr = 25.80 (19.8 examples/sec; 0.051 sec/batch) +Initialized with PSNR: 16.386233469398405 +Finished psnr = 22.66 (18.7 examples/sec; 0.053 sec/batch) +Initialized with PSNR: 15.284389775117308 +Finished psnr = 26.16 (20.1 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 21.66147837510976 +Finished psnr = 29.72 (20.0 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 14.498257231153538 +Finished psnr = 24.46 (20.0 examples/sec; 0.050 sec/batch) +Initialized with PSNR: 16.504633083401984 +Finished psnr = 24.95 (20.3 examples/sec; 0.049 sec/batch) +Initialized with PSNR: 20.94827880438164 +Finished psnr = 27.77 (19.2 examples/sec; 0.052 sec/batch) +Initialized with PSNR: 15.26399971970905 +Finished psnr = 24.52 (20.5 examples/sec; 0.049 sec/batch) +Initialized with PSNR: 19.150046331140278 ```

精度指标

-- Gitee