dwave-examples / image-segmentation Goto Github PK
View Code? Open in Web Editor NEWPerform basic image segmentation using discrete quadratic models (DQM) and hybrid solvers.
License: Apache License 2.0
Perform basic image segmentation using discrete quadratic models (DQM) and hybrid solvers.
License: Apache License 2.0
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)
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 minutespython image_segmentation.py test_4_segments.png
for 4 segments took ~15 minutespython 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.