Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: output array is read-only #5

Open
yuxijin opened this issue May 31, 2019 · 4 comments
Open

ValueError: output array is read-only #5

yuxijin opened this issue May 31, 2019 · 4 comments

Comments

@yuxijin
Copy link

yuxijin commented May 31, 2019

Hi, guys. I was attempting to run the decompose.py file by command 'python decompose.py test.jpg', while I got an error like the following:
Traceback (most recent call last): File "decompose.py", line 125, in <module> r, s, decomposition = solver.solve() File "/home/jinyuxi/Documents/intrinsic/bell2014/solver.py", line 38, in solve self.initialize_intensities() File "/home/jinyuxi/Documents/intrinsic/bell2014/solver.py", line 105, in initialize_intensities samples[:, 0] *= self.params.kmeans_intensity_scale ValueError: output array is read-only
I don't know why and how to fix this issue. Is there anybody can tell me what should I do?

@seanbell
Copy link
Owner

Not sure why it isn't letting you modify -- looks like the array is not writeable. You could try changing the code to add this line before the error:
samples = np.copy(samples)

If that works, then a more general solution might be this code instead:

if not samples.flags['WRITEABLE']):
    samples = np.copy(samples)

@yuxijin
Copy link
Author

yuxijin commented Jun 3, 2019 via email

@seanbell
Copy link
Owner

Did this solve your issue?

@yuxijin
Copy link
Author

yuxijin commented Jul 5, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants