当前位置: 首页>>代码示例>>Python>>正文


Python Data.imFromFile方法代码示例

本文整理汇总了Python中utils.Data.imFromFile方法的典型用法代码示例。如果您正苦于以下问题:Python Data.imFromFile方法的具体用法?Python Data.imFromFile怎么用?Python Data.imFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils.Data的用法示例。


在下文中一共展示了Data.imFromFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testSingleImg

# 需要导入模块: from utils import Data [as 别名]
# 或者: from utils.Data import imFromFile [as 别名]
def testSingleImg():
    NetHelper.gpu()
    #submission()
    nh=NetHelper(deploy=cfgs.deploy_pt,model=cfgs.best_model_dir)
    img=Data.imFromFile(os.path.join(cfgs.train_mask_path,"1_1_mask.tif"))
    res=nh.bin_pred_map(img)
    print(np.histogram(res))
开发者ID:yihui-he,项目名称:Ultrasound-Nerve-Segmentation,代码行数:9,代码来源:run_length.py

示例2: func

# 需要导入模块: from utils import Data [as 别名]
# 或者: from utils.Data import imFromFile [as 别名]
def func(filename, nh):
    _,idx,ext=Data.splitPath(filename)
    if ext!=".tif": 
        return None
    cfgs.cnt+=1
    print(cfgs.cnt)
    #idx=int(idx)
    img=Data.imFromFile(filename)
    ready=prep(img,cfgs.inShape[1],cfgs.inShape[0]) 
    # print(np.histogram(ready))
    # ready*=0.00392156862745
    ready-=128
    ready*=0.0078431372549
    pred_bin,pred, img=classifier(ready,nh)
    # pred_bin,pred,output, img=classifier(ready,nh)

    result=run_length_enc(pred_bin)
    if debug:
        # print('org',np.histogram(ready))
        # print('data', np.histogram(img))
        hist=np.histogram(img)
        print(pd.DataFrame(hist[0],index=hist[1][1:]).T)
        hist=np.histogram(pred)
        print(pd.DataFrame(hist[0],index=hist[1][1:]).T)

        mask=plt.imread(os.path.join(cfgs.train_mask_path,idx+"_mask.tif"))
        plt.figure(1)
        plt.subplot(221)
        plt.title('mask')
        plt.imshow(mask)
        plt.subplot(222)
        plt.title('prediction')
        plt.imshow(pred_bin)
        plt.subplot(223)
        plt.title('img')
        plt.imshow(img)
        plt.subplot(224)
        plt.title('heatmap ')
        plt.imshow(pred)
        plt.show()
        # print(idx,result)

    return (idx,result)
开发者ID:yihui-he,项目名称:Ultrasound-Nerve-Segmentation,代码行数:45,代码来源:run_length.py


注:本文中的utils.Data.imFromFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。