Code Monkey home page Code Monkey logo

crf-semantic-segmentation's Introduction

CRF-semantic-segmentation

使用CRF进行语义分割
论文链接
pydensecrf模块

本模块调用pydensecrf,进行封装
彩图:可以使用1d,也可以使用2d。
灰度图:使用2d。因为原始模块pydensecrf的2d模型里边函数addPairwiseBilateral()要求原图为rgb。

可以使用两种方式运行inference。
1:直接跑完指定循环;

crf.perform_inference(n)
mask = crf.segmentation_map
plt.imshow(mask)
plt.show()

2:观察每次KL_divergence;

crf.perform_step_inference(n)
mask = crf.segmentation_map
plt.imshow(mask)
plt.show()

主要有两个文件crf_model.py和potentials.py
crf_model.py建立CRF模型;potentials.py生成所需要的势能。
图像可以输入RGB也可以输入灰度图像。
RGB可以使用1d或者2d进行分割。

具体例子看examples

原始pydensecrf库:
对于添加单点势能,DenseCRF()和DenseCRF2D()的方法是一样的。
如果使用DenseCRF()函数创建模型,则在添加pairwise能量时必须先使用create_pairwise_gaussian()或者create_pairwise_bilateral()来生成,再通过addPairwiseEnergy()函数添加。
如果使用DenseCRF2D()函数创建模型,则可以直接通过addPairwiseGaussian()和addPairwiseBilateral()来添加;而且addPairwiseBilateral()必须要求label是3通道(有颜色,公式里有)。

crf-semantic-segmentation's People

Contributors

sunyao123 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.