Fitting a curve to points with machine learning techniques. Videos and example files.

   3607   9   2
User Avatar
Member
15 posts
Joined: Jan. 2010
Offline
Hey everyone,

I've been studying machine learning and how it can be applied to houdini and I've come across a good application for it with curve fitting. Correct me if I'm wrong, but I don't think there is a way to accurately fit a curve to points in houdini. This technique is a bit limited but overall does a pretty good job.

I've made a tutorial series that comes with a example indie file and indie otls. I would love to hear your feedback.

Example File:
https://github.com/amovfx/HipFiles/blob/master/CurveFitting.v01.hiplc [github.com]

Otls:
https://github.com/amovfx/otls [github.com]

Videos
https://vimeo.com/307423675 [vimeo.com]
https://vimeo.com/307424388 [vimeo.com]
https://vimeo.com/307424680 [vimeo.com]
https://vimeo.com/307425022 [vimeo.com]
Edited by amelnychuk - Dec. 20, 2018 02:00:16
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Interesting topic! I´d love to try this out.

Unfortunately I get an LinAlgError: SVG did not converge on Mac OS.

Python error: Traceback (most recent call last): File "", line 35, in File "/Applications/Houdini/Houdini17.0.388/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 1404, in svd u, s, vt = gufunc(a, signature=signature, extobj=extobj) File "/Applications/Houdini/Houdini17.0.388/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 99, in _raise_linalgerror_svd_nonconvergence raise LinAlgError("SVD did not converge") LinAlgError: SVD did not converge
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
15 posts
Joined: Jan. 2010
Offline
Hi Konstantin,

Try the updated file. I suspect the missing attribute covariance caused a problem. The otls are now embeded. This is quite odd.
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Thank you, it works now! Seems like a very good resource.

By the way, one month ago I started a similar thread based on volumes, though:
https://forums.odforce.net/topic/40318-move-points-through-the-center-of-a-sdf/ [forums.odforce.net]

I find numpy very interesting. But it feels to me like an introductory tutorial on how to use it with Houdini is still missing
Especially how to fluently read and write all sorts of attributes with Python and Numpy is only vaguely documented so far.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Correct me if I'm wrong, but I don't think there is a way to accurately fit a curve to points in houdini.

Actually, it does.

A variation of the vex spline function allows you use point position arrays of variable lengths.

Aside from ones approach to generating/acquiring the array of point positions, the curve based on those positions can be done in a single wrangle node.

http://www.sidefx.com/docs/houdini/vex/functions/spline.html [www.sidefx.com]
Edited by BabaJ - Dec. 21, 2018 09:06:27
User Avatar
Member
45 posts
Joined: Feb. 2014
Offline
BabaJ
Actually, it does.

I may be missing something, but I think what you're referring to is interpolation between points not fitting. amelnychuk's setup fits a curve to a set of points, rather then drawing a smooth curve through each point.
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
It's not an interpolation. The same thing in the end…a smooth curve(spline) through a set of points.
Edited by BabaJ - Dec. 21, 2018 23:09:17
User Avatar
Member
7801 posts
Joined: Sept. 2011
Offline
BabaJ
It's not an interpolation. The same thing in the end…a smooth curve(spline) through a set of points.

The two aren't remotely related.
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
The two aren't remotely related.

If you watch/listen to his last video…it is exactly the same approach.

In reference to what he was stating…

Correct me if I'm wrong, but I don't think there is a way to accurately fit a curve to points in houdini.

and my response
Edited by BabaJ - Dec. 22, 2018 07:09:42
User Avatar
Member
45 posts
Joined: Feb. 2014
Offline
Thanks for the scene file and videos! You got me to take a more serious look at and really helped me get started with numpy.

Great stuff!
  • Quick Links