Dreams, Drugs & ConvNets
It seems that some artifacts generated by artificial neural networks are eerily similar to those created by our altered states of mind, be it dreams or thanks to psychedelics.
While mentioning psychedelics (and showing trippy computer-generated images) has some entertainment value, my motivation is different, as explained in Exploring human vs machine learning (one blogpost at a time):
While each particular machine learning algorithm comes with its own artifacts and limitations, some issues are much broader. In fact, there are limitations of any learning process, machine or human alike. I think that it’s worth investigating these, as there is a lot of room for cross-pollination between machine learning and cognitive science.
Note that it will touch the subject of drugs (and deep learning). If you are uncomfortable with the topic, please don’t proceed any further.
To set the right expectations: I invite you for a visual trip with some text blobs and link rabbit holes, rather than going deep into the topic. Embrace the (creative) chaos! :)
Dreams and drugs
Most of you have had some night dreams. Some may have experienced other altered states of mind due to sleep deprivation and fever (e.g. hypnagogic and hypnopompic hallucinations), mystical visions, or substance (ab)use.
We see “recursion is consciousness” theme. Just a few moments before, Gandalf struggles against a shapeless form on darkness.
Most deities appearing in LSD sessions fall into two rather sharply defined categories: the first group includes those that are associated with the forces of light and good; the second is comprised of deities of darkness and evil. — Stanislav Grof, Realms of Human Unconsciousness
But enough of bad trips, fights with supernatural powers (remember Jacob wrestling with an angel?). Though, many trips are less metaphysical and more visual:
Quite frequently, the visual field is dominated by abstract geometric designs or architectural patterns that underlie all the dynamic color changes. The persons experiencing these elements often describe them as interiors of gigantic temples, naves of incredibly beautiful Gothic cathedrals, cupolas of monumental mosques, or decorations in Moorish palaces (“arabesques”). Sometimes these visions are compared with paintings of various abstract artists such as Piet Mondrian and Wassily Kandinski. On other occasions, the experiencers talk about phenomenal kaleidoscopic displays, magic sparkling fountains, and jeux d’eau or majestic fireworks. — Stanislav Grof, Realms of Human Unconsciousness
We see dogs, birds, and cats… everywhere!
Admire, explore and ask yourself a question:
What should I use: THC, LSD, DMT?
A good GPU!
I mean, using a GPU (and TPUs) won’t be necessarily cheaper than other three-letter acronyms. But certainly is more inspiring!
How does it work? Crucially, these are not networks are not ones designed for creating such psychedelic images. Essentially, we are forcing a network to see pareidolia (more on that below, in “deep dreams are made of these”). Are deep dreams similar in any meaningful way to tripy experiences? See r/replications and make your judgment.
There are numerous “trip reports”, as well as a lot of graphics seemingly inspired by psychedelic experiences, e.g. SuperHazed on DeviantArt or Spiritual Transformations I-II by Ryszard Kostecki.
I wanted to add that we cannot take a “screenshot” of what we see, inside our head. Well, that thing may chance as well. Here is an image reconstructed from fMRI scans:
Speaking of what “what people have in their minds”, let’s focus on a stereotypical teenager’s vision (see some drawings by CollegeHumor). Here we go — a Generative Adversarial Network for creating images (a wonderful overview). But with one more knob — is a picture Safe Work Work or not.
Also, sex in a fertile topic and deep learning is not an exception. If you look for a dataset “for a friend”, I visualized one (was, well, covered by Vice Motherboard). However, we can go beyond visualizing human bodies. Safer, you say? Well…
The effect was that of a Cyclopean city of no architecture known to man or to human imagination, with vast aggregations of night-black masonry embodying monstrous perversions of geometrical laws and attaining the most grotesque extremes of sinister bizarrerie. — At the Mountains of Madness by H. P. Lovecraft
If you desire to summon eldritch abominations on your own, you can proceed the usual. Open an unintelligible script, use it, while being not aware of the consequences.
JavaScript [is] black magic. Seeing how it is something designed to help us achieve good, with unintentional consequences beyond our comprehension, plus it can be used by evildoers to control, spy and mess with the innocent. — from If Programming Languages were Religions
Proceed Image-to-Image Demo by Christopher Hesse. If you want to play with your images, the fastest way would be using DeepAI’s demos (deep dreams, style transfer, and super-resolution).
Deep dreams are made of these
And now let’s see machines getting high. Feature visualization — how neural networks build up their understanding of images by Chris Olah et al. at Distill:
If you like to make some guessing game, there is one based on AlexNet: Deep Quiz. Bear in mind is one of the older architectures, and artifacts are more pronounced. If you can tell what’s that maybe you are a machine (think of it is as some anti-captcha).
Or if you like to create some patterns on your own, check the tensorflow/lucid for creating dreams. See Lucid: A Quick Tutorial on Colab:
Retrain your own neural networks
We don’t have two separate modes of train and evaluation. It means two things, one good and one bad:
- we learn all the time, and
- we learn all the time.
It is pretty uncontroversial that we can learn to recognize new objects (e.g. “this new face is Dave”). It may take more to learn new patterns. But about changing the low-level perception? Like colors or edges.
There are some optical illusions, that base on some temporary states of one’s mind. There is one that lasts much longer. Days, months or years.
How long it lasts? For me, it was at least a few days (and possibly, to some slight extent still now, years later). The effect is subtle and was hardly noticeable in my everyday life. If you want to re(train) your own neural network, I’ve found this McCollough Effect by Michael Bach working for me. Read the disclaimer:
If you follow the instructions below, you will change your brain for a prolonged time (up to month), in addition to simply remembering this. Proceed only if this is ok with you.
It seems to be reversible, with using the opposite patterns. A longer description, with references: McCollough Effect — The Illusion Index. Also, if you want to investigate this effect if it works also for other patters (e.g. a grid of circles vs crosses), I would be delighted to collaborate!
EDIT: https://github.com/stared/mccollough
It’s work in progress; circle vs grid pattern produces a similar effect for me. If you want to add other patterns or continuous transitions, let me know.
Final remarks
It’s based on talks with the same title, I gave a few times (neuroscience society, PlayAI conference). I trimmed it down significantly, to focus on some optical pattern-like phenomena. Even within vision, some topics deserve attention: pattern-based fears (trypophobia, highly NSFL), optical illusions (tweet, paper), uncanny valley. Oh, and actually there is already Does AI have a dirty mind, too? by Marek K. Cichy and me.
If you want to read about psychedelics, and other altered states of mind, see:
- Realms of the Human Unconscious: Observations from LSD Research
by Stanislav Grof (my review here) - How Magic Mushrooms Rearrange Your Brain—brain connection topology changes from fMRI scans
- Brain scans reveal how LSD affects consciousness — Nature
- Shamanism: A Reader, edited by Graham Harvey
- Erowid: LSD-25 and DMT, Salvia, psilocybin, etc (side this beautiful visualization of Erowid)
- On my reading list, there is also Pihkal: A Chemical Love Story by Alexander&Ann Shulgin (thanks to a Slate Star Codex review).
- Octopuses given mood drug ‘ecstasy’ reveal genetic link to evolution of social behaviors in humans
Participants ranked [their psychedelic] experiences as among the most meaningful in their lives, comparable to the birth of a child or the death of a parent. Two-thirds of the participants rated the psilocybin session among the top five most spiritually significant experiences of their lives; a third ranked it at the top. — from The Trip Treatment by Michael Pollan , as referenced in Why I Quit Tech and Became a Therapist by Glen Chiaccheri
The only drug I was on when writing this caffeine.
As a disclaimer: this article is not an encouragement to try any psychoactive substances or deep learning frameworks.