• 调试seanbell/intrinsic遇到的坑


    那些遗忘过去的人注定要重蹈覆辙。——乔治•桑塔亚纳 
    • 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( ) 

    最终结果

      1 Input:
      2   image_filename: ../../original.png
      3   mask_filename: None
      4   judgements_filename: None
      5   parameters_filename: None
      6 Output:
      7   r_filename: ../../original-r.png
      8   s_filename: ../../original-s.png
      9 mask_nnz: 280200
     10 rows * cols: 280200
     11 loading reflectances...
     12 loaded reflectances
     13 solve...
     14 initialization: k-means clustering with 20 centers...
     15 clustering done (0.040790392999042524 s).  intensities:
     16 [  6.92203607e-04   4.26960300e-01   1.24212123e-02   1.89641258e-01
     17    5.15146685e-02   3.61099089e-02   1.32774291e-02   2.76836577e-01
     18    8.22313432e-02   4.94125146e-02   3.46569114e-02   1.00000000e-04
     19    3.33934676e-04   1.00000000e-04   1.38523075e-01   2.60739745e-02
     20    2.33498816e-01   8.18735683e-02   3.37480727e-01   1.18922356e-01]
     21 
     22 run: starting iteration 0/25
     23 stage1_optimize_r: compute costs...
     24 compute_unary_costs...
     25 blur sigma: 75.89183091743142 pixels (image diagonal: 758.9183091743142 pixels)
     26 compute_unary_costs: done (0.5502416119998088 s)
     27 stage1_optimize_r: optimizing dense crf (10 iters)...
     28 stage1_optimize_r: dense crf done (1.1698709270003746 s)
     29 stage1_optimize_r: done (1.83796778299984 s)
     30 remove_unused_intensities: 17/20 labels kept
     31 stage2_smooth_s: constructing linear system...
     32 solving linear system...
     33 solving sparse linear system (25007 x 17, 50014 nnz)...
     34 l1 optimization: (iter 0) mean_error: 0.848319845669
     35 l1 optimization: (iter 10) mean_error: 0.706672318615
     36 l1 optimization: (iter 20) mean_error: 0.702868308422
     37 l1 optimization: (iter 22) mean_error increased: 0.702733472884 --> 0.702734513573 (exit)
     38 stage2_smooth_s: done (0.4088439740007743 s)
     39 
     40 run: starting iteration 1/25
     41 stage1_optimize_r: compute costs...
     42 compute_unary_costs...
     43 blur sigma: 37.94591545871571 pixels (image diagonal: 758.9183091743142 pixels)
     44 compute_unary_costs: done (0.7491755259998172 s)
     45 stage1_optimize_r: optimizing dense crf (10 iters)...
     46 stage1_optimize_r: dense crf done (0.9353584070013312 s)
     47 stage1_optimize_r: done (1.7722134529994946 s)
     48 remove_unused_intensities: 16/17 labels kept
     49 stage2_smooth_s: constructing linear system...
     50 solving linear system...
     51 solving sparse linear system (43826 x 16, 87652 nnz)...
     52 l1 optimization: (iter 0) mean_error: 0.550938643846
     53 l1 optimization: (iter 10) mean_error: 0.376970472637
     54 l1 optimization: (iter 20) mean_error: 0.370139366244
     55 l1 optimization: (iter 30) mean_error: 0.369354364487
     56 l1 optimization: (iter 40) mean_error: 0.369244346271
     57 l1 optimization: (iter 47) mean_error: 0.369230949421, delta_error: 8.6196241128e-07 < 1e-06 (exit)
     58 stage2_smooth_s: done (0.7199039520000952 s)
     59 
     60 run: starting iteration 2/25
     61 stage1_optimize_r: compute costs...
     62 compute_unary_costs...
     63 blur sigma: 25.29727697247714 pixels (image diagonal: 758.9183091743142 pixels)
     64 compute_unary_costs: done (0.6731677829993714 s)
     65 stage1_optimize_r: optimizing dense crf (10 iters)...
     66 stage1_optimize_r: dense crf done (0.778866000000562 s)
     67 stage1_optimize_r: done (1.537968656000885 s)
     68 remove_unused_intensities: 15/16 labels kept
     69 stage2_smooth_s: constructing linear system...
     70 solving linear system...
     71 solving sparse linear system (44218 x 15, 88436 nnz)...
     72 l1 optimization: (iter 0) mean_error: 0.540483078222
     73 l1 optimization: (iter 10) mean_error: 0.372397125285
     74 l1 optimization: (iter 20) mean_error: 0.366028241311
     75 l1 optimization: (iter 30) mean_error: 0.365352926541
     76 l1 optimization: (iter 40) mean_error: 0.365258067798
     77 l1 optimization: (iter 46) mean_error: 0.365247445171, delta_error: 7.83756222034e-07 < 1e-06 (exit)
     78 stage2_smooth_s: done (0.6630497730002389 s)
     79 
     80 run: starting iteration 3/25
     81 stage1_optimize_r: compute costs...
     82 compute_unary_costs...
     83 blur sigma: 18.972957729357855 pixels (image diagonal: 758.9183091743142 pixels)
     84 compute_unary_costs: done (0.6042482350003411 s)
     85 stage1_optimize_r: optimizing dense crf (10 iters)...
     86 stage1_optimize_r: dense crf done (0.876166440999441 s)
     87 stage1_optimize_r: done (1.565152675999343 s)
     88 remove_unused_intensities: 15/15 labels kept
     89 stage2_smooth_s: constructing linear system...
     90 solving linear system...
     91 solving sparse linear system (43854 x 15, 87708 nnz)...
     92 l1 optimization: (iter 0) mean_error: 0.548123465878
     93 l1 optimization: (iter 10) mean_error: 0.379183935982
     94 l1 optimization: (iter 20) mean_error: 0.370830671736
     95 l1 optimization: (iter 30) mean_error: 0.36985870122
     96 l1 optimization: (iter 40) mean_error: 0.36973524898
     97 l1 optimization: (iter 46) mean_error: 0.369724295589, delta_error: 8.89927681436e-07 < 1e-06 (exit)
     98 stage2_smooth_s: done (0.6645084909996513 s)
     99 
    100 run: starting iteration 4/25
    101 stage1_optimize_r: compute costs...
    102 compute_unary_costs...
    103 blur sigma: 15.178366183486284 pixels (image diagonal: 758.9183091743142 pixels)
    104 compute_unary_costs: done (0.5825622169995768 s)
    105 stage1_optimize_r: optimizing dense crf (10 iters)...
    106 stage1_optimize_r: dense crf done (0.8731047119999857 s)
    107 stage1_optimize_r: done (1.53111209799863 s)
    108 remove_unused_intensities: 15/15 labels kept
    109 stage2_smooth_s: constructing linear system...
    110 solving linear system...
    111 solving sparse linear system (43004 x 15, 86008 nnz)...
    112 l1 optimization: (iter 0) mean_error: 0.550404498789
    113 l1 optimization: (iter 10) mean_error: 0.386131037438
    114 l1 optimization: (iter 20) mean_error: 0.378380593721
    115 l1 optimization: (iter 30) mean_error: 0.377523726779
    116 l1 optimization: (iter 40) mean_error: 0.377437227894
    117 l1 optimization: (iter 47) mean_error: 0.377422669138, delta_error: 8.53155257996e-07 < 1e-06 (exit)
    118 stage2_smooth_s: done (0.6746894789994258 s)
    119 
    120 run: starting iteration 5/25
    121 stage1_optimize_r: compute costs...
    122 compute_unary_costs...
    123 blur sigma: 12.64863848623857 pixels (image diagonal: 758.9183091743142 pixels)
    124 compute_unary_costs: done (0.586484137998923 s)
    125 stage1_optimize_r: optimizing dense crf (10 iters)...
    126 stage1_optimize_r: dense crf done (0.8833774769991578 s)
    127 stage1_optimize_r: done (1.546162930000719 s)
    128 remove_unused_intensities: 15/15 labels kept
    129 stage2_smooth_s: constructing linear system...
    130 solving linear system...
    131 solving sparse linear system (38484 x 15, 76968 nnz)...
    132 l1 optimization: (iter 0) mean_error: 0.601459488203
    133 l1 optimization: (iter 10) mean_error: 0.424348137709
    134 l1 optimization: (iter 20) mean_error: 0.416596460813
    135 l1 optimization: (iter 30) mean_error: 0.415852904128
    136 l1 optimization: (iter 40) mean_error: 0.415766428415
    137 l1 optimization: (iter 42) mean_error: 0.415762909767, delta_error: 7.39926142357e-07 < 1e-06 (exit)
    138 stage2_smooth_s: done (0.5937881139998353 s)
    139 
    140 run: starting iteration 6/25
    141 stage1_optimize_r: compute costs...
    142 compute_unary_costs...
    143 blur sigma: 10.84169013106163 pixels (image diagonal: 758.9183091743142 pixels)
    144 compute_unary_costs: done (0.5921503869994922 s)
    145 stage1_optimize_r: optimizing dense crf (10 iters)...
    146 stage1_optimize_r: dense crf done (0.8720934989996749 s)
    147 stage1_optimize_r: done (1.5388636010011396 s)
    148 remove_unused_intensities: 15/15 labels kept
    149 stage2_smooth_s: constructing linear system...
    150 solving linear system...
    151 solving sparse linear system (37601 x 15, 75202 nnz)...
    152 l1 optimization: (iter 0) mean_error: 0.619964978736
    153 l1 optimization: (iter 10) mean_error: 0.433095199442
    154 l1 optimization: (iter 20) mean_error: 0.426054271345
    155 l1 optimization: (iter 30) mean_error: 0.425190827702
    156 l1 optimization: (iter 40) mean_error: 0.425058632191
    157 l1 optimization: (iter 48) mean_error: 0.425038841506, delta_error: 9.60581080511e-07 < 1e-06 (exit)
    158 stage2_smooth_s: done (0.6509161739995761 s)
    159 
    160 run: starting iteration 7/25
    161 stage1_optimize_r: compute costs...
    162 compute_unary_costs...
    163 blur sigma: 9.486478864678928 pixels (image diagonal: 758.9183091743142 pixels)
    164 compute_unary_costs: done (0.5920468869990145 s)
    165 stage1_optimize_r: optimizing dense crf (10 iters)...
    166 stage1_optimize_r: dense crf done (0.8754881279983238 s)
    167 stage1_optimize_r: done (1.544129306999821 s)
    168 remove_unused_intensities: 15/15 labels kept
    169 stage2_smooth_s: constructing linear system...
    170 solving linear system...
    171 solving sparse linear system (36755 x 15, 73510 nnz)...
    172 l1 optimization: (iter 0) mean_error: 0.627910150615
    173 l1 optimization: (iter 10) mean_error: 0.43875294303
    174 l1 optimization: (iter 20) mean_error: 0.431762743505
    175 l1 optimization: (iter 30) mean_error: 0.431104294517
    176 l1 optimization: (iter 40) mean_error: 0.431007532326
    177 l1 optimization: (iter 46) mean_error: 0.430995949755, delta_error: 8.77516629028e-07 < 1e-06 (exit)
    178 stage2_smooth_s: done (0.6091458529990632 s)
    179 
    180 run: starting iteration 8/25
    181 stage1_optimize_r: compute costs...
    182 compute_unary_costs...
    183 blur sigma: 8.43242565749238 pixels (image diagonal: 758.9183091743142 pixels)
    184 compute_unary_costs: done (0.5855570280000393 s)
    185 stage1_optimize_r: optimizing dense crf (10 iters)...
    186 stage1_optimize_r: dense crf done (0.8547230149997631 s)
    187 stage1_optimize_r: done (1.515983179999239 s)
    188 remove_unused_intensities: 15/15 labels kept
    189 stage2_smooth_s: constructing linear system...
    190 solving linear system...
    191 solving sparse linear system (33610 x 15, 67220 nnz)...
    192 l1 optimization: (iter 0) mean_error: 0.665736118836
    193 l1 optimization: (iter 10) mean_error: 0.470680514058
    194 l1 optimization: (iter 20) mean_error: 0.461393751811
    195 l1 optimization: (iter 30) mean_error: 0.46026093385
    196 l1 optimization: (iter 40) mean_error: 0.46008151787
    197 l1 optimization: (iter 50) mean_error: 0.46006048483
    198 l1 optimization: (iter 50) mean_error: 0.46006048483, delta_error: 7.13663690532e-07 < 1e-06 (exit)
    199 stage2_smooth_s: done (0.6291282800011686 s)
    200 
    201 run: starting iteration 9/25
    202 stage1_optimize_r: compute costs...
    203 compute_unary_costs...
    204 blur sigma: 7.589183091743142 pixels (image diagonal: 758.9183091743142 pixels)
    205 compute_unary_costs: done (0.5784938489996421 s)
    206 stage1_optimize_r: optimizing dense crf (10 iters)...
    207 stage1_optimize_r: dense crf done (0.8727145949997066 s)
    208 stage1_optimize_r: done (1.5304242220008746 s)
    209 remove_unused_intensities: 15/15 labels kept
    210 stage2_smooth_s: constructing linear system...
    211 solving linear system...
    212 solving sparse linear system (31189 x 15, 62378 nnz)...
    213 l1 optimization: (iter 0) mean_error: 0.709556319409
    214 l1 optimization: (iter 10) mean_error: 0.500595527149
    215 l1 optimization: (iter 20) mean_error: 0.492321439986
    216 l1 optimization: (iter 30) mean_error: 0.491430305891
    217 l1 optimization: (iter 40) mean_error: 0.491332338391
    218 l1 optimization: (iter 49) mean_error: 0.491316172339, delta_error: 7.75992434643e-07 < 1e-06 (exit)
    219 stage2_smooth_s: done (0.5869300369995472 s)
    220 
    221 run: starting iteration 10/25
    222 stage1_optimize_r: compute costs...
    223 compute_unary_costs...
    224 blur sigma: 6.899257356130129 pixels (image diagonal: 758.9183091743142 pixels)
    225 compute_unary_costs: done (0.6024649629998748 s)
    226 stage1_optimize_r: optimizing dense crf (10 iters)...
    227 stage1_optimize_r: dense crf done (0.8745310489994154 s)
    228 stage1_optimize_r: done (1.5556861759996536 s)
    229 remove_unused_intensities: 15/15 labels kept
    230 stage2_smooth_s: constructing linear system...
    231 solving linear system...
    232 solving sparse linear system (29766 x 15, 59532 nnz)...
    233 l1 optimization: (iter 0) mean_error: 0.735994109185
    234 l1 optimization: (iter 10) mean_error: 0.526304734392
    235 l1 optimization: (iter 20) mean_error: 0.515772788891
    236 l1 optimization: (iter 30) mean_error: 0.514534596355
    237 l1 optimization: (iter 36) mean_error increased: 0.514402404439 --> 0.514416410605 (exit)
    238 stage2_smooth_s: done (0.5050967379993381 s)
    239 
    240 run: starting iteration 11/25
    241 stage1_optimize_r: compute costs...
    242 compute_unary_costs...
    243 blur sigma: 6.324319243119285 pixels (image diagonal: 758.9183091743142 pixels)
    244 compute_unary_costs: done (0.5678862309996475 s)
    245 stage1_optimize_r: optimizing dense crf (10 iters)...
    246 stage1_optimize_r: dense crf done (0.8836220150005829 s)
    247 stage1_optimize_r: done (1.527260953998848 s)
    248 remove_unused_intensities: 15/15 labels kept
    249 stage2_smooth_s: constructing linear system...
    250 solving linear system...
    251 solving sparse linear system (29535 x 15, 59070 nnz)...
    252 l1 optimization: (iter 0) mean_error: 0.741882340631
    253 l1 optimization: (iter 10) mean_error: 0.530476714165
    254 l1 optimization: (iter 20) mean_error: 0.522208230328
    255 l1 optimization: (iter 30) mean_error: 0.521135630436
    256 l1 optimization: (iter 40) mean_error: 0.520994358485
    257 l1 optimization: (iter 47) mean_error: 0.520979465156, delta_error: 8.24535989374e-07 < 1e-06 (exit)
    258 stage2_smooth_s: done (0.5645751089996338 s)
    259 
    260 run: starting iteration 12/25
    261 stage1_optimize_r: compute costs...
    262 compute_unary_costs...
    263 blur sigma: 5.837833147494725 pixels (image diagonal: 758.9183091743142 pixels)
    264 compute_unary_costs: done (0.5735502790012106 s)
    265 stage1_optimize_r: optimizing dense crf (10 iters)...
    266 stage1_optimize_r: dense crf done (0.9114546349992452 s)
    267 stage1_optimize_r: done (1.5603041840004153 s)
    268 remove_unused_intensities: 15/15 labels kept
    269 stage2_smooth_s: constructing linear system...
    270 solving linear system...
    271 solving sparse linear system (29307 x 15, 58614 nnz)...
    272 l1 optimization: (iter 0) mean_error: 0.746392356218
    273 l1 optimization: (iter 10) mean_error: 0.537803689155
    274 l1 optimization: (iter 20) mean_error: 0.527371253087
    275 l1 optimization: (iter 30) mean_error: 0.526434112731
    276 l1 optimization: (iter 40) mean_error: 0.526316320673
    277 l1 optimization: (iter 46) mean_error: 0.526305673425, delta_error: 9.59256531319e-07 < 1e-06 (exit)
    278 stage2_smooth_s: done (0.5614078930011601 s)
    279 
    280 run: starting iteration 13/25                                                                                                                                                                     [214/7610]
    281 stage1_optimize_r: compute costs...
    282 compute_unary_costs...
    283 blur sigma: 5.420845065530815 pixels (image diagonal: 758.9183091743142 pixels)
    284 compute_unary_costs: done (0.5659318560010433 s)
    285 stage1_optimize_r: optimizing dense crf (10 iters)...
    286 stage1_optimize_r: dense crf done (0.8842907340003876 s)
    287 stage1_optimize_r: done (1.5257483599998523 s)
    288 remove_unused_intensities: 15/15 labels kept
    289 stage2_smooth_s: constructing linear system...
    290 solving linear system...
    291 solving sparse linear system (27972 x 15, 55944 nnz)...
    292 l1 optimization: (iter 0) mean_error: 0.773853801604
    293 l1 optimization: (iter 10) mean_error: 0.559586556523
    294 l1 optimization: (iter 20) mean_error: 0.549398153147
    295 l1 optimization: (iter 30) mean_error: 0.547986199579
    296 l1 optimization: (iter 35) mean_error increased: 0.547894372781 --> 0.547896035881 (exit)
    297 stage2_smooth_s: done (0.47925809000116715 s)
    298 
    299 run: starting iteration 14/25
    300 stage1_optimize_r: compute costs...
    301 compute_unary_costs...
    302 blur sigma: 5.059455394495428 pixels (image diagonal: 758.9183091743142 pixels)
    303 compute_unary_costs: done (0.5734855059999973 s)
    304 stage1_optimize_r: optimizing dense crf (10 iters)...
    305 stage1_optimize_r: dense crf done (0.9105934059989522 s)
    306 stage1_optimize_r: done (1.561003109000012 s)
    307 remove_unused_intensities: 15/15 labels kept
    308 stage2_smooth_s: constructing linear system...
    309 solving linear system...
    310 solving sparse linear system (27467 x 15, 54934 nnz)...
    311 l1 optimization: (iter 0) mean_error: 0.783897527628
    312 l1 optimization: (iter 10) mean_error: 0.566821847196
    313 l1 optimization: (iter 20) mean_error: 0.557159197805
    314 l1 optimization: (iter 30) mean_error: 0.55564332358
    315 l1 optimization: (iter 40) mean_error: 0.55537877309
    316 l1 optimization: (iter 50) mean_error: 0.55533702513
    317 l1 optimization: (iter 54) mean_error: 0.555333196652, delta_error: 1.07781230607e-07 < 1e-06 (exit)
    318 stage2_smooth_s: done (0.5889139669998258 s)
    319 
    320 run: starting iteration 15/25
    321 stage1_optimize_r: compute costs...
    322 compute_unary_costs...
    323 blur sigma: 4.743239432339464 pixels (image diagonal: 758.9183091743142 pixels)
    324 compute_unary_costs: done (0.5652168649994564 s)
    325 stage1_optimize_r: optimizing dense crf (10 iters)...
    326 stage1_optimize_r: dense crf done (0.9014703690008901 s)
    327 stage1_optimize_r: done (1.547290978998717 s)
    328 remove_unused_intensities: 15/15 labels kept
    329 stage2_smooth_s: constructing linear system...
    330 solving linear system...
    331 solving sparse linear system (27116 x 15, 54232 nnz)...
    332 l1 optimization: (iter 0) mean_error: 0.791842473657
    333 l1 optimization: (iter 10) mean_error: 0.573400876961
    334 l1 optimization: (iter 20) mean_error: 0.563325144168
    335 l1 optimization: (iter 30) mean_error: 0.562210411814
    336 l1 optimization: (iter 35) mean_error increased: 0.562123003338 --> 0.562123113041 (exit)
    337 stage2_smooth_s: done (0.47673624800154357 s)
    338 
    339 run: starting iteration 16/25
    340 stage1_optimize_r: compute costs...
    341 compute_unary_costs...
    342 blur sigma: 4.464225348084201 pixels (image diagonal: 758.9183091743142 pixels)
    343 compute_unary_costs: done (0.5694691879998572 s)
    344 stage1_optimize_r: optimizing dense crf (10 iters)...
    345 stage1_optimize_r: dense crf done (0.8925902729988593 s)
    346 stage1_optimize_r: done (1.5394175100009306 s)
    347 remove_unused_intensities: 15/15 labels kept
    348 stage2_smooth_s: constructing linear system...
    349 solving linear system...
    350 solving sparse linear system (26079 x 15, 52158 nnz)...
    351 l1 optimization: (iter 0) mean_error: 0.814814990158
    352 l1 optimization: (iter 10) mean_error: 0.589985840271
    353 l1 optimization: (iter 20) mean_error: 0.580643986305
    354 l1 optimization: (iter 30) mean_error: 0.579654937015
    355 l1 optimization: (iter 40) mean_error: 0.579545343555
    356 l1 optimization: (iter 50) mean_error: 0.579523484835
    357 l1 optimization: (iter 51) mean_error: 0.579523131158, delta_error: 3.53676597342e-07 < 1e-06 (exit)
    358 stage2_smooth_s: done (0.5542264689993317 s)
    359 
    360 run: starting iteration 17/25
    361 stage1_optimize_r: compute costs...
    362 compute_unary_costs...
    363 blur sigma: 4.21621282874619 pixels (image diagonal: 758.9183091743142 pixels)
    364 compute_unary_costs: done (0.5775087729998631 s)
    365 stage1_optimize_r: optimizing dense crf (10 iters)...
    366 stage1_optimize_r: dense crf done (0.8994289300007949 s)
    367 stage1_optimize_r: done (1.5562123859999701 s)
    368 remove_unused_intensities: 15/15 labels kept
    369 stage2_smooth_s: constructing linear system...
    370 solving linear system...
    371 solving sparse linear system (26468 x 15, 52936 nnz)...
    372 l1 optimization: (iter 0) mean_error: 0.806100123463
    373 l1 optimization: (iter 10) mean_error: 0.584476665487
    374 l1 optimization: (iter 20) mean_error: 0.574978404455
    375 l1 optimization: (iter 30) mean_error: 0.574059125645
    376 l1 optimization: (iter 40) mean_error: 0.573946381544
    377 l1 optimization: (iter 48) mean_error: 0.573934056462, delta_error: 7.93614210903e-07 < 1e-06 (exit)
    378 stage2_smooth_s: done (0.5404784649999783 s)
    379 
    380 run: starting iteration 18/25
    381 stage1_optimize_r: compute costs...
    382 compute_unary_costs...
    383 blur sigma: 3.9943068903911274 pixels (image diagonal: 758.9183091743142 pixels)
    384 compute_unary_costs: done (0.5776914130001387 s)
    385 stage1_optimize_r: optimizing dense crf (10 iters)...
    386 stage1_optimize_r: dense crf done (0.8881214180000825 s)
    387 stage1_optimize_r: done (1.5512798629988538 s)
    388 remove_unused_intensities: 14/15 labels kept
    389 stage2_smooth_s: constructing linear system...
    390 solving linear system...
    391 solving sparse linear system (26755 x 14, 53510 nnz)...
    392 l1 optimization: (iter 0) mean_error: 0.800227144263
    393 l1 optimization: (iter 10) mean_error: 0.580760011161
    394 l1 optimization: (iter 20) mean_error: 0.571072338112
    395 l1 optimization: (iter 30) mean_error: 0.570175604626
    396 l1 optimization: (iter 40) mean_error: 0.57003969275
    397 l1 optimization: (iter 48) mean_error: 0.570021159545, delta_error: 6.59219483889e-07 < 1e-06 (exit)
    398 stage2_smooth_s: done (0.5348999540001387 s)
    399 
    400 run: starting iteration 19/25
    401 compute_unary_costs...
    402 blur sigma: 3.794591545871571 pixels (image diagonal: 758.9183091743142 pixels)
    403 compute_unary_costs: done (0.5321224870003789 s)
    404 stage1_optimize_r: optimizing dense crf (10 iters)...
    405 stage1_optimize_r: dense crf done (0.8216276469993318 s)
    406 stage1_optimize_r: done (1.4295585580002808 s)
    407 remove_unused_intensities: 14/14 labels kept
    408 stage2_smooth_s: constructing linear system...
    409 solving linear system...
    410 solving sparse linear system (25760 x 14, 51520 nnz)...
    411 l1 optimization: (iter 0) mean_error: 0.823102834924
    412 l1 optimization: (iter 10) mean_error: 0.598165207553
    413 l1 optimization: (iter 20) mean_error: 0.58779100678
    414 l1 optimization: (iter 30) mean_error: 0.586455670291
    415 l1 optimization: (iter 40) mean_error: 0.586311308971
    416 l1 optimization: (iter 48) mean_error: 0.586294653467, delta_error: 9.07397276428e-07 < 1e-06 (exit)
    417 stage2_smooth_s: done (0.5258193869995011 s)
    418 
    419 run: starting iteration 20/25
    420 stage1_optimize_r: compute costs...
    421 compute_unary_costs...
    422 blur sigma: 3.613896710353877 pixels (image diagonal: 758.9183091743142 pixels)
    423 compute_unary_costs: done (0.5337906789991393 s)
    424 stage1_optimize_r: optimizing dense crf (10 iters)...
    425 stage1_optimize_r: dense crf done (0.8146714840004279 s)
    426 stage1_optimize_r: done (1.423714012000346 s)
    427 remove_unused_intensities: 13/14 labels kept
    428 stage2_smooth_s: constructing linear system...
    429 solving linear system...
    430 solving sparse linear system (27844 x 13, 55688 nnz)...
    431 l1 optimization: (iter 0) mean_error: 0.7763068581
    432 l1 optimization: (iter 10) mean_error: 0.56457658627
    433 l1 optimization: (iter 20) mean_error: 0.554611154765
    434 l1 optimization: (iter 30) mean_error: 0.553539496221
    435 l1 optimization: (iter 40) mean_error: 0.553407694958
    436 l1 optimization: (iter 49) mean_error: 0.553388498944, delta_error: 5.71098693003e-07 < 1e-06 (exit)
    437 stage2_smooth_s: done (0.535263923000457 s)
    438 
    439 run: starting iteration 21/25
    440 stage1_optimize_r: compute costs...
    441 compute_unary_costs...
    442 blur sigma: 3.4496286780650647 pixels (image diagonal: 758.9183091743142 pixels)
    443 compute_unary_costs: done (0.4950314950001484 s)
    444 stage1_optimize_r: optimizing dense crf (10 iters)...
    445 stage1_optimize_r: dense crf done (0.7790628120001202 s)
    446 stage1_optimize_r: done (1.3543717560005462 s)
    447 remove_unused_intensities: 12/13 labels kept
    448 stage2_smooth_s: constructing linear system...
    449 solving linear system...
    450 solving sparse linear system (27464 x 12, 54928 nnz)...
    451 l1 optimization: (iter 0) mean_error: 0.783821193892
    452 l1 optimization: (iter 10) mean_error: 0.567872874384
    453 l1 optimization: (iter 20) mean_error: 0.559774390113
    454 l1 optimization: (iter 30) mean_error: 0.558840502984
    455 l1 optimization: (iter 40) mean_error: 0.55872708717
    456 l1 optimization: (iter 47) mean_error: 0.558709929732, delta_error: 8.11216353647e-07 < 1e-06 (exit)
    457 stage2_smooth_s: done (0.5060469210002339 s)
    458 
    459 run: starting iteration 22/25
    460 stage1_optimize_r: compute costs...
    461 compute_unary_costs...                                                                                                                                                                             [32/7610]
    462 blur sigma: 3.2996448224970183 pixels (image diagonal: 758.9183091743142 pixels)
    463 compute_unary_costs: done (0.4522810700000264 s)
    464 stage1_optimize_r: optimizing dense crf (10 iters)...
    465 stage1_optimize_r: dense crf done (0.6781864069998846 s)
    466 stage1_optimize_r: done (1.2041443830003118 s)
    467 remove_unused_intensities: 12/12 labels kept
    468 stage2_smooth_s: constructing linear system...
    469 solving linear system...
    470 solving sparse linear system (26613 x 12, 53226 nnz)...
    471 l1 optimization: (iter 0) mean_error: 0.803313082765
    472 l1 optimization: (iter 10) mean_error: 0.585454389126
    473 l1 optimization: (iter 20) mean_error: 0.572935523084
    474 l1 optimization: (iter 30) mean_error: 0.571668572036
    475 l1 optimization: (iter 40) mean_error: 0.571550105523
    476 l1 optimization: (iter 50) mean_error: 0.57152486767
    477 l1 optimization: (iter 51) mean_error: 0.571524126167, delta_error: 7.41502855561e-07 < 1e-06 (exit)
    478 stage2_smooth_s: done (0.515380897999421 s)
    479 
    480 run: starting iteration 23/25
    481 stage1_optimize_r: compute costs...
    482 compute_unary_costs...
    483 blur sigma: 3.1621596215596424 pixels (image diagonal: 758.9183091743142 pixels)
    484 compute_unary_costs: done (0.4568941420002375 s)
    485 stage1_optimize_r: optimizing dense crf (10 iters)...
    486 stage1_optimize_r: dense crf done (0.6868505080001341 s)
    487 stage1_optimize_r: done (1.2174359950004146 s)
    488 remove_unused_intensities: 12/12 labels kept
    489 stage2_smooth_s: constructing linear system...
    490 solving linear system...
    491 solving sparse linear system (28014 x 12, 56028 nnz)...
    492 l1 optimization: (iter 0) mean_error: 0.773720996995
    493 l1 optimization: (iter 10) mean_error: 0.56187904257
    494 l1 optimization: (iter 20) mean_error: 0.550965017396
    495 l1 optimization: (iter 30) mean_error: 0.549877522487
    496 l1 optimization: (iter 40) mean_error: 0.549742202569
    497 l1 optimization: (iter 47) mean_error: 0.549728343696, delta_error: 9.56516332029e-07 < 1e-06 (exit)
    498 stage2_smooth_s: done (0.5140209019991744 s)
    499 
    500 run: starting iteration 24/25
    501 stage1_optimize_r: compute costs...
    502 compute_unary_costs...
    503 blur sigma: 3.035673236697257 pixels (image diagonal: 758.9183091743142 pixels)
    504 compute_unary_costs: done (0.46191501500106824 s)
    505 stage1_optimize_r: optimizing dense crf (10 iters)...
    506 stage1_optimize_r: dense crf done (0.6868947450002452 s)
    507 stage1_optimize_r: done (1.2291630130002886 s)
    508 remove_unused_intensities: 12/12 labels kept
    509 split_label_clusters: 12 --> 5912
    510 remove_unused_intensities: 5912/5912 labels kept
    511 stage2_smooth_s: constructing linear system...
    512 solving linear system...
    513 solving sparse linear system (27519 x 5912, 55038 nnz)...
    514 l1 optimization: (iter 0) mean_error: 0.211440063628
    515 l1 optimization: (iter 10) mean_error: 0.203399581531
    516 l1 optimization: (iter 20) mean_error: 0.203242222921
    517 l1 optimization: (iter 24) mean_error: 0.203233986913, delta_error: 7.34804542463e-07 < 1e-06 (exit)
    518 stage2_smooth_s: done (8.013847729998815 s)
    519 solve (61.8871597870002 s)
    Output

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

        

  • 相关阅读:
    终于看到费德勒在法网如愿!
    o(∩_∩)o...,今天去博客园了!
    条款4:使用Conditional特性代替#if条件编译
    MSDTC无法启动的解决方法
    2009 很有意义的一天
    从现在开始,争取记录每天所学到的、所感受到的、所遇见到的点点滴滴!
    了解MOSS2007 内容类型ID(Content Type IDs)命名规则
    CreateSpecificCulture('zhcn')和new CultureInfo('zhcn')的区别
    金华大显数码科技有限公司诚聘
    使用SQL Server中按位于来表示组合状态
  • 原文地址:https://www.cnblogs.com/phillee/p/11028589.html
Copyright © 2020-2023  润新知