Giter Club home page Giter Club logo

bfscore_python's Introduction

bfscore_python

Boundary F1 Score - Python Implementation

This is an open-source python implementation of bfscore (Contour matching score for image segmentation) for multi-class image segmentation, implemented by EMCOM LAB, SEOULTECH.

Reference: Matlab bfscore

Run

To run the function simply run python bfscore.py after setting your image paths and threshold.

Crosscheck

Score cross-checking with built-in Matlab function is done and presented in bfscore.pptx.

bfscore_python's People

Contributors

minar09 avatar theodumont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bfscore_python's Issues

Fast version

Dude, the prec/recall function is very slow. Use numpy if possible for batch calculations:

def calc_precision_recall(contours_a, contours_b, threshold):
        x = contours_a
        y = contours_b

        t1 = np.tile(x, (len(y),1))
        t2 = np.repeat(y, len(x), axis=0)
        t = np.concatenate( (t1,t2), axis=1)

        dx = (t[...,0] - t[...,2]) * (t[...,0] - t[...,2])
        dy = (t[...,1] - t[...,3]) * (t[...,1] - t[...,3])
        thr = (dx + dy) < (threshold * threshold)

        blocks = np.split(thr, len(y))
        block_has_hit = [np.any(x == True) for x in blocks]
        top_count = np.sum(block_has_hit)

        precision_recall = top_count/len(y)
        return precision_recall, top_count, len(y)

It should be the same, you can validate it with your own data.
Thanks, Balint

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.