Skip to content

jhaberbe/markov_random_field

Repository files navigation

Markov Random Field

Documentation Status

Markov Random Field for Image Segmentation

Usage

For a given grayscale image 'image_array', you do the followimg:

import markov_random_field.markov_random_field hmrf = markov_random_field.markov_random_field.HiddenMarkovRandomField(n_classes=4) pixel_level_classified_image_array = hmrf.fit(grayscale)

That's it.

Features

  • TODO
  1. Sort class labels by pixel means (0 for smallest, n for largest).

Credits

This package borrows almost everything from this repository:
https://github.com/lucananni93/Hidden-Markov-Random-Fields/blob/master/image_segmentation/main.py

I made small QoL improvements (using scipy.signal.convolve2d instead of iterating through all the pixels to make this faster).

As a small benchmark, an image of size (14930, 20226) with 4 classes takes 20m 40.7s to run on a cluster with 20 cores and 100 GB of RAM. It probably required nowhere near that amount of memory to run, however your mileage will vary.

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors