baidu-research / NCRF

Cancer metastasis detection with neural conditional random field (NCRF)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NCRF 模型参数问题

Ryanrenqian opened this issue · comments

commented

使用提供的模型参数进行测试,发现FROC只有0.39 AUC只有0.9660。 想请教作者是如何将该FROC提升至0.79的? 目前来看性能差别有点大。

commented

我看到你的NMS里面有提供高斯核滤波,请问这个有没有用到,还是说只用默认参数就好了?

commented

@Ryanrenqian 你好,请问你使用的是repo自带的ckpt吗?目前其他用户重写结果层面没有出现问题。

commented

没错,我使用的是repo提供的ckpt。

commented

@Ryanrenqian 那就比较奇怪了,在你这边能提供更多信息之前,我也没办法进一步定位可能的问题了。

commented

我具体是这样做的先根据README提供命令生成了Heatmap然后NMS提取坐标, 最后用的FROC计算,我发现用ASPP生成的Mask.tif文件有问题,就换成直接根据xml注释的坐标进行了计算,得出的结果和之前有个issue的结果是一样的0.39。 所以我想确认的是 提供的ckpt是论文给出的最佳结果吗,如果是的话,那就可能CAMELYON16现在的提供的XML和之前比赛的tif之间是存在差异的。

commented
def judgeinpoly(x, y, coord):
    """
    Judge whether (x,y) is in coord
    """
    HittedLabel = 0
    for i, annotation in enumerate(coord['positive']):
        name = annotation['name']
        vertices = np.array(annotation['vertices'])
        In_poly = points_in_poly([(x, y)], vertices)
        # In_poly = points_in_poly([(y,x)],vertices)
        if In_poly:
            HittedLabel = i + 1
            return HittedLabel
    return HittedLabel


def computeITC(mask, resolution, level):
    """Compute the list of labels containing Isolated Tumor Cells (ITC)
    Description:
        A region is considered ITC if its longest diameter is below 200µm.
        As we expanded the annotations by 75µm, the major axis of the object
        should be less than 275µm to be considered as ITC (Each pixel is
        0.243µm*0.243µm in level 0). Therefore the major axis of the object
        in level 5 should be less than 275/(2^5*0.243) = 35.36 pixels.
    Args:
        evaluation_mask:    The evaluation mask
        resolution:         Pixel resolution of the image at level 0
        level:              The level at which the evaluation mask was made
    Returns:
        Isolated_Tumor_Cells: list of labels containing Isolated Tumor Cells
    """
    max_label = len(mask['positive'])
    Isolated_Tumor_Cells = []
    threshold = 275 / (resolution * pow(2, level))
    for i, annotation in enumerate(mask['positive']):
        name = annotation['name']
        vertices = np.array(annotation['vertices'])
        rect = cv2.minAreaRect(vertices)
        x, y = rect[1]
        length = math.sqrt(pow(x, 2) + pow(y, 2))
        if length < threshold:
            Isolated_Tumor_Cells.append(i + 1)
    return Isolated_Tumor_Cells

主要替换FROC部分的代码如上

commented

说错了 是将xml用代码转化成json,然后计算FROC

commented

您能不能提供你用NMS生成的坐标,我拿来和我生成的坐标对比一下? 我想确认一下是不是官方提供xml的左右和比赛用的不一样。。

commented

@Ryanrenqian ASPP生成的坐标跟我之前用的原始的不太一样。。。你看你生成的Test_026_tissue_mask.npy at level 6 跟我在repo里提供的一样吗?https://drive.google.com/file/d/1BdOJGeag7kq8_p1NqU_v-EQcV_OxHgcW/view

commented

这是我生成的结果, 看起来是一样的除了颜色。 另外你保留的test026的mask文件能否发我一下,我的邮箱是renq2019@pku.edu.cn , 我想看看到底是哪里不一样, 十分感谢你的帮助~~

commented

我检查一下tissue mask发现确实存在一些差异。。。。

commented

难道我们的原图也不一样吗, 我比较了一下矩阵尺寸,是一样大的, 但是生成的tissue mask确实存在差异...但是我看Prob热力图是非常接近的.

commented

我检查了openslide的版本是3.4.1,应该会生成一样的tissue mask啊. 我主要是发现test026的标注和转化成Mask有一些问题, Test026肿瘤区域里会有一部分正常区域,而这个正常区域又有肿瘤区域. 所以想问问Test026的Mask长啥样?
image

commented

image
不过tissue确实有问题.我发现 tissue mask变成了Probs了..

commented

image
这个是生成的组织图 是一样的。。

commented

@Ryanrenqian 我给你email发了一份原始的test_026.tif ground truth mask,你要不试试?

commented

@Ryanrenqian 如果你这边没有新的问题的话可以关掉这个issue吗?

您好,我也同样遇到了这个问题,您后来这个问题解决了吗?