The pipe in the photo is very realistic, but the text reflects a completely different meaning from the photo. For image recognition, how to handle the content of photos is hindered. This also reflects that people's perception of images may not necessarily be the meaning conveyed by the images, and they cannot use simple recognition of symbols to judge the content of the entire photo. In Excavating AI, the author mentions the "dark" classification of race and gender that appears in ImageNet. Realizing true 'fair' classification is what companies need to do now, but although using three workers for classification can only avoid personal bias, it cannot change the problem of limited diversity in the dataset itself.



I create a hunter game to let user kill the monster in 30 seconds. Different reaction will give the monster different damage points. The camera will detect the damage kind. If the monster gets the same damage in 2 seconds, the damage will work to the monster. If the user kills the monster within 30s, wins. Otherwise, lose.
Link:
https://editor.p5js.org/YuhongSun/sketches/R0vdAC7M_
let classifier;
let imageModelURL = "<https://teachablemachine.withgoogle.com/models/vrwm-mmh2/>";
let video;
let label = "";
let img;
let monsterB = 99;
let gameTimer = 30;
let gameOver = false;
let shootTimer = 0;
let punchTimer = 0;
const requiredDuration = 2000;
function preload() {
classifier = ml5.imageClassifier(imageModelURL + "model.json");
img = loadImage("monster.jpg");
}
function setup() {
createCanvas(800, 600);
video = createCapture(VIDEO, { flipped: true });
video.size(280, 210);
video.hide();
classifyVideo();
setInterval(() => {
if (gameTimer > 0 && !gameOver) {
gameTimer -= 1;
}
if (!gameOver) {
updateActionTimers();
}
}, 1000);
}
function classifyVideo() {
classifier.classify(video, gotResult);
}
function gotResult(results, error) {
if (error) {
console.error(error);
return;
}
label = results[0].label;
handleAttack(label);
if (!gameOver) {
classifyVideo();
}
}
function updateActionTimers() {
if (label === "Shoot") {
shootTimer += 1000;
punchTimer = 0;
} else if (label === "Punch") {
punchTimer += 1000;
shootTimer = 0;
} else {
shootTimer = 0;
punchTimer = 0;
}
}
function handleAttack(label) {
if (shootTimer >= requiredDuration) {
monsterB -= 10;
shootTimer = 0;
}
if (punchTimer >= requiredDuration) {
monsterB -= 1;
punchTimer = 0;
}
}
function draw() {
background(0);
image(img, -120, 0, 1000, 600);
image(video, width - 280, height - 210, 280, 210);
textSize(24);
text(`Time Left: ${gameTimer}s`, 30, 50);
fill(0);
rect(280, 45, 200, 50);
fill(255);
textSize(35);
textStyle(BOLD);
text(`Blood: ${monsterB}`, 300, 82);
if (monsterB <= 0 && gameTimer > 0) {
gameOver = true;
textSize(64);
textStyle(BOLD);
text("You Win!", width / 2 - 150, height / 2);
noLoop();
}
else if(gameTimer == 0){
gameOver = true;
textSize(64);
textStyle(BOLD);
text("Game Over", width / 2 - 200, height / 2);
noLoop();
}
push();
textSize(16);
textAlign(CENTER, CENTER);
text(`Damage: ${label}`, width / 2, height - 20);
pop();
}
function mouseClicked() {
if (gameOver) {
gameOver = false;
monsterB = 100;
gameTimer = 30;
loop();
classifyVideo();
}
}
//The image of monster is created by AI tool.