惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
美团技术团队
量子位
M
MIT News - Artificial intelligence
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
小众软件
小众软件
博客园 - 司徒正美
罗磊的独立博客
云风的 BLOG
云风的 BLOG
B
Blog RSS Feed
博客园 - 聂微东

Rc-2020 on Julia Evans

Day 57: Trying to set up GitHub Actions Day 56: A little WebAssembly Day 53: a little nginx, IPv6, and wireguard Day 52: testing how many Firecracker VMs I can run Day 51: Fixed my logging and made a couple of puzzles Day 50: Building some tarballs for puzzles, and trying to make a kernel boot faster Day 49: making the VMs boot faster Day 48: Another Go program, and a little vim configuration Day 47: Using device mapper to manage Firecracker images Day 46: debugging an iptables problem Day 44: Building my VMs with Docker Day 43: Building VM images Day 42: Writing a Go program to manage Firecracker VMs Day 41: Trying to understand what a bridge is Day 40: screen flickering & a talk about containers Day 39: Customizing gotty's terminal Day 38: Modifying gotty to serve many different terminal applications at once Day 37: A new laptop and a little Vue Day 35: Launching my VMs more reliably Day 34: Learning about qemu Day 33: pairing is magic and beautiful git diffs Day 32: A Rails model that doesn't use the database with ActiveHash Day 24: a short talk about blogging myths, and a debugging tip Day 23: a little Rails testing Day 22: getting OAuth to work in Rails Day 21: wrangling systemd & setting up git deploys to a VM Day 20: trying to figure out how Google Cloud IAM works Day 18: an answer to an autoencoder question Day 17: trying to wrap my head around autoencoders Day 13: BPTT, and debugging why a model isn't training is hard
Day 19: Clustering faces (poorly) using an autoencoder
Julia Evans · 2020-12-05 · via Rc-2020 on Julia Evans

I’ve been working on clustering faces using an autoencoder, and I finally have some fun screenshots to share so here they are.

our training data: faces

Our input data looks like this: (from the google quickdraw dataset)

Each face is represented as a sequence of vectors, one vector for every line in the face (kind of like an SVG path). Here’s an example:

tensor([[-0.0956, -0.2869,  0.0000],
        [-0.3108, -0.1434,  0.0000],
        [-0.5738,  0.1673,  0.0000],
        [-0.3108,  0.2391,  0.0000],
        [-0.3586,  0.4303,  0.0000],
        ... lots more ...

the idea: many vectors -> one vector -> many vectors

The way RNN autoencoders work that there’s an Encoder RNN that turns this sequence of vectors into 1 vector (mine is 50 dimension), and then a Decoder RNN that turns the 1 vector back into a sequence of vectors.

The idea is to train the Encoder and Decoder networks so that Decoder(Encoder(x)) is as close to x as possible for every x in the training set. I used the mean squared error as a loss function to start.

The training didn’t go that well – I got the loss to go down a bit (from 0.3 to 0.25), but it definitely didn’t seem that well trained. I think it would have maybe done better if I trained it for longer but I got bored.

the autoencoder results

Here are 4 pairs of x and Decoder(Encoder(x)) from the training set

I’m actually pretty impressed by this – it seems to have figured how to draw a circle of about the right size for the face, and vaguely that it should draw something inside the circle. Way better than nothing!

doing some clustering

My original goal was to cluster the faces by taking Encoder(x) for the inputs in the training set and clustering those vectors.

I used DBSCAN from scikit-learn more or less arbitrarily, basically because it seemed like it might work better for higher dimensional vectors (I had 50 dimensions)

here’s what the clusters looked like:

It seems to have clustered them mostly by the size of the face, and not by any of the interior features. This makes sense because the decoder seems to be able to reproduce the size of the face pretty effectively but totally fails at reproducing the interior features. Neat!

next: see if I can get it to draw some eyes

My next goal I think is to see if I can improve the autoencoder network so that it can also draw the components inside the face better. We’ll see how it goes!