weird idea, work in progress: (1) get DistilBERT hidden states (768 dimensions) for 768 sentences (of Frankenstein, in this instance) → stack vertically to form a 768x768 square → subtract the column-wise mean, normalize → lil bit of gaussian blur and threshold → "skeletonize" with skimage → "asemic" "writing"?

first attempt at sending this to the plotter. I ended up cutting the plot short because I could see some aesthetic and technical problems that I want to fix, and I didn't want to bother waiting another 45mins for the plot to finish, haha. but the basic idea is there and I think it looks nice?

more progress! I ended up having to write my own skeleton tracing algorithm, which I thiiiink is working okay now—basically it does a flood fill starting with pixels having exactly one neighbor, and each connected pixel is a node in a graph; later I use visvalingam-wyatt line simplification on each segment between nodes w/3+ edges. this technique gives me nice long lines, clean intersections, & hopefully more elegant plotter gestures. (this is just a raster preview, will try an actual plot soon)

more details 

the colors are just for debugging (fading from red to blue according to the index of the given polyline)—the final piece will just be b/w. also this is using debug data (thresholded uniform noise w/gaussian filter), not DistilBERT states like I'll use for the final version. I'm at the point in the project where I need to break the code out into standalone modules instead of having one big spaghetti notebook

Follow

fiiiinally made a complete plot from this idea that I actually like! this is: distilbert hidden states from the first ~1k sentences of Frankenstein, stacked vertically to form a bitmap, normalized, blurred, skeletonized into a rhizome of polylines, then plotted on an axidraw. (the idea was to invent a form of "asemic" "writing" to visualize machine learning model hidden states)

· · Web · 2 · 3 · 21

details 

this is using my homegrown bitmap-skeleton-to-polyline code (friend.camp/@aparrish/10757711). I intentionally lowered the pen height on the axidraw in the hope of producing some organic swooshes on the pen lift motion and... I think I might have overdone it a bit, haha. next version of this will use a finer pen, a denser skeleton, and maybe a bit of code to reduce the number of pen lifts when the current polyline begins at the same place as where the last one ended

Sign in to participate in the conversation
Friend Camp

Hometown is adapted from Mastodon, a decentralized social network with no ads, no corporate surveillance, and ethical design.

<svg xmlns="http://www.w3.org/2000/svg" id="hometownlogo" x="0px" y="0px" viewBox="25 40 50 20" width="100%" height="100%"><g><path d="M55.9,53.9H35.3c-0.7,0-1.3,0.6-1.3,1.3s0.6,1.3,1.3,1.3h20.6c0.7,0,1.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.9 h10.2v4.9H41.7z M48.5,42.1l-1.2-1.6h4.8l1.2,1.6H48.5z M44.1,40.5l1.2,1.6h-7.5l1.2-1.6H44.1z M49.2,44.6h5.5v4.9h-5.5V44.6z"/></g></svg>