那些遗忘过去的人注定要重蹈覆辙。——乔治•桑塔亚纳 
  • Authorized error

刚开始按作者 GitHub 上的指示,当运行环境配置好,并且 make 之后,因为生成的 decompose.py 是可执行文件,直接运行

bell2014/decompose.py ../../original.png

就出现了这样的错误

import: not authorized `pd' @ error/constitute.c/WriteImage/1028

看到有相关问题的解答中提到

这是python脚本,不应该把它当成shell脚本运行,当然会报错

突然反应过来,我们通常在终端直接运行的可执行文件一般由 /usr/bin/sh 来作为默认执行器

而 .py 脚本需要显式指出 python 解释器,这样就有了解决方案,直接用 python 来运行就可以了啊

python3 bell2014/decompose.py ../../original.png
  • namespacepath error
AttributeError: '_NamespacePath' object has no attribute 'sort'

该错误好像与 pip 有关,可以使用以下命令解决

sudo pip3 install --upgrade setuptools
  • numpy error

ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

造成这个问题的原因是各种库之间的版本不匹配,numpy版本不合适,只需要把numpy降级到刚好满足需要的版本,就可以了。

Python packages (newer packages will likely work, though these are the exact versions that I used):

    PIL==1.1.7
cython==0.19.2
numpy==1.8.0
scipy==0.13.2
scikit-image==0.9.3
scikit-learn==0.14.1

将所用到的库的版本均降低了一些,没有使用最高版本的,这样就解决了错误。

cv@cv:~ $ sudo pip3 uninstall numpy

cv@cv:~ $ sudo pip3 install numpy==1.8.2

目前的版本如下所示

cv@cv:~ $ python3
>>> Python 3.5.2 (default, Nov 12 2018, 13:43:14)
>>> [GCC 5.4.0 20160609] on linux
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
>>> import skimage
>>> import sklearn
>>> import PIL
>>> numpy.__version__
'1.8.2'
>>> scipy.__version__
'1.0.0'
>>> skimage.__version__
'0.9.3'
>>> sklearn.__version__
'0.19.0'
>>> PIL.__version__
'6.0.0'
  • cPickle error

在 python3 中使用如下代码会报错:

import cPickle as pk

ImportError: No module named 'cPickle'

原因: python2 有 cPickle ,但 python3 是没有的,其对应的是 pickle

解决办法:将cPickle改为pickle即可

import pickle as pk

编程时要特别注意一下版本问题,因为 python3 并不兼容 python2。

  • Unicode Decode Error

文件中语句如下

self.density = pk.load(gzip.open(data_filename, "rb"))

执行过程中一直报错

Traceback (most recent call last):
File "bell2014/decompose.py", line 125, in <module>
solver = IntrinsicSolver(input, params)
File "/home/cv/li/mycode/github/intrinsic_test/bell2014/solver.py", line 26,in __init__
self.energy = IntrinsicEnergy(self.input, params)
File "/home/cv/li/mycode/github/intrinsic_test/bell2014/energy/energy.py", line 14, in __init__
self.prob_abs_r = ProbAbsoluteReflectance(params)
File "/home/cv/li/mycode/github/intrinsic_test/bell2014/energy/prob_abs_r.py", line 16, in __init__
self._load()
File "/home/cv/li/mycode/github/intrinsic_test/bell2014/energy/prob_abs_r.py", line 66, in _load
self.density = pk.load(f)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xfe in position 0: ordinal not in range(128)

想了一下,同时 Google 查了 gzip 和 pickle 的基本使用方法

一般都是这样

# 解压gzip文件示例:
import gzip
f = gzip.open('file.txt.gz', 'rb')
file_content = f.read()
f.close() # 创建gzip文件:
import gzip
content = "Lots of content here"
f = gzip.open('file.txt.gz', 'wb')
f.write(content)
f.close() # gzip压缩现有文件:
import gzip
f_in = open('file.txt', 'rb')
f_out = gzip.open('file.txt.gz', 'wb')
f_out.writelines(f_in)
f_out.close()
f_in.close()

gzip操作

就想着试了一下,先把文件打开然后操作,操作完成再关闭

f = gzip.open(data_filename, "rb")
self.density = pk.load(f)
f.close()

果然还是不行,报同样的错误

UnicodeDecodeError: 'ascii' codec can't decode byte 0xfe in position 0: ordinal not in range(128)

看起来是解码的问题,试一下 utf-8

f = gzip.open(data_filename, "rb")
self.density = pk.load(f, encoding='utf-8')
f.close()

有点转机,错误提示改变了

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte

再试一下 iso-8859-1

f = gzip.open(data_filename, "rb")

self.density = pk.load(f, encoding='iso-8859-1')

f.close()

我的天,竟然可以了!通过了!

参考博客Python3:pickle加载文件产生UnicodeDecodeError

  • xrang error

运行某代码时,报错

NameError:name ‘xrange’ is not defined

原因:在 python 3 中, range() 与 xrange() 合并为 range( ) 。我的 python 版本为 python3.5。

解决办法:将 xrange( ) 函数全部换为 range( )

最终结果

 Input:
image_filename: ../../original.png
mask_filename: None
judgements_filename: None
parameters_filename: None
Output:
r_filename: ../../original-r.png
s_filename: ../../original-s.png
mask_nnz: 280200
rows * cols: 280200
loading reflectances...
loaded reflectances
solve...
initialization: k-means clustering with 20 centers...
clustering done (0.040790392999042524 s). intensities:
[ 6.92203607e-04 4.26960300e-01 1.24212123e-02 1.89641258e-01
5.15146685e-02 3.61099089e-02 1.32774291e-02 2.76836577e-01
8.22313432e-02 4.94125146e-02 3.46569114e-02 1.00000000e-04
3.33934676e-04 1.00000000e-04 1.38523075e-01 2.60739745e-02
2.33498816e-01 8.18735683e-02 3.37480727e-01 1.18922356e-01] run: starting iteration 0/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 75.89183091743142 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5502416119998088 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (1.1698709270003746 s)
stage1_optimize_r: done (1.83796778299984 s)
remove_unused_intensities: 17/20 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (25007 x 17, 50014 nnz)...
l1 optimization: (iter 0) mean_error: 0.848319845669
l1 optimization: (iter 10) mean_error: 0.706672318615
l1 optimization: (iter 20) mean_error: 0.702868308422
l1 optimization: (iter 22) mean_error increased: 0.702733472884 --> 0.702734513573 (exit)
stage2_smooth_s: done (0.4088439740007743 s) run: starting iteration 1/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 37.94591545871571 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.7491755259998172 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.9353584070013312 s)
stage1_optimize_r: done (1.7722134529994946 s)
remove_unused_intensities: 16/17 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (43826 x 16, 87652 nnz)...
l1 optimization: (iter 0) mean_error: 0.550938643846
l1 optimization: (iter 10) mean_error: 0.376970472637
l1 optimization: (iter 20) mean_error: 0.370139366244
l1 optimization: (iter 30) mean_error: 0.369354364487
l1 optimization: (iter 40) mean_error: 0.369244346271
l1 optimization: (iter 47) mean_error: 0.369230949421, delta_error: 8.6196241128e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.7199039520000952 s) run: starting iteration 2/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 25.29727697247714 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.6731677829993714 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.778866000000562 s)
stage1_optimize_r: done (1.537968656000885 s)
remove_unused_intensities: 15/16 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (44218 x 15, 88436 nnz)...
l1 optimization: (iter 0) mean_error: 0.540483078222
l1 optimization: (iter 10) mean_error: 0.372397125285
l1 optimization: (iter 20) mean_error: 0.366028241311
l1 optimization: (iter 30) mean_error: 0.365352926541
l1 optimization: (iter 40) mean_error: 0.365258067798
l1 optimization: (iter 46) mean_error: 0.365247445171, delta_error: 7.83756222034e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.6630497730002389 s) run: starting iteration 3/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 18.972957729357855 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.6042482350003411 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.876166440999441 s)
stage1_optimize_r: done (1.565152675999343 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (43854 x 15, 87708 nnz)...
l1 optimization: (iter 0) mean_error: 0.548123465878
l1 optimization: (iter 10) mean_error: 0.379183935982
l1 optimization: (iter 20) mean_error: 0.370830671736
l1 optimization: (iter 30) mean_error: 0.36985870122
l1 optimization: (iter 40) mean_error: 0.36973524898
l1 optimization: (iter 46) mean_error: 0.369724295589, delta_error: 8.89927681436e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.6645084909996513 s) run: starting iteration 4/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 15.178366183486284 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5825622169995768 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8731047119999857 s)
stage1_optimize_r: done (1.53111209799863 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (43004 x 15, 86008 nnz)...
l1 optimization: (iter 0) mean_error: 0.550404498789
l1 optimization: (iter 10) mean_error: 0.386131037438
l1 optimization: (iter 20) mean_error: 0.378380593721
l1 optimization: (iter 30) mean_error: 0.377523726779
l1 optimization: (iter 40) mean_error: 0.377437227894
l1 optimization: (iter 47) mean_error: 0.377422669138, delta_error: 8.53155257996e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.6746894789994258 s) run: starting iteration 5/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 12.64863848623857 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.586484137998923 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8833774769991578 s)
stage1_optimize_r: done (1.546162930000719 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (38484 x 15, 76968 nnz)...
l1 optimization: (iter 0) mean_error: 0.601459488203
l1 optimization: (iter 10) mean_error: 0.424348137709
l1 optimization: (iter 20) mean_error: 0.416596460813
l1 optimization: (iter 30) mean_error: 0.415852904128
l1 optimization: (iter 40) mean_error: 0.415766428415
l1 optimization: (iter 42) mean_error: 0.415762909767, delta_error: 7.39926142357e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5937881139998353 s) run: starting iteration 6/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 10.84169013106163 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5921503869994922 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8720934989996749 s)
stage1_optimize_r: done (1.5388636010011396 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (37601 x 15, 75202 nnz)...
l1 optimization: (iter 0) mean_error: 0.619964978736
l1 optimization: (iter 10) mean_error: 0.433095199442
l1 optimization: (iter 20) mean_error: 0.426054271345
l1 optimization: (iter 30) mean_error: 0.425190827702
l1 optimization: (iter 40) mean_error: 0.425058632191
l1 optimization: (iter 48) mean_error: 0.425038841506, delta_error: 9.60581080511e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.6509161739995761 s) run: starting iteration 7/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 9.486478864678928 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5920468869990145 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8754881279983238 s)
stage1_optimize_r: done (1.544129306999821 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (36755 x 15, 73510 nnz)...
l1 optimization: (iter 0) mean_error: 0.627910150615
l1 optimization: (iter 10) mean_error: 0.43875294303
l1 optimization: (iter 20) mean_error: 0.431762743505
l1 optimization: (iter 30) mean_error: 0.431104294517
l1 optimization: (iter 40) mean_error: 0.431007532326
l1 optimization: (iter 46) mean_error: 0.430995949755, delta_error: 8.77516629028e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.6091458529990632 s) run: starting iteration 8/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 8.43242565749238 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5855570280000393 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8547230149997631 s)
stage1_optimize_r: done (1.515983179999239 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (33610 x 15, 67220 nnz)...
l1 optimization: (iter 0) mean_error: 0.665736118836
l1 optimization: (iter 10) mean_error: 0.470680514058
l1 optimization: (iter 20) mean_error: 0.461393751811
l1 optimization: (iter 30) mean_error: 0.46026093385
l1 optimization: (iter 40) mean_error: 0.46008151787
l1 optimization: (iter 50) mean_error: 0.46006048483
l1 optimization: (iter 50) mean_error: 0.46006048483, delta_error: 7.13663690532e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.6291282800011686 s) run: starting iteration 9/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 7.589183091743142 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5784938489996421 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8727145949997066 s)
stage1_optimize_r: done (1.5304242220008746 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (31189 x 15, 62378 nnz)...
l1 optimization: (iter 0) mean_error: 0.709556319409
l1 optimization: (iter 10) mean_error: 0.500595527149
l1 optimization: (iter 20) mean_error: 0.492321439986
l1 optimization: (iter 30) mean_error: 0.491430305891
l1 optimization: (iter 40) mean_error: 0.491332338391
l1 optimization: (iter 49) mean_error: 0.491316172339, delta_error: 7.75992434643e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5869300369995472 s) run: starting iteration 10/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 6.899257356130129 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.6024649629998748 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8745310489994154 s)
stage1_optimize_r: done (1.5556861759996536 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (29766 x 15, 59532 nnz)...
l1 optimization: (iter 0) mean_error: 0.735994109185
l1 optimization: (iter 10) mean_error: 0.526304734392
l1 optimization: (iter 20) mean_error: 0.515772788891
l1 optimization: (iter 30) mean_error: 0.514534596355
l1 optimization: (iter 36) mean_error increased: 0.514402404439 --> 0.514416410605 (exit)
stage2_smooth_s: done (0.5050967379993381 s) run: starting iteration 11/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 6.324319243119285 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5678862309996475 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8836220150005829 s)
stage1_optimize_r: done (1.527260953998848 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (29535 x 15, 59070 nnz)...
l1 optimization: (iter 0) mean_error: 0.741882340631
l1 optimization: (iter 10) mean_error: 0.530476714165
l1 optimization: (iter 20) mean_error: 0.522208230328
l1 optimization: (iter 30) mean_error: 0.521135630436
l1 optimization: (iter 40) mean_error: 0.520994358485
l1 optimization: (iter 47) mean_error: 0.520979465156, delta_error: 8.24535989374e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5645751089996338 s) run: starting iteration 12/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 5.837833147494725 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5735502790012106 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.9114546349992452 s)
stage1_optimize_r: done (1.5603041840004153 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (29307 x 15, 58614 nnz)...
l1 optimization: (iter 0) mean_error: 0.746392356218
l1 optimization: (iter 10) mean_error: 0.537803689155
l1 optimization: (iter 20) mean_error: 0.527371253087
l1 optimization: (iter 30) mean_error: 0.526434112731
l1 optimization: (iter 40) mean_error: 0.526316320673
l1 optimization: (iter 46) mean_error: 0.526305673425, delta_error: 9.59256531319e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5614078930011601 s) run: starting iteration 13/25 [214/7610]
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 5.420845065530815 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5659318560010433 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8842907340003876 s)
stage1_optimize_r: done (1.5257483599998523 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (27972 x 15, 55944 nnz)...
l1 optimization: (iter 0) mean_error: 0.773853801604
l1 optimization: (iter 10) mean_error: 0.559586556523
l1 optimization: (iter 20) mean_error: 0.549398153147
l1 optimization: (iter 30) mean_error: 0.547986199579
l1 optimization: (iter 35) mean_error increased: 0.547894372781 --> 0.547896035881 (exit)
stage2_smooth_s: done (0.47925809000116715 s) run: starting iteration 14/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 5.059455394495428 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5734855059999973 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.9105934059989522 s)
stage1_optimize_r: done (1.561003109000012 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (27467 x 15, 54934 nnz)...
l1 optimization: (iter 0) mean_error: 0.783897527628
l1 optimization: (iter 10) mean_error: 0.566821847196
l1 optimization: (iter 20) mean_error: 0.557159197805
l1 optimization: (iter 30) mean_error: 0.55564332358
l1 optimization: (iter 40) mean_error: 0.55537877309
l1 optimization: (iter 50) mean_error: 0.55533702513
l1 optimization: (iter 54) mean_error: 0.555333196652, delta_error: 1.07781230607e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5889139669998258 s) run: starting iteration 15/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 4.743239432339464 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5652168649994564 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.9014703690008901 s)
stage1_optimize_r: done (1.547290978998717 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (27116 x 15, 54232 nnz)...
l1 optimization: (iter 0) mean_error: 0.791842473657
l1 optimization: (iter 10) mean_error: 0.573400876961
l1 optimization: (iter 20) mean_error: 0.563325144168
l1 optimization: (iter 30) mean_error: 0.562210411814
l1 optimization: (iter 35) mean_error increased: 0.562123003338 --> 0.562123113041 (exit)
stage2_smooth_s: done (0.47673624800154357 s) run: starting iteration 16/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 4.464225348084201 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5694691879998572 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8925902729988593 s)
stage1_optimize_r: done (1.5394175100009306 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (26079 x 15, 52158 nnz)...
l1 optimization: (iter 0) mean_error: 0.814814990158
l1 optimization: (iter 10) mean_error: 0.589985840271
l1 optimization: (iter 20) mean_error: 0.580643986305
l1 optimization: (iter 30) mean_error: 0.579654937015
l1 optimization: (iter 40) mean_error: 0.579545343555
l1 optimization: (iter 50) mean_error: 0.579523484835
l1 optimization: (iter 51) mean_error: 0.579523131158, delta_error: 3.53676597342e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5542264689993317 s) run: starting iteration 17/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 4.21621282874619 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5775087729998631 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8994289300007949 s)
stage1_optimize_r: done (1.5562123859999701 s)
remove_unused_intensities: 15/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (26468 x 15, 52936 nnz)...
l1 optimization: (iter 0) mean_error: 0.806100123463
l1 optimization: (iter 10) mean_error: 0.584476665487
l1 optimization: (iter 20) mean_error: 0.574978404455
l1 optimization: (iter 30) mean_error: 0.574059125645
l1 optimization: (iter 40) mean_error: 0.573946381544
l1 optimization: (iter 48) mean_error: 0.573934056462, delta_error: 7.93614210903e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5404784649999783 s) run: starting iteration 18/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 3.9943068903911274 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5776914130001387 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8881214180000825 s)
stage1_optimize_r: done (1.5512798629988538 s)
remove_unused_intensities: 14/15 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (26755 x 14, 53510 nnz)...
l1 optimization: (iter 0) mean_error: 0.800227144263
l1 optimization: (iter 10) mean_error: 0.580760011161
l1 optimization: (iter 20) mean_error: 0.571072338112
l1 optimization: (iter 30) mean_error: 0.570175604626
l1 optimization: (iter 40) mean_error: 0.57003969275
l1 optimization: (iter 48) mean_error: 0.570021159545, delta_error: 6.59219483889e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5348999540001387 s) run: starting iteration 19/25
compute_unary_costs...
blur sigma: 3.794591545871571 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5321224870003789 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8216276469993318 s)
stage1_optimize_r: done (1.4295585580002808 s)
remove_unused_intensities: 14/14 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (25760 x 14, 51520 nnz)...
l1 optimization: (iter 0) mean_error: 0.823102834924
l1 optimization: (iter 10) mean_error: 0.598165207553
l1 optimization: (iter 20) mean_error: 0.58779100678
l1 optimization: (iter 30) mean_error: 0.586455670291
l1 optimization: (iter 40) mean_error: 0.586311308971
l1 optimization: (iter 48) mean_error: 0.586294653467, delta_error: 9.07397276428e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5258193869995011 s) run: starting iteration 20/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 3.613896710353877 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.5337906789991393 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.8146714840004279 s)
stage1_optimize_r: done (1.423714012000346 s)
remove_unused_intensities: 13/14 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (27844 x 13, 55688 nnz)...
l1 optimization: (iter 0) mean_error: 0.7763068581
l1 optimization: (iter 10) mean_error: 0.56457658627
l1 optimization: (iter 20) mean_error: 0.554611154765
l1 optimization: (iter 30) mean_error: 0.553539496221
l1 optimization: (iter 40) mean_error: 0.553407694958
l1 optimization: (iter 49) mean_error: 0.553388498944, delta_error: 5.71098693003e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.535263923000457 s) run: starting iteration 21/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 3.4496286780650647 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.4950314950001484 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.7790628120001202 s)
stage1_optimize_r: done (1.3543717560005462 s)
remove_unused_intensities: 12/13 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (27464 x 12, 54928 nnz)...
l1 optimization: (iter 0) mean_error: 0.783821193892
l1 optimization: (iter 10) mean_error: 0.567872874384
l1 optimization: (iter 20) mean_error: 0.559774390113
l1 optimization: (iter 30) mean_error: 0.558840502984
l1 optimization: (iter 40) mean_error: 0.55872708717
l1 optimization: (iter 47) mean_error: 0.558709929732, delta_error: 8.11216353647e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5060469210002339 s) run: starting iteration 22/25
stage1_optimize_r: compute costs...
compute_unary_costs... [32/7610]
blur sigma: 3.2996448224970183 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.4522810700000264 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.6781864069998846 s)
stage1_optimize_r: done (1.2041443830003118 s)
remove_unused_intensities: 12/12 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (26613 x 12, 53226 nnz)...
l1 optimization: (iter 0) mean_error: 0.803313082765
l1 optimization: (iter 10) mean_error: 0.585454389126
l1 optimization: (iter 20) mean_error: 0.572935523084
l1 optimization: (iter 30) mean_error: 0.571668572036
l1 optimization: (iter 40) mean_error: 0.571550105523
l1 optimization: (iter 50) mean_error: 0.57152486767
l1 optimization: (iter 51) mean_error: 0.571524126167, delta_error: 7.41502855561e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.515380897999421 s) run: starting iteration 23/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 3.1621596215596424 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.4568941420002375 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.6868505080001341 s)
stage1_optimize_r: done (1.2174359950004146 s)
remove_unused_intensities: 12/12 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (28014 x 12, 56028 nnz)...
l1 optimization: (iter 0) mean_error: 0.773720996995
l1 optimization: (iter 10) mean_error: 0.56187904257
l1 optimization: (iter 20) mean_error: 0.550965017396
l1 optimization: (iter 30) mean_error: 0.549877522487
l1 optimization: (iter 40) mean_error: 0.549742202569
l1 optimization: (iter 47) mean_error: 0.549728343696, delta_error: 9.56516332029e-07 < 1e-06 (exit)
stage2_smooth_s: done (0.5140209019991744 s) run: starting iteration 24/25
stage1_optimize_r: compute costs...
compute_unary_costs...
blur sigma: 3.035673236697257 pixels (image diagonal: 758.9183091743142 pixels)
compute_unary_costs: done (0.46191501500106824 s)
stage1_optimize_r: optimizing dense crf (10 iters)...
stage1_optimize_r: dense crf done (0.6868947450002452 s)
stage1_optimize_r: done (1.2291630130002886 s)
remove_unused_intensities: 12/12 labels kept
split_label_clusters: 12 --> 5912
remove_unused_intensities: 5912/5912 labels kept
stage2_smooth_s: constructing linear system...
solving linear system...
solving sparse linear system (27519 x 5912, 55038 nnz)...
l1 optimization: (iter 0) mean_error: 0.211440063628
l1 optimization: (iter 10) mean_error: 0.203399581531
l1 optimization: (iter 20) mean_error: 0.203242222921
l1 optimization: (iter 24) mean_error: 0.203233986913, delta_error: 7.34804542463e-07 < 1e-06 (exit)
stage2_smooth_s: done (8.013847729998815 s)
solve (61.8871597870002 s)

Output

效果示意,其中第一幅图是输入的原图original.png,第二幅图是生成的反射图像original-r.png,第三幅图是生成的光照图像original-s.png,看结果还是十分可观的。

    

调试seanbell/intrinsic遇到的坑的更多相关文章

  1. 使用VirtualBox调试项目踩过的坑

    当我们完成项目后 通常需要做其他系统的测试 例如win10下测试完成后要在win7中测试 这时,安装一个虚拟机是较为明智的选择 本文将讲述在使用虚拟机测试Unity发布的exe(所有的3D文件都适用) ...

  2. 配置使用sourcemap调试vue源码爬坑

    环境: Google Chrome  V72.0.3626.109 vue-dev V 2.6.10 爬坑的乐趣就不说了(我恨啊),以下说一下出坑要点 1. 在vue-dev的package.json ...

  3. [PHP-Debug] 使用 php -l 调试 PHP 错误遇到的坑

    有时候,因为系统代码的增加,造成很多文件的相互关联,又或者某些第三接口(微信等),你必须要在线上调试. 线上环境,我们都是设置 “ini_set('display_errors' , false)” ...

  4. 【支付宝SDK】沙箱调试,以及遇到的坑

    from rest_framework.views import APIView from alipay import AliPay, DCAliPay, ISVAliPay from django. ...

  5. Uncaught RangeError: Maximum call stack size exceeded 调试日记

    异常处理汇总-前端系列 http://www.cnblogs.com/dunitian/p/4523015.html 开发道路上不是解决问题最重要,而是解决问题的过程,这个过程我们称之为~~~调试 记 ...

  6. Android开发-mac上使用三星S3做真机调试

    之前一直未使用真机进行Android开发,为准备明天的培训,拿出淘汰下来的s3准备环境,竟然发现无法连接mac,度娘一番找到答案,如下:mac 系统开发android,真机调试解决方案(无数的坑之后吐 ...

  7. Windows 10 IoT Core环境配置中的那些坑

    我使用的设备是Raspberry Pi 3B,想来国内的嵌入式玩具应该还是树莓派最常见吧.这段时间一直在捣鼓Win10 IoT,结果发现,从安装一直到编码调试一路下来全都是坑.写这篇东西一个是为了备忘 ...

  8. 使用xcode 8 调试ios10

    这几天更新了ios10,发现真机不能调试,弹出几个错,表示没有证书.用ios9的真机能调试, 真他么坑,总结一下解决方法. 在BuildSetting 的Signing中Code Signing Id ...

  9. 安卓开发,adb shell 调试sqlite3数据库

    安卓开发,adb shell 调试sqlite3数据库 在安卓中创建了sqlite3数据库,想要调试怎么办? 通过adb shell来进行查看. 第一步,将adb加入到系统变量中. 这样就可以在命令行 ...

随机推荐

  1. 【Web技术】400- 浅谈Shadow DOM

    编者按:本文作者:刘观宇,360 奇舞团高级前端工程师.技术经理,W3C CSS 工作组成员. 为什么会有Shadow DOM 你在实际的开发中很可能遇到过这样的需求:实现一个可以拖拽的滑块,以实现范 ...

  2. 【H5】344- 微信 H5 页面兼容性解决方案

    点击上方"前端自习课"关注,学习起来~ 最近给公司微信公众号,写了微信h5业务页面,总结分享一下前端开发过程中的几个兼容性坑,项目直接拿的公司页面,所以下文涉及图片都模糊处理了. ...

  3. 【JS】304- KOA2框架原理解析和实现

    ); , () => {     ); 实现koa的第一步就是对以上的这个过程进行封装,为此我们需要创建application.js实现一个Application类的构造函数: ); , () ...

  4. 使用脚本安装 Docker

    使用脚本安装 Docker 1.使用 sudo 或 root 权限登录 Centos. 2.确保 yum 包更新到最新. $ sudo yum update 3.执行 Docker 安装脚本. $ c ...

  5. ansible部署apache

    Ansible 配置Apache(加粗的字体是要执行的命令) 配置免密登录 [root@localhost ansible]# vim /etc/ansible/hosts //用来配置目标主机 加入 ...

  6. GHOST CMS -上下文概述 Context Overview

    Context Overview上下文概述 Each page in a Ghost theme belongs to a context, which determines which templa ...

  7. Java 匿名类和lambda表达式

    一.匿名内部类 一个匿名内部类是一个没有名字的内部类.它将进一步定义一个内部类以及创建一个内部类的实例. 内部类处理器可以使用匿名内部类进行代码简化. 匿名内部类的语法如下所示: new SuperC ...

  8. 微信小程序目录结构与配置介绍

    一.小程序结构目录 小程序框架提供了自己的视图层描述语言 WXML 和 WXSS,以及 JavaScript,并在视图层与逻辑层间提供了数据传输和事件系统,让开发者能够专注于数据与逻辑. 官网 1.1 ...

  9. 在Windows10中安装与配置Nginx

    一.使用环境: Windows 10 1909 nginx 1.16.1 二.安装与配置: 1. 打开链接,http://nginx.org/en/download.html 下载稳定版本nginx ...

  10. HA: Infinity Stones Vulnhub Walkthrough

    下载地址: https://www.vulnhub.com/entry/ha-infinity-stones,366/ 主机扫描: 目录枚举 我们按照密码规则生成字典:gam,%%@@2012 cru ...