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

05: Supervised Segmentation Pipeline issue #25

Closed
thomasnilsson opened this issue Mar 28, 2019 · 3 comments
Closed

05: Supervised Segmentation Pipeline issue #25

thomasnilsson opened this issue Mar 28, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@thomasnilsson
Copy link

The following piece of code

from pipe_utils import flatten_step
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import RobustScaler
digit_pipe = Pipeline([('Flatten', flatten_step),
                       ('Normalize', RobustScaler())])
digit_pipe.fit(img_data)

show_pipe(digit_pipe, img_data)
show_pipe(digit_pipe, img_data, show_hist=True)

Produces the following error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-39-fb8d4dbf3178> in <module>()
      6 digit_pipe.fit(img_data)
      7 
----> 8 show_pipe(digit_pipe, img_data)
      9 show_pipe(digit_pipe, img_data, show_hist=True)

~/GitHub/QBI-ethz/Quantitative-Big-Imaging-2019-master/Lectures/pipe_utils.py in show_pipe(pipe, in_data, show_hist)
     52                     last_data = step_op.predict(last_data)
     53 
---> 54         display_data(c_ax, last_data, show_hist)
     55         c_ax.set_title('Step {} {}\n{}'.format(i, last_data.shape, step_name))
     56         c_ax.axis('on')

~/GitHub/QBI-ethz/Quantitative-Big-Imaging-2019-master/Lectures/pipe_utils.py in display_data(in_ax, raw_data, show_hist)
     33         else:
     34             n_stack = np.stack([(x-x.mean())/x.std() for x in in_data], 0)
---> 35             in_ax.imshow(montage2d(n_stack))
     36 
     37 

TypeError: 'module' object is not callable
@kmader
Copy link
Owner

kmader commented Mar 29, 2019

@thomasnilsson You have a different version of skimage (which renamed montage2d to montage).

A temporary fix is to change the second line of pipe_utils.py from
from skimage.util import montage as montage2d to from skimage.util.montage import montage2d and it should work.

If you are comfortable using pip and upgrading packages then you can also run pip install scikit-image==0.14.2 and everything will work without making any changes

@kmader kmader self-assigned this Mar 29, 2019
@kmader kmader added the bug Something isn't working label Mar 29, 2019
@kmader
Copy link
Owner

kmader commented Apr 2, 2019

Did that work for you or is there still an issue?

@thomasnilsson
Copy link
Author

pip install scikit-image==0.14.2 worked wonders, thank you for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants