CellProfiling / HPA-Cell-Segmentation

Apache License 2.0
95 stars 26 forks source link

ValueError: Please speicify the image path(s) for er channels! #19

Closed glopezzz closed 3 years ago

glopezzz commented 3 years ago

Hii, I'm working on some cell images. When I try to segment the whole cell with the.pred_cells() function I get the following error:

ValueError: Please speicify the image path(s) for er channels!

I've declared he cellSegmentator object as the example:

NUC_MODEL = "./nuclei-model.pth"
CELL_MODEL = "./cell-model.pth"
segmentator = cellsegmentator.CellSegmentator(
                  NUC_MODEL,
                  CELL_MODEL,
                  scale_factor=0.25,
                  device="cuda",
                  padding=False,
                  multi_channel_model=True,
)

I'm introducing 3 images, either as arrays or as image paths, and I get the same answer:

[array([[  0,   0,   0, ..., 116,  95, 163],
        [  0,   0,   0, ..., 126, 132, 142],
        [  0,   0,   0, ..., 108, 127, 130],
        ...,
        [  0,   0,   0, ...,   0,   0,   0],
        [  0,   0,   0, ...,   0,   0,   0],
        [  0,   0,   0, ...,   0,   0,   0]], dtype=uint8),
 array([[0, 0, 0, ..., 0, 0, 0],
        [0, 0, 0, ..., 0, 0, 0],
        [0, 0, 0, ..., 0, 0, 0],
        ...,
        [0, 0, 0, ..., 0, 0, 0],
        [0, 0, 0, ..., 0, 0, 0],
        [0, 0, 0, ..., 0, 0, 0]], dtype=uint8),
 array([[ 0,  0,  0, ..., 18, 20, 30],
        [ 0,  0,  0, ..., 26, 17, 32],
        [ 0,  0,  0, ..., 24, 18, 16],
        ...,
        [ 0,  0,  0, ...,  0,  0,  0],
        [ 0,  0,  0, ...,  0,  0,  0],
        [ 0,  0,  0, ...,  0,  0,  0]], dtype=uint8)]

2.

['../input/hpa-single-cell-image-classification/train/5b931256-bb99-11e8-b2b9-ac1f6b6435d0_red.png',
 '../input/hpa-single-cell-image-classification/train/5b931256-bb99-11e8-b2b9-ac1f6b6435d0_blue.png',
 '../input/hpa-single-cell-image-classification/train/5b931256-bb99-11e8-b2b9-ac1f6b6435d0_yellow.png']

Any ideas on how to solve this? Thank you!

glopezzz commented 3 years ago

Solved!

I got it working addind this code before calling the pred_cells() function:

inter_step = [[i] for i in image[:-1]]

This returns the following:

[['../input/hpa-single-cell-image-classification/train/5b931256-bb99-11e8-b2b9-ac1f6b6435d0_red.png'],
 ['../input/hpa-single-cell-image-classification/train/5b931256-bb99-11e8-b2b9-ac1f6b6435d0_blue.png'],
 ['../input/hpa-single-cell-image-classification/train/5b931256-bb99-11e8-b2b9-ac1f6b6435d0_yellow.png']]

Hope this helps, Escanor.