Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

add tests

Rory Cleare01eecf3d227
diff --git a/test/test_qwen.py b/test/test_qwen.py
new file mode 100644
index 0000000..665817d
--- /dev/null
+++ b/test/test_qwen.py
@@ -0,0 +1,11 @@
+from llm.qwen3vl import Qwen3VL
+from utils.helpers import jit_infer
+import cv2
+if __name__ == "__main__":
+ qwen = Qwen3VL(size=f"2B", res=(640, 640)) # h, w. they need to be multiples of 32
+ print("prewarming Qwen")
+ qwen.prewarm()
+ print("DONE")
+ text = qwen.generate(prompt="what make, model, and color is this? one sentence only", image=cv2.cvtColor(cv2.imread("test/clip_images/f40.jpg"), cv2.COLOR_BGR2RGB), reset=True)
+ print("text =",text)
+ assert text == "This is a red Ferrari F40, a classic sports car from the 1980s."
\ No newline at end of file
diff --git a/test/test_yolo.py b/test/test_yolo.py
new file mode 100644
index 0000000..3d6e858
--- /dev/null
+++ b/test/test_yolo.py
@@ -0,0 +1,22 @@
+from detection.yolov9 import YOLOv9
+import cv2
+from tinygrad import Tensor
+from utils.helpers import jit_infer
+import numpy as np
+if __name__ == "__main__":
+ jit_cache = {}
+ img = cv2.imread("test/clip_images/f40.jpg")
+ img = Tensor(img)
+ model = YOLOv9("t", 960)
+ for _ in range(3): preds = jit_infer(model, img, jit_cache).numpy()
+ ret = []
+ print(preds)
+ for p in preds:
+ if p[-2] > 0.5: ret.append(list(p))
+ print(ret)
+ assert len(ret) == 1
+ expected = [70.17624, 212.71173, 895.62067, 517.2943, 0.6730736, 2.0]
+ np.testing.assert_allclose(expected,ret[0], rtol=1e-4)
+
+ # sanity test, BEAM is flakey
+