TheYuriG
TheYuriG•3d ago

How can I do simple image recognition with Deno?

It's some very simple recognition, i don't need to recognize cats or dogs or people, just a few set of images within a bigger image and the quantity of each. Imagine counting the totals of a loot drop in game. It's that simple.
3 Replies
Mrcool 🇵🇸
You can explore hugging js, for example a simple object detection
import { HfInference } from "npm:@huggingface/inference";

const HF_TOKEN = ...
const inference = new HfInference(HF_TOKEN);
const result = await inference.objectDetection({
data: await (await fetch(import.meta.resolve("./img.png"))).blob(),
});
console.log(result);
import { HfInference } from "npm:@huggingface/inference";

const HF_TOKEN = ...
const inference = new HfInference(HF_TOKEN);
const result = await inference.objectDetection({
data: await (await fetch(import.meta.resolve("./img.png"))).blob(),
});
console.log(result);
and there are many models to choose from
TheYuriG
TheYuriGOP•2d ago
was afraid that using a LLM would be the only option, I've seen that option online
Mrcool 🇵🇸
There are simple ways like looking for pixels colors if a yellow object is inside a dark background you can find it