Views
No views yet
onnxruntime-web. Built for iAny, the offline, on-device Khmer AI platform.Live now: try it at iany.app/waste-scan — fully on-device, nothing uploaded. Help improve it by contributing photos at iany.app/waste.
0 can
1 glass
2 organic
3 other
4 paper
5 plastic_bottle
6 plastic_otherlabels.txt in this repo has the same order. Output is a softmax over these 7 classes.float32, shape [1, 224, 224, 3] (NHWC).[0,255] → [-1,1] (i.e. x/127.5 - 1).1import onnxruntime as ort, numpy as np
2from PIL import Image
3
4labels = ["can","glass","organic","other","paper","plastic_bottle","plastic_other"]
5img = Image.open("item.jpg").convert("RGB").resize((224, 224))
6x = (np.asarray(img, np.float32) / 127.5 - 1.0)[None] # [1,224,224,3], [-1,1]
7sess = ort.InferenceSession("model.onnx")
8probs = sess.run(None, {sess.get_inputs()[0].name: x})[0][0]
9print(labels[int(probs.argmax())], float(probs.max()))src/lib/wasteOnnx.ts in iAny for a live-camera implementation./waste photos are folded in and the model is retrained.ewaste class yet (not enough e-waste training images) — 7 of iAny's 8 material types./waste-scan experiment; and pre-filling labels in the /waste data collector. Not a certified sorting or compliance system.