-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DocTestFailure
on skimage.measure.fit.ransac
#6479
Comments
Using the following test code: import numpy as np
from skimage import __version__, measure
print(f"* skimage version: {__version__}")
t = np.linspace(0, 2 * np.pi, 50)
xc, yc = 20, 30
a, b = 5, 10
x = xc + a * np.cos(t)
y = yc + b * np.sin(t)
data = np.column_stack([x, y])
rng = np.random.default_rng(203560) # do not copy this value
data += rng.normal(size=data.shape)
data[0] = (100, 100)
data[1] = (110, 120)
data[2] = (120, 130)
data[3] = (140, 130)
model = measure.EllipseModel()
model.estimate(data)
print(f"* model.params: {np.round(model.params)}")
ransac_model, inliers = measure.ransac(data, measure.EllipseModel, 20, 3, max_trials=50)
print(f"* ransac_model.params: {abs(np.round(ransac_model.params))}") Testing in three different versions:
... 🤔 |
Hey, there hasn't been any activity on this issue for more than 180 days. For now, we have marked it as "dormant" until there is some new activity. You are welcome to reach out to people by mentioning them here or on our forum if you need more feedback! If you think that this issue is no longer relevant, you may close it by yourself; otherwise, we may do it at some point (either way, it will be done manually). In any case, thank you for your contributions so far! |
The code seems to be doing exactly what it should: the ellipse fit on all data is a bad fit, and the ransac fit is a better fit. You can see that the ransac fit, and a fit on |
Perhaps the confusion is why the input parameters and output parameters differ. I wonder if different parametrizations can result in similar ellipses? |
OK, here's the long and short of it: (1) Noise is added do data, so we should not expect to recover the original model exactly. Given the above, let's look at the results again. Original model parameters:
Parameters estimated from noisy (but not outlier) data:
RANSAC estimates:
All correct, but it makes for a poor example in the docstring! Recommended course of action: change the docstring to show that |
Description
Job
linux-cp3.9-pre
returnsFAILED scikit-image/skimage/measure/fit.py::skimage.measure.fit.ransac
, with the following:The text was updated successfully, but these errors were encountered: