hc-mlx house classifier

A tiny MLX model that looks at a house photo and guesses one of five types: apartment, bungalow, villa, mansion, or haveli. Validation accuracy is 0.634 on 5,200 images (random guessing would get 0.20). A toy, built for fun.

Run it

You need a Mac with Apple silicon, Python 3.14, and the mlx, numpy, pillow, and huggingface_hub packages.

import numpy as np
from huggingface_hub import hf_hub_download
from PIL import Image
import mlx.core as mx
from model import HouseCNN  # model.py in this repo

ckpt = hf_hub_download("RanveerSoni98/hc-mlx", "house_cnn_best.safetensors")
model = HouseCNN(num_classes=5)
model.load_weights(ckpt)
model.eval()

img = Image.open("photo.jpg").convert("RGB").resize((128, 128))
x = (np.asarray(img, dtype=np.float32) / 255.0 - np.array([0.485, 0.456, 0.406])) / np.array([0.229, 0.224, 0.225])
probs = mx.softmax(model(mx.array(x[None])), axis=-1)[0]
mx.eval(probs)
labels = ["apartment", "bungalow", "villa", "mansion", "haveli"]
print(sorted(zip(labels, probs.tolist()), key=lambda t: -t[1])[:3])

Or with the project CLI: hc-mlx predict photo.jpg --repo RanveerSoni98/hc-mlx.

Training data

Places365 images from the Hub, mapped onto five house types (apartment, bungalow from house and cottage, villa from beach house, mansion, haveli from palace). See the hc-mlx project README for the full story.

Downloads last month

-

Downloads are not tracked for this model. How to track
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support