Machine Learning Project: Unsupervised — Machine Hallucinations — MoMA
Artist Refik Anadol's project at MoMA showcased an AI-driven reinterpretation of modern art from the museum's large collection. His installation continuously generated new digital forms, evolving and shifting in real-time, creating an entirely new visual experience from over 200 years of art history. Displayed from 2022 to 2023, the work was captivating, with the digital art flowing like waves in an ocean. It's fascinating to see how the dataset, composed of centuries of artistic works, could be transformed in such an innovative and fluid manner. I could sit and watch it for a while. It would be really cool to see if this art could be manipulated quicker and maybe even create scenes, or construct human/animal like figures.
https://refikanadol.com/works/unsupervised/
For the homework, I wanted to play around with handPose, so I used the keypoints sketch as reference:
let handPose;
let video;
let hands = [];
function preload() {
// Load the handPose model
handPose = ml5.handPose();
}
function setup() {
createCanvas(640, 480);
// Create the webcam video and hide it
video = createCapture(VIDEO);
video.size(640, 480);
video.hide();
// start detecting hands from the webcam video
handPose.detectStart(video, gotHands);
}
function draw() {
// Draw the webcam video
image(video, 0, 0, width, height);
// Draw all the tracked hand points
for (let i = 0; i < hands.length; i++) {
let hand = hands[i];
for (let j = 0; j < hand.keypoints.length; j++) {
let keypoint = hand.keypoints[j];
fill(0, 255, 0);
noStroke();
circle(keypoint.x, keypoint.y, 10);
}
}
}
// Callback function for when handPose outputs data
function gotHands(results) {
// save the output to the hands variable
hands = results;
}
I wanted to add color and emojis to see if I could change the background depending on how close or far apart the hand points were. I altered the code so that it caluclated the distance between the index finger and pinky finger using the dist() function. Then I just used an if-else statement to determine what background color would appear.
This is the code for that below:
if (distance > 100) {
background(255, 105, 180);
for (let flower of flowers){
textSize(32);
text("🌼", flower.x, flower.y);
}
}
else {
background(0, 0, 139);
for (let star of stars){
textSize(32);
text("⭐", star.x, star.y);
}
}
However, the emojis weren’t appearing so I wondered if that had to do with the background color being drawn after the emojis are being placed on the screen. I didn’t think that was the problem, but I separated the statements incase. I initialised the emoji positions because I realised the issue could have had to do with where the emojis were being placed in the canvas.
for (let i = 0; i < 20; i++) {
flowers.push(createVector(random(width), random(height)));
stars.push(createVector(random(width), random(height)));
}
The emojis finally appeared and I was able to get this: