kmader / Quantitative-Big-Imaging-2019

The material for the Quantitative Big Imaging course at ETHZ for the Spring Semester 2019
http://kmader.github.io/Quantitative-Big-Imaging-2019
Apache License 2.0
27 stars 20 forks source link

05: Supervised Segmentation Pipeline issue #25

Closed thomasnilsson closed 5 years ago

thomasnilsson commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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

thomasnilsson commented 5 years ago

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