Go back

// tool

Mirage

Play
Transcript

[00:00] Watch this closely. When I hit describe image, it’s going to download both the WebAssembly and the model right here in the browser on the phone. And there it goes. It already did all of its identification. Cactus Mirage on a phone in a web browser. This is Cactus Compute’s website. They are a Y Combinator-backed company or organization whose mission is to create sub-30 megabyte foundation models that can be used on a TV, a wearable, a phone, whatever device you might want to use one of their models on. Their latest model is Mirage. It is a vision language model, but it’s also an OCR model, a detection and segmentation model, and a decision model, all wrapped up in 22 megabytes. You can download Mirage freely from Hugging Face, and we’re going to dive right into that. So Cactus comes with its own compute engine. You cannot run this in Llama C++ or anything like that. We’re going to install it with pip install cactus compute.

[01:06] And once that’s installed, I’m going to jump into this directory called test images and show you guys this sign dot JPEG. So it’s a picture of stop sign kind of in a woody area on a road, whatever. We’re going to see what Cactus makes of that or what Mirage makes of that. So we’re going to run Cactus Mirage, which is our model. I’m going to say describe, and then we’re going to pass in our image. Cool. So we get this giant mess of Jason, which is a little hard to read. So I’m going to rerun that. I’m going to pipe the results to sign dot Jason. Now we’ve got that. So now we’ll take a look at it with JQ. So I will cat sign dot Jason. We’ll pipe that to JQ and we’ll get the keys. Cool. So we’ve got events, objects, reasoning, bunch of stuff. Let’s clear that out and take a look at one of these. We will try the reasoning keys. So reasoning. And there we go. We get kind of a standard, what you might expect from a VLM, you know, what’s in the image. Let’s take a look at the text. So we do have a string of stop. We’ve got a bounding box for that in the image, and we’ve got a confidence score. So let’s try another one of these. We’ll do scene. And we get setting, background, surface, a whole bunch of detailed attributes of the image that we gave to the model.

[02:43] Let’s try another one here. We’ll do objects. Now, this is like a giant mess of stuff that’s a little hard to read here. And we’ll take a deeper dive into it. But we’ve got different objects and confidence scores. And we’ve got a mask for each and every one of them. Somewhere in here. It’s going to be the stop sign. There we go. So there’s a stop sign. And it is very confident that that is, in fact, a stop sign. Okay, let’s look at one more. This is going to be the relations. Okay. And what this does is from that list of objects that we had, it is telling us the relationship to other objects. It’s attached to, or on, or next to. So what we’re going to do is we’re going to load this up in our editor where I’ve got some code we can take a look at and see if we can’t use this in a more meaningful way. So I’ve just got a very simple button server running here with a few endpoints. Only one really matters. And it’s this post to API describe where we take in the form data, we are expecting an image. And then I literally just call the exact same command that we were running a moment ago. Cactus mirage describe and the image that we saved to a temporary path. I capture the response Jason and return it to the UI, which I just had my local agent spin up. So we’re going to jump into our terminal. I’m going to run button start. That’s going to launch our application in a browser.

[04:13] Here’s our application. We are going to drop in the sign.jpg and I can click describe image. That took 0.68 seconds. It says it found eight objects. We’ve got our description here. And on the right here, I’ve got our confidence. I’ll explain that in a second. We’ve got our scene objects and text. So if I go into these objects, it’ll highlight each of those in the image. And if I slide this confidence scale way up to like 70, it’s pretty confident that that’s a tree. And we can see the mask there is pretty confident that that’s a stop sign. So that highlight that you see on the image when I hover over it, or when I hover over these guys, that is the mask data. But I can turn that off and we get just simple boxes, like you might have seen with other models can also highlight the text here. And if I click on that, I can copy it right out of the image. So let’s try another one here. I’m going to drop in this image from one of my favorite movies. I’m going to say describe the image. And sure enough, there it is. I can copy bound by honor. And if I do the objects here, see we have text, we have a face, we have another face, another face, I can put the mask on there. You can see it highlighting each face with the mask. And I’ve got this little spotlight feature. So if I just want that, it’ll dim everything else or that. Cool. So that works, but I’m running it on a server and I have to run that command on my own machine.

[05:46] However, if we look at cactus computes model card, I can scroll down here and see that they actually have a WASM element that we can use. So to do this, you need the cactus.js and the cactus WASM files. So what we’re going to do now is run this in a browser with no server whatsoever. So I’ve got this Mirage demo repository. I’ll have a link to it in the description. This is the exact same app that we were just looking at the server side app, except there’s no server side. It all runs in the browser. If I jump into WASM app here, you can see I’ve got the cactus.js as well as the cactus WASM, but there’s no model in here. So what’ll happen is if you run this in the browser, it will download the model to your browser, the 22 megabytes that it requires. And I believe that 22 megabytes actually includes the WASM file, which is 1.2 megabytes. So I have this running here on one of my websites. This is hosted on GitHub pages. There’s no server here. And the image I’m about to upload is this McDonald’s in Germany receipt. I just want to see how it does with OCR. So I’ll grab that and drop it in here. And now when I hit describe image, we should see it download the WASM and then the model, but it’ll go really quick. There’s the WASM. There’s the model. It is all done. And we can see it has highlighted pretty much every piece of text text in here. I’m not sure exactly how accurate it is. If I pull this down a bit. So paper, text blocks, text blocks, and lots and lots of text that I can copy right out of the image.

[07:38] So what that means is I can take my phone here and I can go to the website. I can click on the image target and say take photo. And then I’ll take a photo of these items here on my desk. Say use photo. And now we’ll watch this closely. When I hit describe image, it’s going to download both the WebAssembly and the model right here in the browser on the phone. And there it goes. It already did all of its identification. And we’ve got the mouse and it got the tablet. It thinks the duck is an apple for some reason. Let me go to text. And yeah, so it got the handwritten annotation that I put there at the top, but it also picked up on a bunch of other texts, which is great. So that’s Cactus Mirage on a phone in a web browser. I’m Joe Metalone. I make short, practical videos that respect your intelligence and your time. If that’s your style, you’ll like this channel.

A vision model designed for image understanding and structured data extraction. It offers a Python package that automatically downloads and caches its engine and weights on first use.

Details

URLhttps://huggingface.co/Cactus-Compute/mirage
TypeLibrary / CLI
PricingFree (open source)
Open SourceYes
LicenseUnknown
Tech StackPython
PlatformsUnknown — not stated on the project page.
Self-HostedPartial

Key Features

Best For

Developers and researchers needing a locally runnable vision model for image description and structured data extraction. It is particularly useful for projects requiring automated visual analysis without relying on cloud inference providers.

Integrations

Hugging Face, GitHub

Notes

The model supports image-text-to-text tasks and has one listed finetune. It is not currently deployed by any Hugging Face Inference Provider. The package automatically handles downloading and caching of both the engine and model weights. Runtime binaries and supported platforms are linked separately.


Share this post on:

Next
Timestral