seanbell / intrinsic

Code for Bell et al, "Intrinsic Images in the Wild", SIGGRAPH 2014.
MIT License
152 stars 33 forks source link

krahenbuhl2013 compatibility issue with Python 3.6.4 #4

Open oy321 opened 5 years ago

oy321 commented 5 years ago

Hello, I have been trying to make this working with Python 3 in a Windows environment. I have fixed most of the issues with the latest eigen code, but got stuck with the DenseCRF map() function in krahenbuhl2013.pyx, where it raised an error message as below: "... loading reflectances... Error loading pickled dat file in: C:\workspace\cv\intrinsic_images_in_the_wild\bell2014\energy\prob_abs_r.dat loaded reflectances solve... initialization: k-means clustering with 20 centers... clustering done (0.07672129372008385 s). intensities: [0.02288366 0.58980664 0.99538995 0.10214907 0.48563758 0.01581242 0.24498024 0.68647472 0.33832016 0.1594008 0.07133502 0.1033111 0.0343453 0.36848925 0.02129602 0.7977585 0.19756343 0.05561196 0.08012422 0.27910016]

run: starting iteration 0/25 stage1_optimize_r: compute costs... compute_unary_costs... blur sigma: 43.220018509945135 pixels (image diagonal: 432.20018509945135 pixels) compute_unary_costs: done (0.13884072930522962 s) stage1_optimize_r: optimizing dense crf (10 iters)... Traceback (most recent call last):

File "", line 1, in runfile('C:/workspace/cv/intrinsic_images_in_the_wild/bell2014/decompose.py', args='C:/Temp/3663_20150501_soi.png', wdir='C:/workspace/cv/intrinsic_images_in_the_wild/bell2014')

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/workspace/cv/intrinsic_images_in_the_wild/bell2014/decompose.py", line 125, in r, s, decomposition = solver.solve()

File "C:\workspace\cv\intrinsic_images_in_the_wild\bell2014\solver.py", line 47, in solve self.stage1_optimize_r()

File "C:\workspace\cv\intrinsic_images_in_the_wild\bell2014\solver.py", line 162, in stage1_optimize_r self.decomposition.labels_nz = densecrf.map(self.params.n_crf_iters)

File "krahenbuhl2013.pyx", line 45, in intrinsic_images_in_the_wild.bell2014.krahenbuhl2013.krahenbuhl2013.DenseCRF.map

SystemError: ..\Objects\moduleobject.c:449: bad argument to internal function"

I was not able to locate this 'moduleobject.c' file in the 'krahenbuhl2013' folder therefore couldn't go further fixing this bug. Any advice would be appreciated.

I understand that I could go for 'virtualenv' and use recommended Python 2.7 setups. But it'd be good to have this library running in Python 3 Windows env as my other code are in this env.

Thank you!

Regards,

rodroadl commented 1 year ago

Hi, it has been a while, but if you are still stuck with this hope this works:

I was able to run this with Python 3.8.0 in WSL with some modification. Here - https://github.com/rodroadl/intrinsic-python3 - is my code for it

However, one thing I notcied is you ran in Windows environment ( assuming not using WSL), so I don't know how that would play out.