Giter VIP home page Giter VIP logo

image-segmentation's Issues

Difference calculations on unsigned ints wrap around

The data type of the image data is uint8, which means that the difference calculations in the weight function will wrap around when negative values are encountered. This produces incorrect (and asymmetric) values for the differences between pixels.

For example, using the test_2_segments.png image data:

In [12]: img[40,40,:]
Out[12]: array([255, 255, 255], dtype=uint8)

In [13]: img[26,26,:]
Out[13]: array([0, 0, 0], dtype=uint8)

In [14]: img[40,40,:] - img[26,26,:]
Out[14]: array([255, 255, 255], dtype=uint8)

In [15]: img[26,26,:] - img[40,40,:]
Out[15]: array([1, 1, 1], dtype=uint8)

Add some expected runtimes

It would be helpful to set expectations on the runtimes of this example, those with preinstalled images are much longer than I would have guessed (compared to small random generated and our other DQM examples),
Also, running one preinstalled image, within recommended parameter limits, fails (I assume this was tested in the past so might need also an IDE issue).

Here's what I got on a few executions in Leap IDE:

Random generated:

  • python image_segmentation.py for dimensions set to 2 and segments set to 2 ran quickly (under a minute)
  • python image_segmentation.py for dimensions set to 3 and segments set to 2 ran quickly (under a minute)
  • python image_segmentation.py for dimensions set to 6 and segments set to 2 and to 4 ran quickly (under a minute)

Preinstalled images:

  • python image_segmentation.py test_2_segments.png for 2 segments took ~15 minutes
  • python image_segmentation.py test_4_segments.png for 4 segments took ~15 minutes
  • python image_segmentation.py test_image.jpeg for 5 segments aborted after about 20 minutes:
Leap IDE /workspace/image-segmentation $ python image_segmentation.py test_image.jpeg

Reading in your image...

        Enter number of segments > 5

Preparing DQM object...
Killed
  • python image_segmentation.py test_image.jpeg for 2 segments aborted after about 20 minutes:
Leap IDE /workspace/image-segmentation $ python image_segmentation.py test_image.jpeg

Reading in your image...

        Enter number of segments > 2

Preparing DQM object...
Killed

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.